nolanderc / glsl_analyzer

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

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

Closed automaticp closed 9 months ago

automaticp commented 9 months 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 9 months 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.