@vue/language-service 3.2.9 → 3.3.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.
package/lib/nameCasing.js CHANGED
@@ -83,7 +83,7 @@ function detectTagCasing(code) {
83
83
  function collectTagsWithCache(code) {
84
84
  let cache = collectCache.get(code);
85
85
  if (!cache) {
86
- const ast = code.sfc.template?.ast;
86
+ const ast = code.ir.template?.ast;
87
87
  cache = ast ? collectTags(ast) : new Map();
88
88
  collectCache.set(code, cache);
89
89
  }
@@ -103,7 +103,7 @@ function create({ resolveModuleName }) {
103
103
  if (!info?.code.id.startsWith('style_')) {
104
104
  return false;
105
105
  }
106
- const block = info.root.sfc.styles.find(style => style.name === info.code.id);
106
+ const block = info.root.ir.styles.find(style => style.name === info.code.id);
107
107
  if (!block) {
108
108
  return false;
109
109
  }
@@ -27,8 +27,8 @@ function create(ts, { isRefAtPosition }) {
27
27
  return;
28
28
  }
29
29
  let sourceOffset;
30
- const { sfc } = info.root;
31
- const scriptBlocks = [sfc.script, sfc.scriptSetup].filter(block => !!block);
30
+ const { ir } = info.root;
31
+ const scriptBlocks = [ir.script, ir.scriptSetup].filter(block => !!block);
32
32
  const map = context.language.maps.get(info.code, info.script);
33
33
  if (!scriptBlocks.length) {
34
34
  return;
@@ -18,7 +18,7 @@ function create() {
18
18
  if (info?.code.id !== 'template') {
19
19
  return;
20
20
  }
21
- const { template } = info.root.sfc;
21
+ const { template } = info.root.ir;
22
22
  if (!template) {
23
23
  return;
24
24
  }
@@ -21,7 +21,7 @@ function create({ getComponentNames, getElementNames }) {
21
21
  if (info?.code.id !== 'template') {
22
22
  return;
23
23
  }
24
- const { template } = info.root.sfc;
24
+ const { template } = info.root.ir;
25
25
  if (!template?.ast) {
26
26
  return;
27
27
  }
@@ -4,7 +4,6 @@ exports.create = create;
4
4
  const language_core_1 = require("@vue/language-core");
5
5
  const shared_1 = require("@vue/shared");
6
6
  const path_browserify_1 = require("path-browserify");
7
- const getUserPreferences_1 = require("volar-service-typescript/lib/configs/getUserPreferences");
8
7
  const vscode_uri_1 = require("vscode-uri");
9
8
  const nameCasing_1 = require("../nameCasing");
10
9
  const vue_extract_file_1 = require("../plugins/vue-extract-file");
@@ -34,8 +33,8 @@ function create(ts, { getImportPathForFile }) {
34
33
  if (!importUri || !info.root.vueCompilerOptions.extensions.some(ext => importUri.endsWith(ext))) {
35
34
  return;
36
35
  }
37
- const { sfc } = info.root;
38
- const script = sfc.scriptSetup ?? sfc.script;
36
+ const { ir } = info.root;
37
+ const script = ir.scriptSetup ?? ir.script;
39
38
  if (!script) {
40
39
  return;
41
40
  }
@@ -43,17 +42,10 @@ function create(ts, { getImportPathForFile }) {
43
42
  const baseName = path_browserify_1.posix.basename(importUri);
44
43
  const newName = (0, shared_1.capitalize)((0, shared_1.camelize)(baseName.slice(0, baseName.lastIndexOf('.'))));
45
44
  const additionalEdit = {};
46
- const code = [...(0, language_core_1.forEachEmbeddedCode)(info.root)].find(code => code.id === (sfc.scriptSetup ? 'scriptsetup_raw' : 'script_raw'));
45
+ const code = [...(0, language_core_1.forEachEmbeddedCode)(info.root)].find(code => code.id === (ir.scriptSetup ? 'scriptsetup_raw' : 'script_raw'));
47
46
  const lastImportNode = (0, vue_extract_file_1.getLastImportNode)(ts, script.ast);
48
47
  const incomingFileName = vscode_uri_1.URI.parse(importUri).fsPath.replace(/\\/g, '/');
49
- let importPath;
50
- const serviceScript = info.script.generated.languagePlugin.typescript?.getServiceScript(info.root);
51
- if (serviceScript) {
52
- const tsDocumentUri = context.encodeEmbeddedDocumentUri(info.script.id, serviceScript.code.id);
53
- const tsDocument = context.documents.get(tsDocumentUri, serviceScript.code.languageId, serviceScript.code.snapshot);
54
- const preferences = await (0, getUserPreferences_1.getUserPreferences)(context, tsDocument);
55
- importPath = await getImportPathForFile(info.root.fileName, incomingFileName, preferences);
56
- }
48
+ let importPath = await getImportPathForFile(info.root.fileName, incomingFileName);
57
49
  if (!importPath) {
58
50
  importPath = path_browserify_1.posix.relative(path_browserify_1.posix.dirname(info.root.fileName), incomingFileName)
59
51
  || importUri.slice(importUri.lastIndexOf('/') + 1);
@@ -77,8 +69,8 @@ function create(ts, { getImportPathForFile }) {
77
69
  newText: `\nimport ${newName} from '${importPath}'`
78
70
  + (lastImportNode ? '' : '\n'),
79
71
  });
80
- if (sfc.script) {
81
- const edit = (0, vue_extract_file_1.createAddComponentToOptionEdit)(ts, sfc, sfc.script.ast, newName);
72
+ if (ir.script) {
73
+ const edit = (0, vue_extract_file_1.createAddComponentToOptionEdit)(ts, ir, ir.script.ast, newName);
82
74
  if (edit) {
83
75
  additionalEdit.changes[embeddedDocumentUriStr].push({
84
76
  range: {
@@ -16,7 +16,7 @@ function create({ getDocumentHighlights }) {
16
16
  if (info?.script.id.scheme !== 'file' || info.code.id !== 'main') {
17
17
  return;
18
18
  }
19
- const { template } = info.root.sfc;
19
+ const { template } = info.root.ir;
20
20
  const offset = document.offsetAt(position);
21
21
  if (template?.ast && offset >= template.startTagEnd && offset <= template.endTagStart) {
22
22
  const pos = offset - template.startTagEnd;
@@ -1,9 +1,9 @@
1
1
  import type { LanguageServicePlugin } from '@volar/language-service';
2
- import { type Sfc } from '@vue/language-core';
2
+ import { type IR } from '@vue/language-core';
3
3
  import type * as ts from 'typescript';
4
4
  export declare function create(ts: typeof import('typescript'), { collectExtractProps }: import('@vue/typescript-plugin/lib/requests').Requests): LanguageServicePlugin;
5
5
  export declare function getLastImportNode(ts: typeof import('typescript'), sourceFile: ts.SourceFile): ts.Node | undefined;
6
- export declare function createAddComponentToOptionEdit(ts: typeof import('typescript'), sfc: Sfc, ast: ts.SourceFile, componentName: string): {
6
+ export declare function createAddComponentToOptionEdit(ts: typeof import('typescript'), ir: IR, ast: ts.SourceFile, componentName: string): {
7
7
  range: import("@vue/language-core").TextRange<ts.ObjectLiteralExpression>;
8
8
  newText: string;
9
9
  } | undefined;
@@ -31,12 +31,12 @@ function create(ts, { collectExtractProps }) {
31
31
  if (info?.code.id !== 'template') {
32
32
  return;
33
33
  }
34
- const { sfc } = info.root;
35
- const script = sfc.scriptSetup ?? sfc.script;
36
- if (!sfc.template || !script) {
34
+ const { ir } = info.root;
35
+ const script = ir.scriptSetup ?? ir.script;
36
+ if (!ir.template || !script) {
37
37
  return;
38
38
  }
39
- const templateCodeRange = selectTemplateCode(startOffset, endOffset, sfc.template);
39
+ const templateCodeRange = selectTemplateCode(startOffset, endOffset, ir.template);
40
40
  if (!templateCodeRange) {
41
41
  return;
42
42
  }
@@ -59,12 +59,12 @@ function create(ts, { collectExtractProps }) {
59
59
  if (info?.code.id !== 'template') {
60
60
  return codeAction;
61
61
  }
62
- const { sfc } = info.root;
63
- const script = sfc.scriptSetup ?? sfc.script;
64
- if (!sfc.template || !script) {
62
+ const { ir } = info.root;
63
+ const script = ir.scriptSetup ?? ir.script;
64
+ if (!ir.template || !script) {
65
65
  return codeAction;
66
66
  }
67
- const templateCodeRange = selectTemplateCode(startOffset, endOffset, sfc.template);
67
+ const templateCodeRange = selectTemplateCode(startOffset, endOffset, ir.template);
68
68
  if (!templateCodeRange) {
69
69
  return codeAction;
70
70
  }
@@ -77,11 +77,11 @@ function create(ts, { collectExtractProps }) {
77
77
  const newUri = sfcDocument.uri.slice(0, sfcDocument.uri.lastIndexOf('/') + 1) + `${newName}.vue`;
78
78
  const lastImportNode = getLastImportNode(ts, script.ast);
79
79
  let newFileTags = [];
80
- newFileTags.push(constructTag('template', [], templateInitialIndent, sfc.template.content.slice(templateCodeRange[0], templateCodeRange[1])));
80
+ newFileTags.push(constructTag('template', [], templateInitialIndent, ir.template.content.slice(templateCodeRange[0], templateCodeRange[1])));
81
81
  if (toExtract.length) {
82
82
  newFileTags.push(constructTag('script', ['setup', 'lang="ts"'], scriptInitialIndent, generateNewScriptContents()));
83
83
  }
84
- if (sfc.template.startTagEnd > script.startTagEnd) {
84
+ if (ir.template.startTagEnd > script.startTagEnd) {
85
85
  newFileTags = newFileTags.reverse();
86
86
  }
87
87
  const templateEdits = [
@@ -107,13 +107,13 @@ function create(ts, { collectExtractProps }) {
107
107
  newText: `\nimport ${newName} from './${newName}.vue'`,
108
108
  },
109
109
  ];
110
- if (sfc.script) {
111
- const edit = createAddComponentToOptionEdit(ts, sfc, sfc.script.ast, newName);
110
+ if (ir.script) {
111
+ const edit = createAddComponentToOptionEdit(ts, ir, ir.script.ast, newName);
112
112
  if (edit) {
113
113
  sfcEdits.push({
114
114
  range: {
115
- start: sfcDocument.positionAt(sfc.script.startTagEnd + edit.range.start),
116
- end: sfcDocument.positionAt(sfc.script.startTagEnd + edit.range.end),
115
+ start: sfcDocument.positionAt(ir.script.startTagEnd + edit.range.start),
116
+ end: sfcDocument.positionAt(ir.script.startTagEnd + edit.range.end),
117
117
  },
118
118
  newText: edit.newText,
119
119
  });
@@ -237,8 +237,8 @@ function getLastImportNode(ts, sourceFile) {
237
237
  }
238
238
  return lastImportNode;
239
239
  }
240
- function createAddComponentToOptionEdit(ts, sfc, ast, componentName) {
241
- const componentOptions = language_core_1.tsCodegen.get(sfc)?.getScriptRanges()?.exportDefault?.options;
240
+ function createAddComponentToOptionEdit(ts, ir, ast, componentName) {
241
+ const componentOptions = language_core_1.tsCodegen.get(ir)?.getScriptRanges()?.exportDefault?.options;
242
242
  if (!componentOptions) {
243
243
  return;
244
244
  }
@@ -22,18 +22,18 @@ function create(ts) {
22
22
  return settings[key] ??= await context.env.getConfiguration?.(key) ?? false;
23
23
  }
24
24
  const result = [];
25
- const { sfc } = info.root;
26
- const codegen = language_core_1.tsCodegen.get(sfc);
25
+ const { ir } = info.root;
26
+ const codegen = language_core_1.tsCodegen.get(ir);
27
27
  const inlayHints = [
28
28
  ...codegen?.getGeneratedTemplate()?.inlayHints ?? [],
29
29
  ...codegen?.getGeneratedScript().inlayHints ?? [],
30
30
  ];
31
31
  const scriptSetupRanges = codegen?.getScriptSetupRanges();
32
- if (scriptSetupRanges?.defineProps?.destructured && sfc.scriptSetup?.ast) {
32
+ if (scriptSetupRanges?.defineProps?.destructured && ir.scriptSetup?.ast) {
33
33
  const setting = 'vue.inlayHints.destructuredProps';
34
34
  const enabled = await getSettingEnabled(setting);
35
35
  if (enabled) {
36
- for (const [prop, isShorthand] of findDestructuredProps(ts, sfc.scriptSetup.ast, scriptSetupRanges.defineProps.destructured.keys())) {
36
+ for (const [prop, isShorthand] of findDestructuredProps(ts, ir.scriptSetup.ast, scriptSetupRanges.defineProps.destructured.keys())) {
37
37
  const name = prop.text;
38
38
  const end = prop.getEnd();
39
39
  const pos = isShorthand ? end : end - name.length;
@@ -48,9 +48,9 @@ function create(ts) {
48
48
  }
49
49
  }
50
50
  const blocks = [
51
- sfc.template,
52
- sfc.script,
53
- sfc.scriptSetup,
51
+ ir.template,
52
+ ir.script,
53
+ ir.scriptSetup,
54
54
  ];
55
55
  const start = document.offsetAt(range.start);
56
56
  const end = document.offsetAt(range.end);
@@ -1,2 +1,2 @@
1
1
  import type { LanguageServicePlugin } from '@volar/language-service';
2
- export declare function create({ getComponentNames, getElementNames, getComponentMeta }: import('@vue/typescript-plugin/lib/requests').Requests): LanguageServicePlugin;
2
+ export declare function create({ getComponentProps }: import('@vue/typescript-plugin/lib/requests').Requests): LanguageServicePlugin;
@@ -1,51 +1,16 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
3
  exports.create = create;
37
4
  const language_core_1 = require("@vue/language-core");
38
- const html = __importStar(require("vscode-html-languageservice"));
39
5
  const nameCasing_1 = require("../nameCasing");
40
6
  const utils_1 = require("../utils");
41
- function create({ getComponentNames, getElementNames, getComponentMeta }) {
7
+ function create({ getComponentProps }) {
42
8
  return {
43
9
  name: 'vue-missing-props-hints',
44
10
  capabilities: {
45
11
  inlayHintProvider: {},
46
12
  },
47
13
  create(context) {
48
- let intrinsicElementNames;
49
14
  return {
50
15
  async provideInlayHints(document, range, cancellationToken) {
51
16
  const info = (0, utils_1.resolveEmbeddedCode)(context, document.uri);
@@ -56,101 +21,78 @@ function create({ getComponentNames, getElementNames, getComponentMeta }) {
56
21
  if (!enabled) {
57
22
  return;
58
23
  }
59
- const scanner = getScanner(context, document);
60
- if (!scanner) {
24
+ const { template } = info.root.ir;
25
+ if (!template?.ast) {
61
26
  return;
62
27
  }
63
28
  const result = [];
64
29
  const attrNameCasing = await (0, nameCasing_1.getAttrNameCasing)(context, info.script.id);
65
- const components = await getComponentNames(info.root.fileName) ?? [];
66
- const componentProps = new Map();
67
- intrinsicElementNames ??= new Set(await getElementNames(info.root.fileName) ?? []);
68
- let token;
69
- let current;
70
- while ((token = scanner.scan()) !== html.TokenType.EOS) {
71
- if (token === html.TokenType.StartTag) {
72
- const tagName = scanner.getTokenText();
73
- const tagOffset = scanner.getTokenOffset();
74
- const checkTag = tagName.includes('.')
75
- ? tagName
76
- : components.find(component => component === tagName || (0, language_core_1.hyphenateTag)(component) === tagName);
77
- if (intrinsicElementNames.has(tagName) || !checkTag) {
78
- continue;
79
- }
80
- if (tagOffset < document.offsetAt(range.start)) {
81
- continue;
82
- }
83
- if (tagOffset > document.offsetAt(range.end)) {
84
- break;
85
- }
86
- if (!componentProps.has(checkTag)) {
87
- if (cancellationToken.isCancellationRequested) {
88
- break;
89
- }
90
- componentProps.set(checkTag, ((await getComponentMeta(info.root.fileName, checkTag))?.props ?? [])
91
- .filter(prop => prop.required));
92
- }
93
- current = {
94
- unburnedRequiredProps: [...componentProps.get(checkTag)],
95
- labelOffset: scanner.getTokenOffset() + scanner.getTokenLength(),
96
- };
30
+ const map = context.language.maps.get(info.code, info.script);
31
+ for (const node of (0, language_core_1.forEachElementNode)(template.ast)) {
32
+ if (cancellationToken.isCancellationRequested) {
33
+ break;
97
34
  }
98
- else if (token === html.TokenType.AttributeName) {
99
- if (current) {
100
- let attrText = scanner.getTokenText();
101
- if (attrText === 'v-bind') {
102
- current.unburnedRequiredProps = [];
103
- }
104
- else {
105
- // remove modifiers
106
- if (attrText.includes('.')) {
107
- attrText = attrText.split('.')[0];
108
- }
109
- // normalize
110
- if (attrText.startsWith('v-bind:')) {
111
- attrText = attrText.slice('v-bind:'.length);
112
- }
113
- else if (attrText.startsWith(':')) {
114
- attrText = attrText.slice(':'.length);
35
+ if (node.tagType !== 1) {
36
+ continue;
37
+ }
38
+ const [startTagOffset] = (0, language_core_1.getElementTagOffsets)(node, template);
39
+ const sourceOffset = startTagOffset + node.tag.length;
40
+ let generatedOffset;
41
+ for (const [offset] of map.toGeneratedLocation(template.startTagEnd + sourceOffset)) {
42
+ generatedOffset = offset;
43
+ break;
44
+ }
45
+ if (generatedOffset === undefined
46
+ || generatedOffset < document.offsetAt(range.start)
47
+ || generatedOffset > document.offsetAt(range.end)) {
48
+ continue;
49
+ }
50
+ const props = await getComponentProps(info.root.fileName, node.loc.start.offset) ?? [];
51
+ const missingProps = new Map(props.filter(prop => !prop.optional).map(prop => [(0, language_core_1.hyphenateAttr)(prop.name), prop.name]));
52
+ for (const prop of node.props) {
53
+ if (prop.type === 6) {
54
+ missingProps.delete((0, language_core_1.hyphenateAttr)(prop.name));
55
+ }
56
+ else if (prop.type === 7) {
57
+ if (prop.name === 'bind') {
58
+ if (prop.arg?.type === 4 && prop.arg.isStatic) {
59
+ missingProps.delete((0, language_core_1.hyphenateAttr)(prop.arg.content));
115
60
  }
116
- else if (attrText.startsWith('v-model:')) {
117
- attrText = attrText.slice('v-model:'.length);
61
+ else if (!prop.arg) {
62
+ missingProps.clear();
118
63
  }
119
- else if (attrText === 'v-model') {
120
- attrText = 'modelValue'; // TODO: support for experimentalModelPropName?
64
+ }
65
+ else if (prop.name === 'model') {
66
+ if (prop.arg?.type === 4 && prop.arg.isStatic) {
67
+ missingProps.delete((0, language_core_1.hyphenateAttr)(prop.arg.content));
68
+ missingProps.delete('on-update:' + (0, language_core_1.hyphenateAttr)(prop.arg.content));
121
69
  }
122
- else if (attrText.startsWith('v-on:')) {
123
- attrText = 'on-' + (0, language_core_1.hyphenateAttr)(attrText.slice('v-on:'.length));
70
+ else if (!prop.arg) {
71
+ missingProps.delete('model-value');
72
+ missingProps.delete('on-update:model-value');
124
73
  }
125
- else if (attrText.startsWith('@')) {
126
- attrText = 'on-' + (0, language_core_1.hyphenateAttr)(attrText.slice('@'.length));
74
+ }
75
+ else if (prop.name === 'on') {
76
+ if (prop.arg?.type === 4 && prop.arg.isStatic) {
77
+ missingProps.delete('on-' + (0, language_core_1.hyphenateAttr)(prop.arg.content));
127
78
  }
128
- current.unburnedRequiredProps = current.unburnedRequiredProps.filter(prop => {
129
- return attrText !== prop.name
130
- && attrText !== (0, language_core_1.hyphenateAttr)(prop.name);
131
- });
132
79
  }
133
80
  }
134
81
  }
135
- else if (token === html.TokenType.StartTagSelfClose || token === html.TokenType.StartTagClose) {
136
- if (current) {
137
- for (const requiredProp of current.unburnedRequiredProps) {
138
- result.push({
139
- label: requiredProp.name,
140
- paddingLeft: true,
141
- position: document.positionAt(current.labelOffset),
142
- kind: 2,
143
- textEdits: [{
144
- range: {
145
- start: document.positionAt(current.labelOffset),
146
- end: document.positionAt(current.labelOffset),
147
- },
148
- newText: ` :${attrNameCasing === 0 /* AttrNameCasing.Kebab */ ? (0, language_core_1.hyphenateAttr)(requiredProp.name) : requiredProp.name}=`,
149
- }],
150
- });
151
- }
152
- current = undefined;
153
- }
82
+ for (const name of missingProps.values()) {
83
+ result.push({
84
+ label: name,
85
+ paddingLeft: true,
86
+ position: document.positionAt(generatedOffset),
87
+ kind: 2,
88
+ textEdits: [{
89
+ range: {
90
+ start: document.positionAt(generatedOffset),
91
+ end: document.positionAt(generatedOffset),
92
+ },
93
+ newText: ` :${attrNameCasing === 0 /* AttrNameCasing.Kebab */ ? (0, language_core_1.hyphenateAttr)(name) : name}=`,
94
+ }],
95
+ });
154
96
  }
155
97
  }
156
98
  return result;
@@ -158,16 +100,5 @@ function create({ getComponentNames, getElementNames, getComponentMeta }) {
158
100
  };
159
101
  },
160
102
  };
161
- function getScanner(context, document) {
162
- if (document.languageId === 'html') {
163
- return context.inject('html/languageService').createScanner(document.getText());
164
- }
165
- else {
166
- const pugDocument = context.inject('pug/pugDocument', document);
167
- if (pugDocument) {
168
- return context.inject('pug/languageService').createScanner(pugDocument);
169
- }
170
- }
171
- }
172
103
  }
173
104
  //# sourceMappingURL=vue-missing-props-hints.js.map
@@ -16,17 +16,17 @@ function create() {
16
16
  if (info?.code.id !== 'template') {
17
17
  return;
18
18
  }
19
- const { sfc } = info.root;
20
- if (!sfc.template) {
19
+ const { ir } = info.root;
20
+ if (!ir.template) {
21
21
  return;
22
22
  }
23
23
  const { resolveStyleClassNames } = info.root.vueCompilerOptions;
24
24
  if (!resolveStyleClassNames) {
25
25
  return;
26
26
  }
27
- const scopedClasses = styleScopedClasses_1.references.get(sfc.template)?.[1] ?? [];
27
+ const scopedClasses = styleScopedClasses_1.references.get(ir.template)?.[1] ?? [];
28
28
  const styleClasses = new Map();
29
- for (const style of sfc.styles) {
29
+ for (const style of ir.styles) {
30
30
  if (!(resolveStyleClassNames === true || style.scoped)) {
31
31
  continue;
32
32
  }
@@ -55,7 +55,7 @@ function create() {
55
55
  }
56
56
  const formatSettings = await context.env.getConfiguration?.('html.format') ?? {};
57
57
  const blockTypes = ['template', 'script', 'style'];
58
- for (const customBlock of info.root.sfc.customBlocks) {
58
+ for (const customBlock of info.root.ir.customBlocks) {
59
59
  blockTypes.push(customBlock.type);
60
60
  }
61
61
  return {
@@ -112,13 +112,13 @@ function create() {
112
112
  if (info?.code.id !== 'root_tags') {
113
113
  return [];
114
114
  }
115
- const { vueSfc, sfc } = info.root;
115
+ const { vueSfc, ir } = info.root;
116
116
  if (!vueSfc) {
117
117
  return;
118
118
  }
119
119
  const originalResult = await htmlServiceInstance.provideDiagnostics?.(document, token);
120
120
  const sfcErrors = [];
121
- const { template } = sfc;
121
+ const { template } = ir;
122
122
  const { startTagEnd = Infinity, endTagStart = -Infinity, } = template ?? {};
123
123
  for (const error of vueSfc.errors) {
124
124
  if ('code' in error) {
@@ -149,50 +149,50 @@ function create() {
149
149
  return;
150
150
  }
151
151
  const result = [];
152
- const { sfc } = info.root;
153
- if (sfc.template) {
152
+ const { ir } = info.root;
153
+ if (ir.template) {
154
154
  result.push({
155
155
  name: 'template',
156
156
  kind: 2,
157
157
  range: {
158
- start: document.positionAt(sfc.template.start),
159
- end: document.positionAt(sfc.template.end),
158
+ start: document.positionAt(ir.template.start),
159
+ end: document.positionAt(ir.template.end),
160
160
  },
161
161
  selectionRange: {
162
- start: document.positionAt(sfc.template.start),
163
- end: document.positionAt(sfc.template.startTagEnd),
162
+ start: document.positionAt(ir.template.start),
163
+ end: document.positionAt(ir.template.startTagEnd),
164
164
  },
165
165
  });
166
166
  }
167
- if (sfc.script) {
167
+ if (ir.script) {
168
168
  result.push({
169
169
  name: 'script',
170
170
  kind: 2,
171
171
  range: {
172
- start: document.positionAt(sfc.script.start),
173
- end: document.positionAt(sfc.script.end),
172
+ start: document.positionAt(ir.script.start),
173
+ end: document.positionAt(ir.script.end),
174
174
  },
175
175
  selectionRange: {
176
- start: document.positionAt(sfc.script.start),
177
- end: document.positionAt(sfc.script.startTagEnd),
176
+ start: document.positionAt(ir.script.start),
177
+ end: document.positionAt(ir.script.startTagEnd),
178
178
  },
179
179
  });
180
180
  }
181
- if (sfc.scriptSetup) {
181
+ if (ir.scriptSetup) {
182
182
  result.push({
183
183
  name: 'script setup',
184
184
  kind: 2,
185
185
  range: {
186
- start: document.positionAt(sfc.scriptSetup.start),
187
- end: document.positionAt(sfc.scriptSetup.end),
186
+ start: document.positionAt(ir.scriptSetup.start),
187
+ end: document.positionAt(ir.scriptSetup.end),
188
188
  },
189
189
  selectionRange: {
190
- start: document.positionAt(sfc.scriptSetup.start),
191
- end: document.positionAt(sfc.scriptSetup.startTagEnd),
190
+ start: document.positionAt(ir.scriptSetup.start),
191
+ end: document.positionAt(ir.scriptSetup.startTagEnd),
192
192
  },
193
193
  });
194
194
  }
195
- for (const style of sfc.styles) {
195
+ for (const style of ir.styles) {
196
196
  let name = 'style';
197
197
  if (style.scoped) {
198
198
  name += ' scoped';
@@ -213,7 +213,7 @@ function create() {
213
213
  },
214
214
  });
215
215
  }
216
- for (const customBlock of sfc.customBlocks) {
216
+ for (const customBlock of ir.customBlocks) {
217
217
  result.push({
218
218
  name: customBlock.type,
219
219
  kind: 2,