griddycode icon indicating copy to clipboard operation
griddycode copied to clipboard

Autocompletion not replacing original typed in text after a period.

Open ItsTato opened this issue 1 year ago • 2 comments

Describe the bug It seems like after a period is typed the autocompletion goes blank and starts checking the next typed in things as a whole different thing. If this description was too hard to understand (because frankly I got lost reading my own text) just read the steps to reproduce.

To Reproduce Steps to reproduce the behavior: Goal is to autocomplete in os.clock().

  1. User types in os.clo and selects os.clock() from the autocomplete menu.
  2. os.os.clock() gets added in instead of os.clock()

Expected behavior It should replace the original os.clo with os.clock(), instead of making it os.os.clock(). (Shouldn't be stopping autocomplete checking after a period.)

Screenshots what goes down in ohio: Screenshot_2 Screenshot_3

expected behavior: Screenshot_4 (man those screenshots bussin tho)

Desktop (please complete the following information):

  • OS: Linux Mint (is bro in my house how did he know)
  • Version: 1.1.1

ItsTato avatar Mar 24 '24 08:03 ItsTato

hey, i've tried this out locally and i got it to replace the text instead of just inserting it by overriding _confirm_code_completion.

BUT as you can see if you type os.c it only matches the part after the period, so only c and that's why io.close is also presented as a viable option.

this could be fixed by overriding _filter_code_completion_candidates but i figured that would be quite language-specific. for example in CSS you would also include - (the minus sign) as a viable character to use in a completion (like z-index), while in C++ it would be used for arithmetic operations and not in completions.

2 ideas i had for this problem is

  • changing the language plugin so it only presents things after the period (or in case of css after the minus sign) as viable candidates to display in completions, considering what was before the period sign
  • allowing specific symbols in each language plugin, that can belong to a completion candidate (e.g. ::, ., -)

i think it is a matter of style if you want to presented with os.clock() or just clock() if you type out os.c. for both ideas the same technique would be used to see whats before the cursor, regarding certain special symbols like ::, . or - and matching according to that.

i hope that was quite understandable ^^

butteronarchbtw avatar Mar 31 '24 11:03 butteronarchbtw

hey, i've tried this out locally and i got it to replace the text instead of just inserting it by overriding _confirm_code_completion.

BUT as you can see if you type os.c it only matches the part after the period, so only c and that's why io.close is also presented as a viable option.

I did see (Parenthesis in Expected Behaviour)

this could be fixed by overriding _filter_code_completion_candidates but i figured that would be quite language-specific. for example in CSS you would also include - (the minus sign) as a viable character to use in a completion (like z-index), while in C++ it would be used for arithmetic operations and not in completions.

2 ideas i had for this problem is

  • changing the language plugin so it only presents things after the period (or in case of css after the minus sign) as viable candidates to display in completions, considering what was before the period sign

Part of the reason I posted this as an issue was because I made the lua lang plugin have autocomplete that was like real autocomplete

  • allowing specific symbols in each language plugin, that can belong to a completion candidate (e.g. ::, ., -)

i think it is a matter of style if you want to presented with os.clock() or just clock() if you type out os.c. for both ideas the same technique would be used to see whats before the cursor, regarding certain special symbols like ::, . or - and matching according to that.

This seems like a very good solution to the problem!

i hope that was quite understandable ^^

It was, thank you! :3

ItsTato avatar Mar 31 '24 12:03 ItsTato