@volar/language-server
Advanced tools
Comparing version 2.3.0-alpha.7 to 2.3.0-alpha.8
@@ -187,10 +187,11 @@ "use strict"; | ||
if (capabilitiesArr.some(data => data.autoInsertionProvider)) { | ||
const allTriggerCharacters = []; | ||
const allConfigurationSections = []; | ||
const triggerCharacterToConfigurationSections = new Map(); | ||
const tryAdd = (char, section) => { | ||
const index = allTriggerCharacters.indexOf(char); | ||
if (index === -1 || allConfigurationSections[index] !== section) { | ||
allTriggerCharacters.push(char); | ||
allConfigurationSections.push(section); | ||
let sectionSet = triggerCharacterToConfigurationSections.get(char); | ||
if (!sectionSet) { | ||
triggerCharacterToConfigurationSections.set(char, sectionSet = new Set()); | ||
} | ||
if (section) { | ||
sectionSet.add(section); | ||
} | ||
}; | ||
@@ -200,3 +201,2 @@ for (const data of capabilitiesArr) { | ||
const { triggerCharacters, configurationSections } = data.autoInsertionProvider; | ||
allTriggerCharacters.push(...triggerCharacters); | ||
if (configurationSections) { | ||
@@ -212,3 +212,3 @@ if (configurationSections.length !== triggerCharacters.length) { | ||
for (const char of triggerCharacters) { | ||
tryAdd(char, null); | ||
tryAdd(char); | ||
} | ||
@@ -219,5 +219,17 @@ } | ||
status.initializeResult.autoInsertion = { | ||
triggerCharacters: allTriggerCharacters, | ||
configurationSections: allConfigurationSections, | ||
triggerCharacters: [], | ||
configurationSections: [], | ||
}; | ||
for (const [char, sections] of triggerCharacterToConfigurationSections) { | ||
if (sections.size) { | ||
for (const section of sections) { | ||
status.initializeResult.autoInsertion.triggerCharacters.push(char); | ||
status.initializeResult.autoInsertion.configurationSections.push(section); | ||
} | ||
} | ||
else { | ||
status.initializeResult.autoInsertion.triggerCharacters.push(char); | ||
status.initializeResult.autoInsertion.configurationSections.push(null); | ||
} | ||
} | ||
} | ||
@@ -224,0 +236,0 @@ return status.initializeResult; |
{ | ||
"name": "@volar/language-server", | ||
"version": "2.3.0-alpha.7", | ||
"version": "2.3.0-alpha.8", | ||
"license": "MIT", | ||
@@ -15,6 +15,6 @@ "files": [ | ||
"dependencies": { | ||
"@volar/language-core": "2.3.0-alpha.7", | ||
"@volar/language-service": "2.3.0-alpha.7", | ||
"@volar/snapshot-document": "2.3.0-alpha.7", | ||
"@volar/typescript": "2.3.0-alpha.7", | ||
"@volar/language-core": "2.3.0-alpha.8", | ||
"@volar/language-service": "2.3.0-alpha.8", | ||
"@volar/snapshot-document": "2.3.0-alpha.8", | ||
"@volar/typescript": "2.3.0-alpha.8", | ||
"path-browserify": "^1.0.1", | ||
@@ -30,3 +30,3 @@ "request-light": "^0.7.0", | ||
}, | ||
"gitHead": "3cc2a62516113c5789e4f54766e25063099a13a5" | ||
"gitHead": "377a0083ac697a476509805a6777a2339391dcaf" | ||
} |
105898
2209
+ Added@volar/language-core@2.3.0-alpha.8(transitive)
+ Added@volar/language-service@2.3.0-alpha.8(transitive)
+ Added@volar/snapshot-document@2.3.0-alpha.8(transitive)
+ Added@volar/source-map@2.3.0-alpha.8(transitive)
+ Added@volar/typescript@2.3.0-alpha.8(transitive)
- Removed@volar/language-core@2.3.0-alpha.7(transitive)
- Removed@volar/language-service@2.3.0-alpha.7(transitive)
- Removed@volar/snapshot-document@2.3.0-alpha.7(transitive)
- Removed@volar/source-map@2.3.0-alpha.7(transitive)
- Removed@volar/typescript@2.3.0-alpha.7(transitive)