@volar/vscode 2.3.3 → 2.3.5-alpha.1

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.
@@ -37,9 +37,23 @@ function activate(selector, client) {
37
37
  // https://github.com/vuejs/language-tools/issues/4457
38
38
  return;
39
39
  }
40
- doAutoInsert(document, lastChange, lastChange.text[lastChange.text.length - 1]);
40
+ const lastCharacter = lastChange.text[lastChange.text.length - 1];
41
+ const initializeResult = client.initializeResult;
42
+ if (initializeResult?.capabilities.experimental?.autoInsertionProvider) {
43
+ const { triggerCharacters, configurationSections } = initializeResult.capabilities.experimental.autoInsertionProvider;
44
+ for (let i = 0; i < triggerCharacters.length; i++) {
45
+ const char = triggerCharacters[i];
46
+ const sections = configurationSections?.[i];
47
+ if (lastCharacter.match(new RegExp(char))
48
+ && (!sections
49
+ || sections.some(section => vscode.workspace.getConfiguration().get(section)))) {
50
+ doAutoInsert(document, lastChange);
51
+ return;
52
+ }
53
+ }
54
+ }
41
55
  }
42
- function doAutoInsert(document, lastChange, lastCharacter) {
56
+ function doAutoInsert(document, lastChange) {
43
57
  if (timeout) {
44
58
  clearTimeout(timeout);
45
59
  timeout = undefined;
@@ -52,21 +66,7 @@ function activate(selector, client) {
52
66
  if (vscode.window.activeTextEditor?.document.version !== version) {
53
67
  return true;
54
68
  }
55
- const initializeResult = client.initializeResult;
56
- if (initializeResult?.autoInsertion) {
57
- for (let i = 0; i < initializeResult.autoInsertion.triggerCharacters.length; i++) {
58
- const char = initializeResult.autoInsertion.triggerCharacters[i];
59
- if (!lastCharacter.match(new RegExp(char))) {
60
- continue;
61
- }
62
- const configurationSection = initializeResult.autoInsertion.configurationSections[i];
63
- if (configurationSection && !vscode.workspace.getConfiguration().get(configurationSection)) {
64
- continue;
65
- }
66
- return false;
67
- }
68
- }
69
- return true;
69
+ return false;
70
70
  };
71
71
  timeout = setTimeout(async () => {
72
72
  timeout = undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volar/vscode",
3
- "version": "2.3.3",
3
+ "version": "2.3.5-alpha.1",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -12,7 +12,7 @@
12
12
  "directory": "packages/vscode"
13
13
  },
14
14
  "dependencies": {
15
- "@volar/language-server": "2.3.3",
15
+ "@volar/language-server": "2.3.5-alpha.1",
16
16
  "path-browserify": "^1.0.1",
17
17
  "vscode-languageclient": "^9.0.1",
18
18
  "vscode-nls": "^5.2.0"
@@ -22,5 +22,5 @@
22
22
  "@types/path-browserify": "latest",
23
23
  "@types/vscode": "^1.82.0"
24
24
  },
25
- "gitHead": "08802f144de6ff05a86b99df1f55a5ba243cc926"
25
+ "gitHead": "111bfae316c66a087a497e12740d46fc2c74cab0"
26
26
  }