Skip to content

Add deprecated boolean property to CompletionItem and SymbolInformation - #332

Merged
Dirk Bäumer (dbaeumer) merged 1 commit into
microsoft:masterfrom
rcjsuen:deprecated
Apr 26, 2018
Merged

Dirk Bäumer (dbaeumer) merged 1 commit into
microsoft:masterfrom
rcjsuen:deprecated

Conversation

@rcjsuen

Copy link
Copy Markdown
Contributor

I've added a new boolean deprecated property both CompletionItem and SymbolInformation.

See microsoft/language-server-protocol#139.

@dbaeumer

Copy link
Copy Markdown
Member

Remy Suen (@rcjsuen) thanks for the PR. Since the PR adds new properties to items that flow into both directions (form client -> server and server -> client) we need to add a client capability if the client can handle the property correctly. Otherwise a server might be surprised if for example the deprecated property is lost when a completion items flows from the client to a server in a completion item resolve call.

@rcjsuen

Copy link
Copy Markdown
Contributor Author

Dirk Bäumer (@dbaeumer) Thank you for the review, Dirk. I understand what you mean. Does this look okay?

export interface TextDocumentClientCapabilities {
  completion?: {
    completionItem?: {
      /**
       * Client supports the deprecated property on a completion item.
       */
      deprecatedSupport?: boolean
    }
  }
}

@rcjsuen

Copy link
Copy Markdown
Contributor Author

Dirk Bäumer (@dbaeumer) And just to double-check, I don't need to add a new capability for the SymbolInformation case since it's only ever sent one-way from the client to the server, correct?

@rcjsuen

Copy link
Copy Markdown
Contributor Author

I tried adding a capability but the Travis CI build didn't go through. Will investigate some more...

client/src/client.ts(1306,152): error TS2322: Type '{ snippetSupport: true; commitCharactersSupport: true; documentationFormat: MarkupKind[]; depreca...' is not assignable to type '{ snippetSupport?: boolean | undefined; commitCharactersSupport?: boolean | undefined; documentat...'.
  Object literal may only specify known properties, and 'deprecatedSupport' does not exist in type '{ snippetSupport?: boolean | undefined; commitCharactersSupport?: boolean | undefined; documentat...'.

@rcjsuen

Copy link
Copy Markdown
Contributor Author

@rcjsuen

Copy link
Copy Markdown
Contributor Author

As VS Code doesn't read the deprecated value, the deprecatedSupport capability should be set to false, correct?

@dbaeumer

Copy link
Copy Markdown
Member

Remy Suen (@rcjsuen) correct.

Introduce a new boolean property to indicate if a CompletionItem or a
SymbolInformation is depreated.

Signed-off-by: Remy Suen <[email protected]>
@rcjsuen

Copy link
Copy Markdown
Contributor Author

Dirk Bäumer (@dbaeumer) Thanks, Dirk. I have updated this pull request.

Since VS Code doesn't support this feature I didn't bother updating ProtocolCompletionItem based on your earlier comment of letting the property become "lost" between calls. If that was a misinterpretation on my part, I can of course update this pull request and change ProtocolCompletionItem so that it will preserve the property between textDocument/completion and completionItem/resolve requests. Just let me know, thanks!

@dbaeumer

Copy link
Copy Markdown
Member

Remy Suen (@rcjsuen) thanks for the PR. I merged it in. Think about it we should try to preserve the value also VS Code doesn't support deprecation. But you can do this with a separate PR.

@dbaeumer
Dirk Bäumer (dbaeumer) merged commit 498a95c into microsoft:master Apr 26, 2018
@dbaeumer

Copy link
Copy Markdown
Member

Remy Suen (@rcjsuen) can you please update the specification as well. This is necessary so that we can release a new version.

@rcjsuen

Copy link
Copy Markdown
Contributor Author

Hi, Dirk Bäumer (@dbaeumer), thanks for merging this in. I've opened microsoft/language-server-protocol#465 for updating the spec.

Regarding your earlier comment, please confirm the following.

  1. Change VS Code side's deprecatedSupport to return true.
  2. Add a new deprecated property to ProtocolCompletionItem and tweak the code accordingly so that it will be preserved across textDocument/completion and completionItem/resolve requests.

If the above is correct I will open a new PR. If I misunderstood anything, please let me know. Thanks!

@dbaeumer

Dirk Bäumer (dbaeumer) commented May 8, 2018 •

Copy link
Copy Markdown
Member

Remy Suen (@rcjsuen) regarding the questions:

  1. no we should keep false here since VS Code will not do anything with the value
  2. correct.

EDIT: actually we should return true. The fact that it is not rendered is not something the server needs to know. Interesting is that the value is correctly preserved.

@rcjsuen

Copy link
Copy Markdown
Contributor Author

Thank you, Dirk Bäumer (@dbaeumer). I've opened #347 based on your response.

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.

2 participants