nolanderc / glsl_analyzer

Language server for GLSL (autocomplete, goto-definition, formatter, and more)
GNU General Public License v3.0
200 stars 6 forks source link

Variable declarations in global scope suggest to auto-complete themselves #23

Closed automaticp closed 1 year ago

automaticp commented 1 year ago

Declaring a variable in local scope does not produce suggestions:

image

This is expected.

Variable declarations in global scope suggest to autocomplete to themselves:

image

It will keep suggesting itself as you type it out further. If the variable is declared for the first time, however, the self-suggestion does not appear until all other options have been rejected:

image

Not sure how much of an effort it would be to fix this, but since it works for locals, I'm hoping it's a simple change. Ideally, suggestions should not appear at all in declarations when typing them out, but it might be harder to get that right in the global scope.

nolanderc commented 1 year ago

Should be working in v1.1.3.

This behaviour is there to allow for hover information on declarations themselves, which uses the same logic as completions.

There could still be false positives with forward declarations, but that will require a new name-resolution algorithm.