@volar/vscode 2.1.1 → 2.1.3

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.
@@ -7,8 +7,11 @@ const common_1 = require("../common");
7
7
  const defaultTsdkPath = 'node_modules/typescript/lib';
8
8
  function activate(selector, cmd, context, client, resolveStatusText) {
9
9
  const subscriptions = [];
10
- const statusBar = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right);
11
- statusBar.command = cmd;
10
+ const statusBar = vscode.languages.createLanguageStatusItem(cmd, selector);
11
+ statusBar.command = {
12
+ title: 'Select Version',
13
+ command: cmd,
14
+ };
12
15
  subscriptions.push({ dispose: () => statusBar.dispose() });
13
16
  subscriptions.push(vscode.commands.registerCommand(cmd, onCommand));
14
17
  vscode.workspace.onDidChangeConfiguration(onDidChangeConfiguration, undefined, subscriptions);
@@ -57,16 +60,9 @@ function activate(selector, cmd, context, client, resolveStatusText) {
57
60
  }
58
61
  }
59
62
  async function updateStatusBar() {
60
- if (!vscode.window.activeTextEditor
61
- || !vscode.languages.match(selector, vscode.window.activeTextEditor.document)) {
62
- statusBar.hide();
63
- }
64
- else {
65
- const tsVersion = (await getTsdk(context)).version;
66
- statusBar.text = tsVersion ?? 'x.x.x';
67
- statusBar.text = resolveStatusText(statusBar.text);
68
- statusBar.show();
69
- }
63
+ const tsVersion = (await getTsdk(context)).version;
64
+ statusBar.text = tsVersion ?? 'x.x.x';
65
+ statusBar.text = resolveStatusText(statusBar.text);
70
66
  }
71
67
  async function reloadServers() {
72
68
  const tsPaths = await getTsdk(context);
@@ -6,7 +6,7 @@ const protocol_1 = require("@volar/language-server/protocol");
6
6
  const path = require("path-browserify");
7
7
  function activate(selector, cmd, client) {
8
8
  const subscriptions = [];
9
- const statusBar = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right);
9
+ const statusBar = vscode.languages.createLanguageStatusItem(cmd, selector);
10
10
  let currentTsconfigUri;
11
11
  updateStatusBar();
12
12
  vscode.window.onDidChangeActiveTextEditor(updateStatusBar, undefined, subscriptions);
@@ -20,20 +20,20 @@ function activate(selector, cmd, client) {
20
20
  async function updateStatusBar() {
21
21
  if (!vscode.window.activeTextEditor
22
22
  || !vscode.languages.match(selector, vscode.window.activeTextEditor.document)) {
23
- statusBar.hide();
23
+ return;
24
+ }
25
+ const tsconfig = await client.sendRequest(protocol_1.GetMatchTsConfigRequest.type, client.code2ProtocolConverter.asTextDocumentIdentifier(vscode.window.activeTextEditor.document));
26
+ if (tsconfig?.uri) {
27
+ currentTsconfigUri = vscode.Uri.parse(tsconfig.uri);
28
+ statusBar.text = path.relative((vscode.workspace.rootPath?.replace(/\\/g, '/') || '/'), currentTsconfigUri.fsPath.replace(/\\/g, '/'));
29
+ statusBar.command = {
30
+ title: 'Open config file',
31
+ command: cmd,
32
+ };
24
33
  }
25
34
  else {
26
- const tsconfig = await client.sendRequest(protocol_1.GetMatchTsConfigRequest.type, client.code2ProtocolConverter.asTextDocumentIdentifier(vscode.window.activeTextEditor.document));
27
- if (tsconfig?.uri) {
28
- currentTsconfigUri = vscode.Uri.parse(tsconfig.uri);
29
- statusBar.text = path.relative((vscode.workspace.rootPath?.replace(/\\/g, '/') || '/'), currentTsconfigUri.fsPath.replace(/\\/g, '/'));
30
- statusBar.command = cmd;
31
- }
32
- else {
33
- statusBar.text = 'No tsconfig';
34
- statusBar.command = undefined;
35
- }
36
- statusBar.show();
35
+ statusBar.text = 'No tsconfig';
36
+ statusBar.command = undefined;
37
37
  }
38
38
  }
39
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volar/vscode",
3
- "version": "2.1.1",
3
+ "version": "2.1.3",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -12,7 +12,7 @@
12
12
  "directory": "packages/vscode"
13
13
  },
14
14
  "dependencies": {
15
- "@volar/language-server": "2.1.1",
15
+ "@volar/language-server": "2.1.3",
16
16
  "path-browserify": "^1.0.1",
17
17
  "vscode-languageclient": "^9.0.1",
18
18
  "vscode-nls": "^5.2.0"
@@ -22,5 +22,5 @@
22
22
  "@types/path-browserify": "latest",
23
23
  "@types/vscode": "^1.82.0"
24
24
  },
25
- "gitHead": "e56916097fe7be2920aab6592a564a8e2ceafd14"
25
+ "gitHead": "0f861d59faa19cbeadef182ee079be88f9629fc7"
26
26
  }