Skip to content

Commit

Permalink
fix(vscode): find file references not working when hybrid mode disabled
Browse files Browse the repository at this point in the history
close #4221
  • Loading branch information
johnsoncodehk committed Apr 7, 2024
1 parent 7e160b1 commit 52a74b4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
20 changes: 15 additions & 5 deletions extensions/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -415,37 +415,47 @@
"title": "Split <script>, <template>, <style> Editors",
"category": "Vue",
"icon": "images/split-editors.png"
},
{
"command": "vue.findAllFileReferences",
"title": "Find File References via Vue Langauge Server",
"category": "Vue"
}
],
"menus": {
"editor/context": [
{
"command": "typescript.goToSourceDefinition",
"when": "tsSupportsSourceDefinition && resourceLangId == vue",
"when": "vueHybridMode && tsSupportsSourceDefinition && resourceLangId == vue",
"group": "navigation@9"
}
],
"explorer/context": [
{
"command": "typescript.findAllFileReferences",
"when": "tsSupportsFileReferences && resourceLangId == vue",
"when": "vueHybridMode && tsSupportsFileReferences && resourceLangId == vue",
"group": "4_search"
},
{
"command": "vue.findAllFileReferences",
"when": "!vueHybridMode && resourceLangId == vue",
"group": "4_search"
}
],
"editor/title/context": [
{
"command": "typescript.findAllFileReferences",
"when": "tsSupportsFileReferences && resourceLangId == vue"
"when": "vueHybridMode && tsSupportsFileReferences && resourceLangId == vue"
}
],
"commandPalette": [
{
"command": "typescript.reloadProjects",
"when": "editorLangId == vue && typescript.isManagedFile"
"when": "vueHybridMode && editorLangId == vue && typescript.isManagedFile"
},
{
"command": "typescript.goToProjectConfig",
"when": "editorLangId == vue"
"when": "vueHybridMode && editorLangId == vue"
},
{
"command": "vue.action.doctor",
Expand Down
3 changes: 3 additions & 0 deletions extensions/vscode/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export async function activate(context: vscode.ExtensionContext, createLc: Creat

export const currentHybridModeStatus = getCurrentHybridModeStatus();

vscode.commands.executeCommand('setContext', 'vueHybridMode', currentHybridModeStatus);

function getCurrentHybridModeStatus(report = false) {
if (config.server.hybridMode === 'auto') {
const unknownExtensions: string[] = [];
Expand Down Expand Up @@ -197,6 +199,7 @@ async function doActivate(context: vscode.ExtensionContext, createLc: CreateLang
if (!currentHybridModeStatus) {
lsp.activateTsConfigStatusItem(selectors, 'vue.tsconfig', client);
lsp.activateTsVersionStatusItem(selectors, 'vue.tsversion', context, client, text => 'TS ' + text);
lsp.activateFindFileReferences('vue.findAllFileReferences', client);
}

const hybridModeStatus = vscode.languages.createLanguageStatusItem('vue-hybrid-mode', selectors);
Expand Down

0 comments on commit 52a74b4

Please sign in to comment.