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

Respect client capabilities when choosing codeActionProvider return type #139

Closed
wants to merge 1 commit into from

Conversation

tgjones
Copy link

@tgjones tgjones commented May 21, 2019

Possible fix for #136, but I'm new to this project so I've quite possibly misunderstood what needs to be done.

The spec states:

The server provides code actions. The CodeActionOptions return type is only valid if the client signals code action literal support via the property textDocument.codeAction.codeActionLiteralSupport.
@bjorkstromm
Copy link
Member

@tgjones thanks for your PR... Some time ago, I went trying to fix this issue in another way (the null serialization), see #140.

However, this includes checks for respecting client request, which is a good thing. I "think" we should create a factory method in ServerCapabilities for constructing it, as mentioned in comments:

// TODO NEXT:
// Create ability for server capabilties to be pulled from registered handlers
// Create the ability to look at the client capabilities to determine what parts we need to answer now (completion for example)

@david-driscoll
Copy link
Member

Going to close this for the moment, as the fix doesn't seem appropriate, but I'll give some context (because the code isn't well documented on this!)

GetStaticOptions does a check for IsSupported. It also does a check to make sure that there is an object value that came from the client (the editor). And it checks for DynamicRegistration . VsCode does something really interesting here when you deal with Dynamic Registration.

If we report that we support code lens at this point, vscode will statically bind code lens to whatever selectors were provided with the extension. We then process any handlers that support dynamic registration and after initialization we issue all the registration requests. This then causes a double registration to happen. So we actually get bound to code lens once for the provided selectors (with the extension) as well as any extensions that we provided through dynamic registration. This is why the server will in some cases report that it doesn't support something, because we will after the fact bind dynamically to the client.

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

Successfully merging this pull request may close these issues.

3 participants