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

Class names showing after non-existent properties (named suggestions). #68

Open
ghost opened this issue Apr 10, 2022 · 3 comments
Open

Comments

@ghost
Copy link

ghost commented Apr 10, 2022

Hello and thanks for making this extension, it's very helpful. There is one small bug that I can see.

When initiating autocomplete, the class names are showing after non-existent property names. You can see in this screenshot:

image

On a plain object in the same file, you can see that the properties are listed in the correct order:

image

Is there anything that I can do to fix this?

My VS Code info:

Version: 1.66.1
Commit: 8dfae7a5cd50421d10cd99cb873990460525a898
Date: 2022-04-06T14:51:26.173Z
Electron: 17.2.0
Chromium: 98.0.4758.109
Node.js: 16.13.0
V8: 9.8.177.11-electron.0
OS: Linux x64 5.4.184-1-MANJARO
@ghost
Copy link
Author

ghost commented Apr 10, 2022

The one thing that worked for me was to disable named suggestions entirely, in VS Code settings:

"javascript.suggest.names": false,

Unfortunately, I would prefer to keep that setting enabled.

@ghost ghost changed the title Class names showing after non-existent properties. Class names showing after non-existent properties (named suggestions). Apr 10, 2022
@ghost
Copy link
Author

ghost commented Apr 10, 2022

Trying to solve this problem myself, I was lead to VS Code microsoft/vscode#21611

via the following StackOverflow answer:

See this comment of an open VS Code issue.

When your CompletionProvider was registered using a DocumentSelector that is more significant than that of other providers and returns at least one completion item, the other providers are skipped.
The word-based suggestions provider is less significant and so it does not contribute any suggestions.

Depending on the nature of your extension you could try to define a less specific DocumentSelector when registering your CompletionProvider.
If this is not possible I think there is no other option than to providing all completion items yourself (including word-based suggestions).

But I'm a little out of my depth as I don't have much experience using the VS Code API, so I'm just leaving my notes here.

@iChenLei
Copy link
Collaborator

@waynebloss Thanks for your sharing, it's useful for us to improve extension's ux

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

No branches or pull requests

1 participant