WeakAuras

WeakAuras

200M Downloads

Autocomplete feedback

asaka-wa opened this issue ยท 13 comments

commented

Is your feature request related to a problem? Please describe.

This is mostly just some feedback about the code editor autocomplete stuff but I've put "Feature Request" because ultimately I'd like a toggle in Settings for the feature.

Essentially, I know it works like the same feature in IDEs but it just brings an issue I have with those into WoW, which is that I've learned Lua without semicolons so hitting enter at the end of lines accepts whatever autocomplete suggestion is currently selected, filling in some stuff I don't want. Also, while it's an impressive feature, it makes the code editor slower. The Search API button is nice if I ever want to look stuff up in game (though I don't see why I ever would tbh) but the autocomplete feature is some minor downsides with no upside for me. Let me turn it off and I'm happy.

I guess I'd also say that the things that I type VERY frequently (and typo frequently) that this feature isn't currently helping with are things like aura_env, WeakAuras.ScanEvents, etc.

Describe the solution you'd like

A toggle in Settings for the feature.

commented

I think, the tweak I'd try would be to make it only appear if the user is actually typing, instead of every time there's a word-match. That should get rid of many accidental interactions.

commented

The fact that it slows things would still lead me to opting out of it.

Is it awkward to add a setting in the Settings button? I've not looked to see how deeply it's knitted in to things

commented

I'm in favor of using your dissatisfied feedback as a way to improve the feature to make you want to use it before blasting it with a disable option

commented

Yeah I understand that. But for your goal to be parity with the same feature on IDEs is totally sensible. But it's a feature I turn off in those too.
As a first iteration this is truly incredible. I'm sure you'll make it faster and filter out the little niggles. But I'll likely still want to turn it off :D

commented

WeakAuras.ScanEvents

This will be handled with #5216

commented

hitting enter at the end of lines accepts whatever autocomplete suggestion is currently selected, filling in some stuff I don't want.

WeakAuras/LibAPIAutoComplete-1.0@abb5a99 skip insert on ENTER if a modifier is pressed

it makes the code editor slower

WeakAuras/LibAPIAutoComplete-1.0@72f7d9f add a skiplist for words this isn't helping with, i'd need more input to complete it

#5220 add ctrl z & ctrl y support, helps when miss-usage of the autocomplete function

commented

WeakAuras/LibAPIAutoComplete-1.0@371c9ac make the list doesn't select 1st element without any interaction on show, pressing ENTER won't do insert before using arrows

WeakAuras/LibAPIAutoComplete-1.0@609edfd exit search loop after 100 match found, when typing "player" (without the wordSkip change) i could feel noticeable freeze, not anymore with this change

commented

Okay, a quick test and this is much better!
No noticeable slow down, even on "hot" words like index or unit and losing the selection when hitting enter removes that issue I had.
This is very good.

I wonder if you feel it's intended behaviour that it pops up when I'm selecting stuff. It feels mildly annoying to have it pop up as I highlight sections of text - especially if I'm selecting a line/lines, not a single token, and it pops up because the cursor is currently sitting at the end of a token.

Also, maybe not possible for you to differentiate but it pops at the end of reserved words like return

commented

WeakAuras/LibAPIAutoComplete-1.0@a435d7a skip the word "return"

editbox widget doesn't have any method to detect if a text is highlighted

A workaround is to insert "" which delete your selected (highlighted) text, then compare editbox:GetText before/after, and if different restore previous text & highlight, i couldn't get it done with a fast enough code :( (help wanted if someone find proper way)

local function hasHighlight(editbox)
  local text, curPos = editbox:APIDoc_originalGetText(), editbox:GetCursorPosition()
  if IndentationLib then
    text, curPos = IndentationLib.stripWowColorsWithPos(text, curPos)
  end
  editbox:Insert("")
  local text2, selStart = editbox:APIDoc_originalGetText(), editbox:GetCursorPosition()
  if IndentationLib then
    text2, cursorPosition = IndentationLib.stripWowColorsWithPos(text2, selStart)
  end
  local selEnd = selStart + #text - #text2
  if text ~= text2 then
    editbox:SetText(text)
    editbox:SetCursorPosition(curPos)
    editbox:HighlightText(selStart, selEnd)
    return true
  else
    return false
  end
end
commented

Yeah, I actually came up against the same issue when I was making Snippets. Ideally it would grab the highlighted text, not the whole text, so you could make a snippet of a section only. But yeah, it's mad that there isn't a GetHighlight, even if it were just the char indices for start and end.

I actually now have to do the exact trick you mention (replacing the selected text with "") in EchoRaidTools. In that at least it's relatively simple because I'm not dealing with FAIAP. but yeah, I didn't really think through the complications involved in detecting highlighting. I don't know if there's anything that could be done by finding OnCursorChanged events that happen only when OnTextChanged doesn't happen. that would obviously be awkward and maybe not worth it.

commented

Thank you for this. I share similar sentiments and was wondering if there was any information.

commented

Thank you for this. I share similar sentiments and was wondering if there was any information.

#5219 (comment)
#5219 (comment)
#5219 (comment)
https://github.com/WeakAuras/LibAPIAutoComplete-1.0/commits/main/

commented

I think complains have been mostly answered and fixed, i'll close this ticket for now