@volar/vscode 1.10.10-alpha.0 → 1.10.10-alpha.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.
@@ -1,9 +1,8 @@
1
- import * as path from 'typesafe-path';
2
1
  import * as vscode from 'vscode';
3
2
  import type { BaseLanguageClient } from 'vscode-languageclient';
4
3
  export declare function activate(cmd: string, context: vscode.ExtensionContext, client: BaseLanguageClient, shouldStatusBarShow: (document: vscode.TextDocument) => boolean, resolveStatusText: (text: string) => string, disableTakeOverMode: boolean): Promise<vscode.Disposable>;
5
4
  export declare function getTsdk(context: vscode.ExtensionContext): Promise<{
6
- tsdk: string | path.PosixPath;
5
+ tsdk: string;
7
6
  version: string | undefined;
8
7
  isWorkspacePath: boolean;
9
8
  }>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getTsdk = exports.activate = void 0;
4
- const path = require("typesafe-path");
4
+ const path = require("path-browserify");
5
5
  const vscode = require("vscode");
6
6
  const common_1 = require("../common");
7
7
  const defaultTsdkPath = 'node_modules/typescript/lib';
@@ -111,26 +111,27 @@ function resolveWorkspaceTsdk(tsdk) {
111
111
  if (path.isAbsolute(tsdk)) {
112
112
  try {
113
113
  if (require.resolve('./typescript.js', { paths: [tsdk] })) {
114
- return tsdk.replace(/\\/g, '/');
114
+ return tsdk;
115
115
  }
116
116
  }
117
117
  catch { }
118
118
  }
119
- const workspaceFolderFsPaths = (vscode.workspace.workspaceFolders ?? []).map(folder => folder.uri.fsPath);
120
- for (const folder of workspaceFolderFsPaths) {
121
- const _path = path.join(folder, tsdk);
122
- try {
123
- if (require.resolve('./typescript.js', { paths: [_path] })) {
124
- return _path.replace(/\\/g, '/');
119
+ if (vscode.workspace.workspaceFolders) {
120
+ for (const folder of vscode.workspace.workspaceFolders) {
121
+ const tsdkPath = path.join(folder.uri.fsPath.replace(/\\/g, '/'), tsdk);
122
+ try {
123
+ if (require.resolve('./typescript.js', { paths: [tsdkPath] })) {
124
+ return tsdkPath;
125
+ }
125
126
  }
127
+ catch { }
126
128
  }
127
- catch { }
128
129
  }
129
130
  }
130
131
  async function getVScodeTsdk() {
131
132
  const nightly = vscode.extensions.getExtension('ms-vscode.vscode-typescript-next');
132
133
  if (nightly) {
133
- const libPath = path.join(nightly.extensionPath, 'node_modules/typescript/lib').replace(/\\/g, '/');
134
+ const libPath = path.join(nightly.extensionPath.replace(/\\/g, '/'), 'node_modules/typescript/lib');
134
135
  return {
135
136
  path: libPath,
136
137
  version: await getTsVersion(libPath),
@@ -138,7 +139,7 @@ async function getVScodeTsdk() {
138
139
  };
139
140
  }
140
141
  if (vscode.env.appRoot) {
141
- const libPath = path.join(vscode.env.appRoot, 'extensions/node_modules/typescript/lib').replace(/\\/g, '/');
142
+ const libPath = path.join(vscode.env.appRoot.replace(/\\/g, '/'), 'extensions/node_modules/typescript/lib');
142
143
  return {
143
144
  path: libPath,
144
145
  version: await getTsVersion(libPath),
@@ -154,7 +155,7 @@ async function getVScodeTsdk() {
154
155
  };
155
156
  }
156
157
  function getConfigTsdkPath() {
157
- return vscode.workspace.getConfiguration('typescript').get('tsdk');
158
+ return vscode.workspace.getConfiguration('typescript').get('tsdk')?.replace(/\\/g, '/');
158
159
  }
159
160
  function isUseWorkspaceTsdk(context) {
160
161
  return context.workspaceState.get('typescript.useWorkspaceTsdk', false);
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.activate = void 0;
4
4
  const vscode = require("vscode");
5
5
  const protocol_1 = require("@volar/language-server/protocol");
6
- const path = require("typesafe-path");
6
+ const path = require("path-browserify");
7
7
  async function activate(cmd, client, shouldStatusBarShow) {
8
8
  const subscriptions = [];
9
9
  const statusBar = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right);
@@ -26,7 +26,7 @@ async function activate(cmd, client, shouldStatusBarShow) {
26
26
  const tsconfig = await client.sendRequest(protocol_1.GetMatchTsConfigRequest.type, client.code2ProtocolConverter.asTextDocumentIdentifier(vscode.window.activeTextEditor.document));
27
27
  if (tsconfig?.uri) {
28
28
  currentTsconfigUri = vscode.Uri.parse(tsconfig.uri);
29
- statusBar.text = path.relative((vscode.workspace.rootPath || '/'), currentTsconfigUri.fsPath);
29
+ statusBar.text = path.relative((vscode.workspace.rootPath?.replace(/\\/g, '/') || '/'), currentTsconfigUri.fsPath.replace(/\\/g, '/'));
30
30
  statusBar.command = cmd;
31
31
  }
32
32
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volar/vscode",
3
- "version": "1.10.10-alpha.0",
3
+ "version": "1.10.10-alpha.1",
4
4
  "main": "out/index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -13,12 +13,13 @@
13
13
  "directory": "packages/vscode"
14
14
  },
15
15
  "dependencies": {
16
- "@volar/language-server": "1.10.10-alpha.0",
17
- "typesafe-path": "^0.2.2",
16
+ "@volar/language-server": "1.10.10-alpha.1",
17
+ "path-browserify": "^1.0.1",
18
18
  "vscode-nls": "^5.2.0"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@types/node": "latest",
22
+ "@types/path-browserify": "latest",
22
23
  "@types/vscode": "^1.82.0",
23
24
  "vscode-languageclient": "^9.0.1"
24
25
  },
@@ -30,5 +31,5 @@
30
31
  "optional": true
31
32
  }
32
33
  },
33
- "gitHead": "82c2a3fbd190fad9b9d8293b34587b5d17bed545"
34
+ "gitHead": "7bf9da2be16293e5dd5d7ac886d0193c00749ff2"
34
35
  }