Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4b7ebe5
commit e97f6e3
Showing
3 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
extensions/vscode-vue-language-features/src/features/doctor.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { getCurrentTsPaths } from './tsVersion'; | ||
import * as vscode from 'vscode'; | ||
import * as shared from '@volar/shared'; | ||
import { takeOverModeEnabled } from '../common'; | ||
|
||
export async function activate(context: vscode.ExtensionContext) { | ||
context.subscriptions.push(vscode.commands.registerCommand('volar.action.doctor', async () => { | ||
|
||
// TODO: tsconfig infos | ||
// TODO: warnings | ||
|
||
const tsPaths = getCurrentTsPaths(context); | ||
const tsVersion = shared.getTypeScriptVersion(tsPaths.serverPath); | ||
const content = ` | ||
## Infos | ||
vscode.version: ${vscode.version} | ||
vscode.typescript.version: ${tsVersion} | ||
vscode.typescript-extension.actived: ${!!vscode.extensions.getExtension('vscode.typescript-language-features')} | ||
vue-language-features.version: ${context.extension.packageJSON.version} | ||
typescript-vue-plugin.version: ${vscode.extensions.getExtension('Vue.vscode-typescript-vue-plugin')?.packageJSON.version} | ||
vetur.actived: ${!!vscode.extensions.getExtension('octref.vetur')} | ||
workspace.vue-tsc.version: ${getWorkspacePackageJson('vue-tsc')?.version} | ||
workspace.typescript.version: ${getWorkspacePackageJson('typescript')?.version} | ||
workspace.vue.version: ${getWorkspacePackageJson('vue')?.version} | ||
workspace.@vue/runtime-dom.version: ${getWorkspacePackageJson('@vue/runtime-dom')?.version} | ||
takeover-mode.enabled: ${takeOverModeEnabled()} | ||
### Configuration | ||
\`\`\`json | ||
${JSON.stringify({ | ||
volar: vscode.workspace.getConfiguration('').get('volar'), | ||
typescript: vscode.workspace.getConfiguration('').get('typescript'), | ||
javascript: vscode.workspace.getConfiguration('').get('javascript'), | ||
}, null, 2)} | ||
\`\`\` | ||
`; | ||
|
||
const document = await vscode.workspace.openTextDocument({ content: content.trim(), language: 'markdown' }); | ||
|
||
await vscode.window.showTextDocument(document); | ||
})); | ||
} | ||
|
||
function getWorkspacePackageJson(pkg: string): { version: string; } | undefined { | ||
try { | ||
return require(require.resolve(pkg + '/package.json', { paths: [vscode.workspace.rootPath!] })); | ||
} catch { } | ||
} |
e97f6e3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For projects using
pnpm
as package manager, it seems that the version of@vue/runtime-dom
is not being obtained.However, this is probably a check item for vue2, and I have a feeling that users who use vue2 will not willingly use
pnpm
, so I don't think there is a problem at present.