Not 100% sure, have to go through the code again. (Also you can add to https://bugs.freepascal.org/view.php?id=33054 )
Just throwing in a few quick notes.

For string and comments

procedure TSourceEditorManager.OnSourceCompletionTimer(Sender: TObject);
  function CheckStartIdentCompletion: boolean;
...
    if SrcEdit.EditorComponent.GetHighlighterAttriAtRowCol(LogCaret,Token,Attri)
    and (Attri<>nil) and (Attri.StoredName=SYNS_XML_AttrComment) then

auto hide after the first character gets deleted by backspace.
You mean the word becomes empty.
Or the first char typed after the completion did open? (i.e. if the I type Sou and completion only opens then, the hide when I attempt to del part of the Sou?)

In either case, there are various ways I can think of for investigation, and we need to established which one is good.

SourceEditor sees the typed chars in UserCommands (or the other callback). SO it could interfere there.
It could also be added as a callback to (I think that is the one):
  TSourceEditCompletion=class(TSynCompletion)


Also what should happen, if during completion, other commands are invoked
ctrl-e for search as you type
even ctrl-f
 (those already are an issue....)

----------------------------
If I am not mistaken (only had a very brief look at the patch)

You currently have a global bool option: on/off?
Would it be sensible to have a (separate) time delay.   So if the user types fast, it will not interfere? I seem to have thought of that as a necessity on the bug report. But since I am not actually using this feature (even if avail), I might be wrong. (Or maybe it was using a timeout, but the existing one...) Equally there might be the (unnecessary) idea, to only trigger if at least n chars of the current word have been typed?

Testing with syncro-edit and multi-caret?
The latter should probably disable it.







On 20/08/2019 18:54, Darius Blaszyk via lazarus wrote:
Now with attachment! 😀

On Tue, Aug 20, 2019 at 6:48 PM Darius Blaszyk <dhkblas...@gmail.com <mailto:dhkblas...@gmail.com>> wrote:

    Hi!

    Attached a (still) naive patch that implements automatic
    completion upon keypress. It's already giving me a big boost in
    productivity so I thought I might share it here. It would be good
    to make the identifier invocation a bit smarter. For instance I
    would like to prevent invocation in case the word is part of a
    string or comment. Also it should auto hide after the first
    character gets deleted by backspace. Any tips or hints how to use
    the codetools to get the required information is appreciated!



-- 
_______________________________________________
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to