@volar/language-server 2.3.0-alpha.6 → 2.3.0-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/server.js +22 -10
  2. package/package.json +6 -6
package/lib/server.js CHANGED
@@ -184,19 +184,19 @@ function createServerBase(connection, fs) {
184
184
  activateServerPushDiagnostics(project);
185
185
  }
186
186
  if (capabilitiesArr.some(data => data.autoInsertionProvider)) {
187
- const allTriggerCharacters = [];
188
- const allConfigurationSections = [];
187
+ const triggerCharacterToConfigurationSections = new Map();
189
188
  const tryAdd = (char, section) => {
190
- const index = allTriggerCharacters.indexOf(char);
191
- if (index === -1 || allConfigurationSections[index] !== section) {
192
- allTriggerCharacters.push(char);
193
- allConfigurationSections.push(section);
189
+ let sectionSet = triggerCharacterToConfigurationSections.get(char);
190
+ if (!sectionSet) {
191
+ triggerCharacterToConfigurationSections.set(char, sectionSet = new Set());
192
+ }
193
+ if (section) {
194
+ sectionSet.add(section);
194
195
  }
195
196
  };
196
197
  for (const data of capabilitiesArr) {
197
198
  if (data.autoInsertionProvider) {
198
199
  const { triggerCharacters, configurationSections } = data.autoInsertionProvider;
199
- allTriggerCharacters.push(...triggerCharacters);
200
200
  if (configurationSections) {
201
201
  if (configurationSections.length !== triggerCharacters.length) {
202
202
  throw new Error('configurationSections.length !== triggerCharacters.length');
@@ -207,15 +207,27 @@ function createServerBase(connection, fs) {
207
207
  }
208
208
  else {
209
209
  for (const char of triggerCharacters) {
210
- tryAdd(char, null);
210
+ tryAdd(char);
211
211
  }
212
212
  }
213
213
  }
214
214
  }
215
215
  status.initializeResult.autoInsertion = {
216
- triggerCharacters: allTriggerCharacters,
217
- configurationSections: allConfigurationSections,
216
+ triggerCharacters: [],
217
+ configurationSections: [],
218
218
  };
219
+ for (const [char, sections] of triggerCharacterToConfigurationSections) {
220
+ if (sections.size) {
221
+ for (const section of sections) {
222
+ status.initializeResult.autoInsertion.triggerCharacters.push(char);
223
+ status.initializeResult.autoInsertion.configurationSections.push(section);
224
+ }
225
+ }
226
+ else {
227
+ status.initializeResult.autoInsertion.triggerCharacters.push(char);
228
+ status.initializeResult.autoInsertion.configurationSections.push(null);
229
+ }
230
+ }
219
231
  }
220
232
  return status.initializeResult;
221
233
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volar/language-server",
3
- "version": "2.3.0-alpha.6",
3
+ "version": "2.3.0-alpha.8",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -12,10 +12,10 @@
12
12
  "directory": "packages/language-server"
13
13
  },
14
14
  "dependencies": {
15
- "@volar/language-core": "2.3.0-alpha.6",
16
- "@volar/language-service": "2.3.0-alpha.6",
17
- "@volar/snapshot-document": "2.3.0-alpha.6",
18
- "@volar/typescript": "2.3.0-alpha.6",
15
+ "@volar/language-core": "2.3.0-alpha.8",
16
+ "@volar/language-service": "2.3.0-alpha.8",
17
+ "@volar/snapshot-document": "2.3.0-alpha.8",
18
+ "@volar/typescript": "2.3.0-alpha.8",
19
19
  "path-browserify": "^1.0.1",
20
20
  "request-light": "^0.7.0",
21
21
  "vscode-languageserver": "^9.0.1",
@@ -26,5 +26,5 @@
26
26
  "devDependencies": {
27
27
  "@types/path-browserify": "latest"
28
28
  },
29
- "gitHead": "f3103e86be8d80cb36f66be4c054ef9a255c29b1"
29
+ "gitHead": "377a0083ac697a476509805a6777a2339391dcaf"
30
30
  }