@@ -74,11 +74,13 @@ connection.onShutdown(() => {
7474} ) ;
7575
7676let workspacePath : string ;
77+ let embeddedLanguages : { [ languageId : string ] : boolean } ;
7778
7879// After the server has started the client sends an initilize request. The server receives
7980// in the passed params the rootPath of the workspace plus the client capabilites
8081connection . onInitialize ( ( params : InitializeParams ) : InitializeResult => {
8182 workspacePath = params . rootPath ;
83+ embeddedLanguages = params . initializationOptions . embeddedLanguages ;
8284 return {
8385 capabilities : {
8486 // Tell the client that the server works in FULL text document sync mode
@@ -118,9 +120,9 @@ connection.onCompletion(textDocumentPosition => {
118120 let htmlDocument = htmlDocuments . get ( document ) ;
119121 let options = languageSettings && languageSettings . suggest ;
120122 let list = languageService . doComplete ( document , textDocumentPosition . position , htmlDocument , options ) ;
121- if ( list . items . length === 0 ) {
123+ if ( list . items . length === 0 && embeddedLanguages ) {
122124 let embeddedLanguageId = getEmbeddedLanguageAtPosition ( languageService , document , htmlDocument , textDocumentPosition . position ) ;
123- if ( embeddedLanguageId ) {
125+ if ( embeddedLanguageId && embeddedLanguages [ embeddedLanguageId ] ) {
124126 return connection . sendRequest ( EmbeddedCompletionRequest . type , { uri : document . uri , version : document . version , embeddedLanguageId, position : textDocumentPosition . position } ) ;
125127 }
126128 }
@@ -131,9 +133,9 @@ connection.onHover(textDocumentPosition => {
131133 let document = documents . get ( textDocumentPosition . textDocument . uri ) ;
132134 let htmlDocument = htmlDocuments . get ( document ) ;
133135 let hover = languageService . doHover ( document , textDocumentPosition . position , htmlDocument ) ;
134- if ( ! hover ) {
136+ if ( ! hover && embeddedLanguages ) {
135137 let embeddedLanguageId = getEmbeddedLanguageAtPosition ( languageService , document , htmlDocument , textDocumentPosition . position ) ;
136- if ( embeddedLanguageId ) {
138+ if ( embeddedLanguageId && embeddedLanguages [ embeddedLanguageId ] ) {
137139 return connection . sendRequest ( EmbeddedHoverRequest . type , { uri : document . uri , version : document . version , embeddedLanguageId, position : textDocumentPosition . position } ) ;
138140 }
139141 }
0 commit comments