@vue/language-service 2.0.26-alpha.2 → 2.0.28

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.
package/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ /// <reference types="@volar/typescript" />
2
3
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
4
  if (k2 === undefined) k2 = k;
4
5
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -37,7 +38,6 @@ const vue_document_links_1 = require("./lib/plugins/vue-document-links");
37
38
  const vue_extract_file_1 = require("./lib/plugins/vue-extract-file");
38
39
  const vue_sfc_1 = require("./lib/plugins/vue-sfc");
39
40
  const vue_template_1 = require("./lib/plugins/vue-template");
40
- const vue_toggle_v_bind_codeaction_1 = require("./lib/plugins/vue-toggle-v-bind-codeaction");
41
41
  const vue_twoslash_queries_1 = require("./lib/plugins/vue-twoslash-queries");
42
42
  const vue_visualize_hidden_callback_param_1 = require("./lib/plugins/vue-visualize-hidden-callback-param");
43
43
  const language_core_1 = require("@vue/language-core");
@@ -184,7 +184,6 @@ function getCommonLanguageServicePlugins(ts, getTsPluginClient) {
184
184
  (0, vue_visualize_hidden_callback_param_1.create)(),
185
185
  (0, vue_directive_comments_1.create)(),
186
186
  (0, vue_extract_file_1.create)(ts, getTsPluginClient),
187
- (0, vue_toggle_v_bind_codeaction_1.create)(ts),
188
187
  (0, volar_service_emmet_1.create)({
189
188
  mappedLanguages: {
190
189
  'vue': 'html',
@@ -159,11 +159,55 @@ function create() {
159
159
  if (!result) {
160
160
  return;
161
161
  }
162
- result.items = [
163
- ...result.items.filter(item => item.label !== '!DOCTYPE' && item.label !== 'Custom Blocks'),
164
- createCompletionItemWithTs(result.items.find(item => item.label === 'script')),
165
- createCompletionItemWithTs(result.items.find(item => item.label === 'script setup')),
166
- ];
162
+ result.items = result.items.filter(item => item.label !== '!DOCTYPE' && item.label !== 'Custom Blocks');
163
+ for (const scriptItem of result.items.filter(item => item.label === 'script' || item.label === 'script setup')) {
164
+ scriptItem.kind = 17;
165
+ scriptItem.detail = '.js';
166
+ for (const lang of ['ts', 'tsx', 'jsx']) {
167
+ result.items.push({
168
+ ...scriptItem,
169
+ detail: `.${lang}`,
170
+ kind: 17,
171
+ label: scriptItem.label + ' lang="' + lang + '"',
172
+ textEdit: scriptItem.textEdit ? {
173
+ ...scriptItem.textEdit,
174
+ newText: scriptItem.textEdit.newText + ' lang="' + lang + '"',
175
+ } : undefined,
176
+ });
177
+ }
178
+ }
179
+ const styleItem = result.items.find(item => item.label === 'style');
180
+ if (styleItem) {
181
+ styleItem.kind = 17;
182
+ styleItem.detail = '.css';
183
+ for (const lang of ['css', 'scss', 'less', 'postcss']) {
184
+ result.items.push({
185
+ ...styleItem,
186
+ kind: 17,
187
+ detail: lang === 'postcss' ? '.css' : `.${lang}`,
188
+ label: styleItem.label + ' lang="' + lang + '"',
189
+ textEdit: styleItem.textEdit ? {
190
+ ...styleItem.textEdit,
191
+ newText: styleItem.textEdit.newText + ' lang="' + lang + '"',
192
+ } : undefined,
193
+ });
194
+ }
195
+ }
196
+ const templateItem = result.items.find(item => item.label === 'template');
197
+ if (templateItem) {
198
+ templateItem.kind = 17;
199
+ templateItem.detail = '.html';
200
+ result.items.push({
201
+ ...templateItem,
202
+ kind: 17,
203
+ detail: '.pug',
204
+ label: templateItem.label + ' lang="pug"',
205
+ textEdit: templateItem.textEdit ? {
206
+ ...templateItem.textEdit,
207
+ newText: templateItem.textEdit.newText + ' lang="pug"',
208
+ } : undefined,
209
+ });
210
+ }
167
211
  return result;
168
212
  },
169
213
  };
@@ -178,14 +222,4 @@ function create() {
178
222
  }
179
223
  }
180
224
  }
181
- function createCompletionItemWithTs(base) {
182
- return {
183
- ...base,
184
- label: base.label + ' lang="ts"',
185
- textEdit: {
186
- ...base.textEdit,
187
- newText: base.textEdit.newText + ' lang="ts"',
188
- }
189
- };
190
- }
191
225
  //# sourceMappingURL=vue-sfc.js.map
@@ -13,6 +13,7 @@ const types_1 = require("../types");
13
13
  const data_1 = require("./data");
14
14
  let builtInData;
15
15
  let modelData;
16
+ const specialTags = new Set(['slot', 'component', 'template']);
16
17
  function create(mode, ts, getTsPluginClient) {
17
18
  let customData = [];
18
19
  let extraCustomData = [];
@@ -348,14 +349,8 @@ function create(mode, ts, getTsPluginClient) {
348
349
  const casing = await (0, nameCasing_1.getNameCasing)(context, sourceDocumentUri);
349
350
  if (builtInData.tags) {
350
351
  for (const tag of builtInData.tags) {
351
- if (tag.name === 'slot') {
352
- continue;
353
- }
354
- if (tag.name === 'component') {
355
- continue;
356
- }
357
- if (tag.name === 'template') {
358
- continue;
352
+ if (specialTags.has(tag.name)) {
353
+ tag.name = createInternalItemId('specialTag', [tag.name]);
359
354
  }
360
355
  if (casing.tag === types_1.TagNameCasing.Kebab) {
361
356
  tag.name = (0, language_core_1.hyphenateTag)(tag.name);
@@ -602,6 +597,24 @@ function create(mode, ts, getTsPluginClient) {
602
597
  }
603
598
  }
604
599
  for (const item of completionList.items) {
600
+ if (specialTags.has(item.label)) {
601
+ completionList.items = completionList.items.filter(i => i !== item);
602
+ }
603
+ const nameId = readInternalItemId(item.label);
604
+ if (nameId) {
605
+ const name = nameId.args[0];
606
+ item.label = name;
607
+ if (item.textEdit) {
608
+ item.textEdit.newText = name;
609
+ }
610
+ ;
611
+ if (item.insertText) {
612
+ item.insertText = name;
613
+ }
614
+ if (item.sortText) {
615
+ item.sortText = name;
616
+ }
617
+ }
605
618
  const itemIdKey = typeof item.documentation === 'string' ? item.documentation : item.documentation?.value;
606
619
  const itemId = itemIdKey ? readInternalItemId(itemIdKey) : undefined;
607
620
  if (itemId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/language-service",
3
- "version": "2.0.26-alpha.2",
3
+ "version": "2.0.28",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "data",
@@ -16,23 +16,23 @@
16
16
  "update-html-data": "node ./scripts/update-html-data.js"
17
17
  },
18
18
  "dependencies": {
19
- "@volar/language-core": "~2.4.0-alpha.12",
20
- "@volar/language-service": "~2.4.0-alpha.12",
21
- "@volar/typescript": "~2.4.0-alpha.12",
19
+ "@volar/language-core": "~2.4.0-alpha.18",
20
+ "@volar/language-service": "~2.4.0-alpha.18",
21
+ "@volar/typescript": "~2.4.0-alpha.18",
22
22
  "@vue/compiler-dom": "^3.4.0",
23
- "@vue/language-core": "2.0.26-alpha.2",
23
+ "@vue/language-core": "2.0.28",
24
24
  "@vue/shared": "^3.4.0",
25
- "@vue/typescript-plugin": "2.0.26-alpha.2",
25
+ "@vue/typescript-plugin": "2.0.28",
26
26
  "computeds": "^0.0.1",
27
27
  "path-browserify": "^1.0.1",
28
- "volar-service-css": "volar-2.4",
29
- "volar-service-emmet": "volar-2.4",
30
- "volar-service-html": "volar-2.4",
31
- "volar-service-json": "volar-2.4",
32
- "volar-service-pug": "volar-2.4",
33
- "volar-service-pug-beautify": "volar-2.4",
34
- "volar-service-typescript": "volar-2.4",
35
- "volar-service-typescript-twoslash-queries": "volar-2.4",
28
+ "volar-service-css": "0.0.59",
29
+ "volar-service-emmet": "0.0.59",
30
+ "volar-service-html": "0.0.59",
31
+ "volar-service-json": "0.0.59",
32
+ "volar-service-pug": "0.0.59",
33
+ "volar-service-pug-beautify": "0.0.59",
34
+ "volar-service-typescript": "0.0.59",
35
+ "volar-service-typescript-twoslash-queries": "0.0.59",
36
36
  "vscode-html-languageservice": "^5.2.0",
37
37
  "vscode-languageserver-textdocument": "^1.0.11",
38
38
  "vscode-uri": "^3.0.8"
@@ -40,8 +40,8 @@
40
40
  "devDependencies": {
41
41
  "@types/node": "latest",
42
42
  "@types/path-browserify": "latest",
43
- "@volar/kit": "~2.4.0-alpha.12",
43
+ "@volar/kit": "~2.4.0-alpha.18",
44
44
  "vscode-languageserver-protocol": "^3.17.5"
45
45
  },
46
- "gitHead": "e4e8c8ca14dc564bf9043a625dd704b32bdc69d0"
46
+ "gitHead": "0cdbd70996f4fc7ac8d511b0d9fdbe20b7a4f6a3"
47
47
  }