volar-service-typescript 0.0.15 → 0.0.16

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.
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getUserPreferences = void 0;
4
4
  const shared_1 = require("../shared");
5
- const path_1 = require("path");
5
+ const path = require("path-browserify");
6
6
  const vscode_uri_1 = require("vscode-uri");
7
7
  async function getUserPreferences(ctx, document) {
8
8
  const config = await ctx.env.getConfiguration?.((0, shared_1.getConfigTitle)(document)) ?? {};
@@ -56,9 +56,9 @@ function getAutoImportFileExcludePatternsPreference(config, workspaceFolder) {
56
56
  // Normalization rules: https://github.com/microsoft/TypeScript/pull/49578
57
57
  const slashNormalized = p.replace(/\\/g, '/');
58
58
  const isRelative = /^\.\.?($|\/)/.test(slashNormalized);
59
- return path_1.posix.isAbsolute(p) ? p :
59
+ return path.isAbsolute(p) ? p :
60
60
  p.startsWith('*') ? '/' + slashNormalized :
61
- isRelative ? vscode_uri_1.URI.parse(path_1.posix.join(workspaceFolder.toString(), p)).fsPath :
61
+ isRelative ? vscode_uri_1.URI.parse(path.join(workspaceFolder.toString(), p)).fsPath :
62
62
  '/**/' + slashNormalized;
63
63
  });
64
64
  }
@@ -4,7 +4,7 @@ exports.register = void 0;
4
4
  const PConst = require("../protocol.const");
5
5
  const modifiers_1 = require("../utils/modifiers");
6
6
  const typeConverters = require("../utils/typeConverters");
7
- const path_1 = require("path");
7
+ const path = require("path-browserify");
8
8
  const shared_1 = require("../shared");
9
9
  function register(ctx) {
10
10
  function doPrepare(uri, position) {
@@ -55,8 +55,8 @@ function register(ctx) {
55
55
  const rootPath = ctx.typescript.languageService.getProgram()?.getCompilerOptions().rootDir ?? '';
56
56
  const document = ctx.getTextDocument(ctx.env.fileNameToUri(item.file)); // TODO
57
57
  const useFileName = isSourceFileItem(item);
58
- const name = useFileName ? path_1.posix.basename(item.file) : item.name;
59
- const detail = useFileName ? path_1.posix.relative(rootPath, path_1.posix.dirname(item.file)) : item.containerName ?? '';
58
+ const name = useFileName ? path.basename(item.file) : item.name;
59
+ const detail = useFileName ? path.relative(rootPath, path.dirname(item.file)) : item.containerName ?? '';
60
60
  const result = {
61
61
  kind: typeConverters.SymbolKind.fromProtocolScriptElementKind(item.kind),
62
62
  name,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fileTextChangesToWorkspaceEdit = exports.register = void 0;
4
- const path_1 = require("path");
4
+ const path = require("path-browserify");
5
5
  const prepareRename_1 = require("./prepareRename");
6
6
  const getFormatCodeSettings_1 = require("../configs/getFormatCodeSettings");
7
7
  const getUserPreferences_1 = require("../configs/getUserPreferences");
@@ -32,11 +32,11 @@ function register(ctx) {
32
32
  };
33
33
  function renameFile(fileToRename, newName, formatOptions, preferences) {
34
34
  // Make sure we preserve file extension if none provided
35
- if (!path_1.posix.extname(newName)) {
36
- newName += path_1.posix.extname(fileToRename);
35
+ if (!path.extname(newName)) {
36
+ newName += path.extname(fileToRename);
37
37
  }
38
- const dirname = path_1.posix.dirname(fileToRename);
39
- const newFilePath = path_1.posix.join(dirname, newName);
38
+ const dirname = path.dirname(fileToRename);
39
+ const newFilePath = path.join(dirname, newName);
40
40
  const response = ctx.typescript.languageService.getEditsForFileRename(fileToRename, newFilePath, formatOptions, preferences);
41
41
  const edits = fileTextChangesToWorkspaceEdit(response, ctx);
42
42
  if (!edits.documentChanges) {
package/out/index.js CHANGED
@@ -73,7 +73,7 @@ function create() {
73
73
  }
74
74
  const ts = modules.typescript;
75
75
  const sys = (0, typescript_1.createSys)(ts, context.env);
76
- const languageServiceHost = (0, typescript_1.createLanguageServiceHost)(context, ts, sys, context.env);
76
+ const languageServiceHost = (0, typescript_1.createLanguageServiceHost)(context, ts, sys);
77
77
  const created = tsFaster.createLanguageService(ts, sys, languageServiceHost, proxiedHost => ts.createLanguageService(proxiedHost, (0, typescript_1.getDocumentRegistry)(ts, sys.useCaseSensitiveFileNames, context.host.workspacePath)));
78
78
  const { languageService } = created;
79
79
  if (created.setPreferences && context.env.getConfiguration) {
@@ -1,5 +1,5 @@
1
1
  import type * as ts from 'typescript/lib/tsserverlibrary';
2
2
  export declare namespace SymbolKind {
3
- function fromProtocolScriptElementKind(kind: ts.ScriptElementKind): 2 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 15 | 22 | 26;
3
+ function fromProtocolScriptElementKind(kind: ts.ScriptElementKind): 2 | 5 | 10 | 22 | 11 | 6 | 7 | 13 | 12 | 9 | 26 | 15;
4
4
  }
5
5
  //# sourceMappingURL=typeConverters.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volar-service-typescript",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "description": "Integrate TypeScript into Volar",
5
5
  "homepage": "https://github.com/volarjs/services/tree/master/packages/typescript",
6
6
  "bugs": "https://github.com/volarjs/services/issues",
@@ -25,10 +25,12 @@
25
25
  "url": "https://github.com/johnsoncodehk"
26
26
  },
27
27
  "devDependencies": {
28
+ "@types/path-browserify": "latest",
28
29
  "@types/semver": "^7.5.4",
29
30
  "@volar/typescript": "latest"
30
31
  },
31
32
  "dependencies": {
33
+ "path-browserify": "^1.0.1",
32
34
  "semver": "^7.5.4",
33
35
  "typescript-auto-import-cache": "^0.3.0",
34
36
  "vscode-languageserver-textdocument": "^1.0.11",
@@ -44,5 +46,5 @@
44
46
  "optional": true
45
47
  }
46
48
  },
47
- "gitHead": "3a59378715a959b433ca65700d2515d708469388"
49
+ "gitHead": "fdcd47eb5dc865999ac7ac610f8e0dfb458aca04"
48
50
  }