Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocomplete suggestions not matched correctly in 4134 #5437

Closed
rchl opened this issue Jun 5, 2022 · 8 comments
Closed

Autocomplete suggestions not matched correctly in 4134 #5437

rchl opened this issue Jun 5, 2022 · 8 comments

Comments

@rchl
Copy link

rchl commented Jun 5, 2022

Description of the bug

For example, typing "$v" doesn't automatically select the "$var" completion but prefers "var_dump".

Steps to reproduce

  1. Add a plugin:
    import sublime
    import sublime_plugin
    from sublime import INHIBIT_WORD_COMPLETIONS, INHIBIT_EXPLICIT_COMPLETIONS
    
    class DollarCompletionListener(sublime_plugin.ViewEventListener):
        def on_query_completions(self, prefix, locations):
            print('on_query_completions, prefix: ', prefix)
            completions = [
                CompletionItem(kind=(3, 'm', 'Method'), trigger='var_dump'),
                CompletionItem(kind=(3, 'm', 'Method'), trigger='$var'),
            ]
            completion_list = CompletionList()
            flags = INHIBIT_EXPLICIT_COMPLETIONS | INHIBIT_WORD_COMPLETIONS
            completion_list.set_completions(completions, flags)
            return completion_list
  2. Open new view and set syntax to Javascript (for example)
  3. Type "$v"

Expected behavior

The "$var" completion is selected like in the build 4131:

Screenshot 2022-06-05 at 13 55 16

Actual behavior

The "var_dump" completion is selected. Seems like "$" is not considered when matching completions (it's also not highlighted):

Screenshot 2022-06-05 at 14 04 11

Sublime Text build number

4134

Operating system & version

macOS 12.4

(Linux) Desktop environment and/or window manager

No response

Additional information

Might be related to the fix made for #4855.

Note that in both 4131 and 4134 builds the prefix argument to on_query_completions is an empty string when typing the initial $. Feels a bit weird but regardless of that, it has worked before.

Also note that (even if it didn't happen before either) filtering out the var_dump completely would probably make more sense if $ is used for matching as "var_dump" doesn't contain the $ character.

OpenGL context information

No response

@willrowe
Copy link

willrowe commented Jun 6, 2022

I can confirm this is happening for PHP as well.

@jfcherng
Copy link

jfcherng commented Jun 7, 2022

Caused by #5444 ?

@deathaxe
Copy link
Collaborator

deathaxe commented Jun 7, 2022

Shouln't have any impact on static completions from *.sublime-completions file.

Note: I was able to reproduce this behavior in SAFE MODE with plain PHP completions.

Typing $ followed by v already triggers var_dump, while hitting ctrl+space suggestions.

@willrowe
Copy link

This is also happening with HTML class expansion.
Screen Shot 2022-06-20 at 13 50 47
Screen Shot 2022-06-20 at 13 50 54

@rchl
Copy link
Author

rchl commented Oct 9, 2022

Will the next stable build be released with this regression?

@rchl
Copy link
Author

rchl commented Oct 21, 2022

As mentioned in #5431, this appears to be fixed in 4138.

(have also verified that with my test code)

@willrowe
Copy link

I can confirm that this has been fixed for HTML and seems to be working correctly for PHP too.

@deathaxe deathaxe added this to the Build 4138 milestone Oct 21, 2022
@hartsublime
Copy link

Fixed in Build 4138

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants