LSP icon indicating copy to clipboard operation
LSP copied to clipboard

Unexpected change in autocomplete order

Open willrowe opened this issue 3 years ago • 6 comments

Describe the bug Since Sublime build 4134, I have noticed that the initial autocomplete suggestions have changed and the closest matching suggestion is no longer displayed at the top. I am not sure if it is specific to lsp-intelephense, but it is where I am seeing the issue most obviously. You can see some more details on Discord, but it seems to be that the initial suggestions shown are incorrect and triggering autocomplete again shows as expected.

To Reproduce Steps to reproduce the behavior:

  1. Open Sublime Text in safe mode.
  2. Install Package Control.
  3. Install LSP package.
  4. Install LSP-intelephense package.
  5. Open a new buffer.
  6. Type the following:
    <?php
    
    $variable = 'value';
    
    $another = 
    
  7. When typing $ at the end of the last line the following is displayed, which is expected: Screen Shot 2022-06-02 at 09 11 49
  8. Then when typing a v after that, the following is displayed, which is not expected: Screen Shot 2022-06-02 at 09 12 18
  9. Finally, if autocomplete is triggered manually, the following is displayed, which shows what I expect and what it was doing seemingly before build 4134: Screen Shot 2022-06-02 at 09 12 43

Expected behavior The closest match should be displayed at least towards the top of the suggestions.

Screenshots Included in context above.

Environment (please complete the following information):

  • OS: macOS 11.6.1
  • Sublime Text version: 4134
  • LSP version: 1.16.2
  • Language servers used: intelephense (1.0.25)

willrowe avatar Jun 02 '22 13:06 willrowe

Perhaps this has nothing to do with, but I'm seeing this unit test failing on build 4134

test_var_prefix_using_label (test_completion.QueryCompletionsTests) ... FAIL

rwols avatar Jun 04 '22 17:06 rwols

And the CI doesn't detect this regression because it downloads the stable version: https://github.com/SublimeText/UnitTesting/blob/master/scripts/install_sublime_text.sh#L70

by scraping this URL apparently: curl https://www.sublimetext.com/download_thanks

rwols avatar Jun 04 '22 17:06 rwols

@willrowe I believe that in both steps 7 and 8 the expected completions are all there. They are just not being sorted and matched properly because the $ doesn't seem to be taken into account when matching. You can verify that by scrolling the list and looking for expected completions.

rchl avatar Jun 05 '22 09:06 rchl

Created core issue: https://github.com/sublimehq/sublime_text/issues/5437

rchl avatar Jun 05 '22 12:06 rchl

If $ is not taken into account when matching, then the failing test seems to indeed correctly detect that: https://github.com/sublimelsp/LSP/blob/80d4cbe341a2f7b59601c82ef4bb22f84133aa40/tests/test_completion.py#L130

rwols avatar Jun 05 '22 12:06 rwols

They are just not being sorted and matched properly because the $ doesn't seem to be taken into account when matching.

I believe this may indeed be the issue, I think the $ was being taken into account on previous builds.

willrowe avatar Jun 06 '22 13:06 willrowe

As mentioned in https://github.com/sublimehq/sublime_text/issues/5437, this appears to be fixed in build 4138.

willrowe avatar Oct 21 '22 13:10 willrowe