Skip to content

Commit 86a1c83

Browse files
committed
refactor(language-service): remove unnecessary project.vue checks
1 parent 7953154 commit 86a1c83

File tree

3 files changed

+3
-16
lines changed

3 files changed

+3
-16
lines changed

packages/language-service/lib/plugins/vue-document-drop.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,10 @@ export function create(
2424
documentDropEditsProvider: true,
2525
},
2626
create(context) {
27-
if (!context.project.vue) {
28-
return {};
29-
}
30-
3127
let casing = TagNameCasing.Pascal as TagNameCasing; // TODO
3228

3329
const tsPluginClient = getTsPluginClient?.(context);
34-
const vueCompilerOptions = context.project.vue.compilerOptions;
30+
const vueCompilerOptions = context.project.vue!.compilerOptions;
3531

3632
return {
3733
async provideDocumentDropEdits(document, _position, dataTransfer) {
@@ -76,8 +72,7 @@ export function create(
7672
code.id === (sfc.scriptSetup ? 'scriptsetup_raw' : 'script_raw')
7773
)!;
7874
const lastImportNode = getLastImportNode(ts, script.ast);
79-
const incomingFileName = context.project.typescript?.uriConverter.asFileName(URI.parse(importUri))
80-
?? URI.parse(importUri).fsPath.replace(/\\/g, '/');
75+
const incomingFileName = URI.parse(importUri).fsPath.replace(/\\/g, '/');
8176

8277
let importPath: string | undefined;
8378

packages/language-service/lib/plugins/vue-missing-props-hints.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ export function create(
3030
return;
3131
}
3232

33-
if (!context.project.vue) {
34-
return;
35-
}
36-
3733
const enabled = await context.env.getConfiguration<boolean>?.('vue.inlayHints.missingProps') ?? false;
3834
if (!enabled) {
3935
return;
@@ -126,7 +122,7 @@ export function create(
126122
attrText = attrText.slice('v-model:'.length);
127123
}
128124
else if (attrText === 'v-model') {
129-
attrText = context.project.vue.compilerOptions.target >= 3 ? 'modelValue' : 'value'; // TODO: support for experimentalModelPropName?
125+
attrText = context.project.vue!.compilerOptions.target >= 3 ? 'modelValue' : 'value'; // TODO: support for experimentalModelPropName?
130126
}
131127
else if (attrText.startsWith('v-on:')) {
132128
attrText = 'on-' + hyphenateAttr(attrText.slice('v-on:'.length));

packages/language-service/lib/plugins/vue-template.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,6 @@ export function create(
162162
return;
163163
}
164164

165-
if (!context.project.vue) {
166-
return;
167-
}
168-
169165
const uri = URI.parse(document.uri);
170166
const decoded = context.decodeEmbeddedDocumentUri(uri);
171167
const sourceScript = decoded && context.language.scripts.get(decoded[0]);

0 commit comments

Comments
 (0)