@@ -19,11 +19,12 @@ import type * as rpc from 'vscode-jsonrpc';
1919import type * as lsp from 'vscode-languageserver-protocol' ;
2020import type { MessageConnection } from 'vscode-ws-jsonrpc' ;
2121
22- import { CompletionItemTag , DiagnosticTag } from './lsp' ;
22+ import { ClientCapabilities } from './lsp' ;
2323import { ILSPLogConsole } from './tokens' ;
2424import { until_ready } from './utils' ;
2525
2626interface ILSPOptions extends ILspOptions {
27+ capabilities : ClientCapabilities ;
2728 serverIdentifier ?: string ;
2829 console : ILSPLogConsole ;
2930}
@@ -336,6 +337,7 @@ export class LSPConnection extends LspWsConnection {
336337 public clientRequests : ClientRequests ;
337338 public serverRequests : ServerRequests ;
338339 protected console : ILSPLogConsole ;
340+ private _options : ILSPOptions ;
339341 public logAllCommunication : boolean ;
340342
341343 public log ( kind : MessageKind , message : IMessageLog ) {
@@ -379,6 +381,7 @@ export class LSPConnection extends LspWsConnection {
379381
380382 constructor ( options : ILSPOptions ) {
381383 super ( options ) ;
384+ this . _options = options ;
382385 this . logAllCommunication = false ;
383386 this . serverIdentifier = options . serverIdentifier ;
384387 this . console = options . console . scope ( this . serverIdentifier + ' connection' ) ;
@@ -400,66 +403,10 @@ export class LSPConnection extends LspWsConnection {
400403 protected initializeParams ( ) : lsp . InitializeParams {
401404 return {
402405 ...super . initializeParams ( ) ,
403- capabilities : {
404- textDocument : {
405- hover : {
406- dynamicRegistration : true ,
407- contentFormat : [ 'markdown' , 'plaintext' ]
408- } ,
409- synchronization : {
410- dynamicRegistration : true ,
411- willSave : false ,
412- didSave : true ,
413- willSaveWaitUntil : false
414- } ,
415- completion : {
416- dynamicRegistration : true ,
417- completionItem : {
418- snippetSupport : false ,
419- commitCharactersSupport : true ,
420- documentationFormat : [ 'markdown' , 'plaintext' ] ,
421- deprecatedSupport : true ,
422- preselectSupport : false ,
423- tagSupport : {
424- valueSet : [ CompletionItemTag . Deprecated ]
425- }
426- } ,
427- contextSupport : false
428- } ,
429- publishDiagnostics : {
430- tagSupport : {
431- valueSet : [ DiagnosticTag . Deprecated , DiagnosticTag . Unnecessary ]
432- }
433- } ,
434- signatureHelp : {
435- dynamicRegistration : true ,
436- signatureInformation : {
437- documentationFormat : [ 'markdown' , 'plaintext' ]
438- }
439- } ,
440- declaration : {
441- dynamicRegistration : true ,
442- linkSupport : true
443- } ,
444- definition : {
445- dynamicRegistration : true ,
446- linkSupport : true
447- } ,
448- typeDefinition : {
449- dynamicRegistration : true ,
450- linkSupport : true
451- } ,
452- implementation : {
453- dynamicRegistration : true ,
454- linkSupport : true
455- }
456- } as lsp . TextDocumentClientCapabilities ,
457- workspace : {
458- didChangeConfiguration : {
459- dynamicRegistration : true
460- }
461- } as lsp . WorkspaceClientCapabilities
462- } as lsp . ClientCapabilities ,
406+ // TODO: remove as `lsp.ClientCapabilities` after upgrading to 3.17
407+ // which should finally include a fix for moniker issue:
408+ // https://github.com/microsoft/vscode-languageserver-node/pull/720
409+ capabilities : this . _options . capabilities as lsp . ClientCapabilities ,
463410 initializationOptions : null ,
464411 processId : null ,
465412 workspaceFolders : null
0 commit comments