Skip to content
This repository was archived by the owner on Jan 11, 2026. It is now read-only.

Conversation

@acran
Copy link

@acran acran commented Feb 24, 2021

This PR adds some improvements/fixes:

  • correctly allow "go to declaration" when clicking on expressions with scope resolution operator ::, e.g. MyClass::class to go to MyClass
  • sort exact matches of search string first in autocomplete suggestions
  • remove duplicate suggestions for variable names
  • correctly scope variable name suggestions to current function

fixes #368
fixes #366

With the buffer position on the class name followed by a scope
resolution operator "::" getFullWordFromBufferPosition would select the
whole expression; but a later goto would then only look at the member
part and wrongfully try andgo to that member instead of the class
definition:

    MyClass::class
      ^-- Buffer position here

* getFullWordFromBufferPosition returns "MyClass::class"
* goto tries to go to member "class" of class MyClass and fails

Adding the colon to forwardRegex will return only the class name instead
if buffer position is before the scope resolution operator but not if
after:

    MyClass::class
      ^-- getFullWordFromBufferPosition now returns "MyClass"
    MyClass::class
               ^-- but here still returns "MyClass::class"
This will sort suggestions containing exact matches of the search prefix
first providing a better quality of suggestions
getAllVariablesInFunction returns every variable used in a function so
far which willl then be used for autocompletion suggestions. But with
variables used mulitple times in the function they will appear as
duplicates in the suggestions.
To fix this this now returns a list of unique variable names.
Changes made to the language-php syntax package broke the detection of
opening and closing code blocks resulting in isInFunction always
returning false
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

variable duplications self and this not completing

1 participant