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

Change Sequence[CompletionItemKind] to Sequence[CompletionItemKind | int]? #344

Closed
alcarney opened this issue Mar 14, 2024 · 5 comments · Fixed by #359
Closed

Change Sequence[CompletionItemKind] to Sequence[CompletionItemKind | int]? #344

alcarney opened this issue Mar 14, 2024 · 5 comments · Fixed by #359
Assignees

Comments

@alcarney
Copy link
Contributor

In situations where an enum is "open" (such as here), would it be possible to update the generator to output the union of the enum and the value type it is based on?

I'm assuming (but have not checked! 😅) that this will prevent the converter we get from lsprotocol from rejecting values it does not recognise, but are permitted by the spec.

Additional context: openlawlibrary/pygls#438

@karthiknadig
Copy link
Member

This is actually a spec bug. In the model it is marked as optional but not as supporting custom values:
This is the definition for CompletionItemKind: https://github.com/microsoft/vscode-languageserver-node/blob/691fd5d3fabeed5ed8ff9c3608f2d306cb07717e/protocol/metaModel.json#L14201-L14310

https://github.com/microsoft/vscode-languageserver-node/blob/691fd5d3fabeed5ed8ff9c3608f2d306cb07717e/protocol/metaModel.json#L13218-L13236

This is CodeActionKind for example with the field supportsCustomValues : https://github.com/microsoft/vscode-languageserver-node/blob/691fd5d3fabeed5ed8ff9c3608f2d306cb07717e/protocol/metaModel.json#L14460

This should be fixed upstream first.

@karthiknadig
Copy link
Member

I can add a custom exception for this to be explicitly treated as supports custom values.

@alcarney
Copy link
Contributor Author

Since we can work around it I don't think there's a big rush to fix this - especially since I assume any fix would go into 2024.x anyway? If it's better to fix it in the spec first then I'm happy to go with that.

Is it enough to open a PR against the meta model and set supportsCustomValues to true, or are there more steps involved?

@karthiknadig
Copy link
Member

The meta-model is built from TS object definitions. The change would have to be reflected where the TS object for CompletionItemKind is done. You might want to follow how this is done for ErrorCodes.

@karthiknadig
Copy link
Member

I assume any fix would go into 2024.x anyway?

We could backport the fix if it has high impact on older versions. But this seems like one of those cases that can go into 2024.x.

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

Successfully merging a pull request may close this issue.

2 participants