@@ -39,7 +39,7 @@ let documents: TextDocuments = new TextDocuments();
3939// for open, change and close text document events
4040documents . listen ( connection ) ;
4141
42- let workspacePath : string ;
42+ let workspacePath : string | undefined | null ;
4343var languageModes : LanguageModes ;
4444
4545let clientSnippetSupport = false ;
@@ -53,7 +53,7 @@ documents.onDidClose(e => {
5353 delete documentSettings [ e . document . uri ] ;
5454} ) ;
5555
56- function getDocumentSettings ( textDocument : TextDocument , needsDocumentSettings : ( ) => boolean ) : Thenable < Settings > {
56+ function getDocumentSettings ( textDocument : TextDocument , needsDocumentSettings : ( ) => boolean ) : Thenable < Settings | undefined > {
5757 if ( scopedSettingsSupport && needsDocumentSettings ( ) ) {
5858 let promise = documentSettings [ textDocument . uri ] ;
5959 if ( ! promise ) {
@@ -83,7 +83,7 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
8383 } ) ;
8484
8585 function hasClientCapability ( ...keys : string [ ] ) {
86- let c = params . capabilities ;
86+ let c = < any > params . capabilities ;
8787 for ( let i = 0 ; c && i < keys . length ; i ++ ) {
8888 c = c [ keys [ i ] ] ;
8989 }
@@ -96,7 +96,7 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
9696 let capabilities : ServerCapabilities & CPServerCapabilities = {
9797 // Tell the client that the server works in FULL text document sync mode
9898 textDocumentSync : documents . syncKind ,
99- completionProvider : clientSnippetSupport ? { resolveProvider : true , triggerCharacters : [ '.' , ':' , '<' , '"' , '=' , '/' , '>' ] } : null ,
99+ completionProvider : clientSnippetSupport ? { resolveProvider : true , triggerCharacters : [ '.' , ':' , '<' , '"' , '=' , '/' , '>' ] } : undefined ,
100100 hoverProvider : true ,
101101 documentHighlightProvider : true ,
102102 documentRangeFormattingProvider : false ,
@@ -111,7 +111,7 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
111111 return { capabilities } ;
112112} ) ;
113113
114- let formatterRegistration : Thenable < Disposable > = null ;
114+ let formatterRegistration : Thenable < Disposable > | null = null ;
115115
116116// The settings have changed. Is send on server activation as well.
117117connection . onDidChangeConfiguration ( ( change ) => {
@@ -198,11 +198,12 @@ connection.onCompletion(async textDocumentPosition => {
198198 let document = documents . get ( textDocumentPosition . textDocument . uri ) ;
199199 let mode = languageModes . getModeAtPosition ( document , textDocumentPosition . position ) ;
200200 if ( mode && mode . doComplete ) {
201+ let doComplete = mode . doComplete ;
201202 if ( mode . getId ( ) !== 'html' ) {
202203 connection . telemetry . logEvent ( { key : 'html.embbedded.complete' , value : { languageId : mode . getId ( ) } } ) ;
203204 }
204- let settings = await getDocumentSettings ( document , ( ) => mode . doComplete . length > 2 ) ;
205- return mode . doComplete ( document , textDocumentPosition . position , settings ) ;
205+ let settings = await getDocumentSettings ( document , ( ) => doComplete . length > 2 ) ;
206+ return doComplete ( document , textDocumentPosition . position , settings ) ;
206207 }
207208 return { isIncomplete : true , items : [ ] } ;
208209} ) ;
0 commit comments