@volar/language-server 1.0.16 → 1.0.18

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.
Files changed (64) hide show
  1. package/out/{utils/webFileSystemHost.d.ts → browser/fileSystems.d.ts} +0 -0
  2. package/out/{utils/webFileSystemHost.js → browser/fileSystems.js} +4 -4
  3. package/out/{browser.d.ts → browser/index.d.ts} +2 -2
  4. package/out/{browser.js → browser/index.js} +32 -28
  5. package/out/{utils/ts → browser/typescript}/core.d.ts +0 -0
  6. package/out/{utils/ts → browser/typescript}/core.js +0 -0
  7. package/out/{utils/ts → browser/typescript}/corePublic.d.ts +0 -0
  8. package/out/{utils/ts → browser/typescript}/corePublic.js +0 -0
  9. package/out/{utils/ts → browser/typescript}/path.d.ts +0 -0
  10. package/out/{utils/ts → browser/typescript}/path.js +0 -0
  11. package/out/{utils/ts → browser/typescript}/types.d.ts +0 -0
  12. package/out/{utils/ts → browser/typescript}/types.js +0 -0
  13. package/out/{utils/ts → browser/typescript}/utilities.d.ts +0 -0
  14. package/out/{utils/ts → browser/typescript}/utilities.js +0 -0
  15. package/out/{utils → common}/cancellationPipe.d.ts +0 -0
  16. package/out/{utils → common}/cancellationPipe.js +0 -0
  17. package/out/{utils → common}/configurationHost.d.ts +1 -1
  18. package/out/{utils → common}/configurationHost.js +7 -5
  19. package/out/{utils/snapshots.d.ts → common/documents.d.ts} +1 -1
  20. package/out/{utils/snapshots.js → common/documents.js} +5 -5
  21. package/out/{features → common/features}/customFeatures.d.ts +1 -1
  22. package/out/{features → common/features}/customFeatures.js +20 -42
  23. package/out/common/features/documentFeatures.d.ts +4 -0
  24. package/out/{features → common/features}/documentFeatures.js +1 -1
  25. package/out/common/features/languageFeatures.d.ts +4 -0
  26. package/out/{features → common/features}/languageFeatures.js +4 -5
  27. package/out/{utils → common}/project.d.ts +14 -9
  28. package/out/{utils → common}/project.js +24 -16
  29. package/out/{schemaRequestHandlers → common/schemaRequestHandlers}/file.d.ts +0 -0
  30. package/out/{schemaRequestHandlers → common/schemaRequestHandlers}/file.js +0 -0
  31. package/out/{schemaRequestHandlers → common/schemaRequestHandlers}/http.d.ts +0 -0
  32. package/out/{schemaRequestHandlers → common/schemaRequestHandlers}/http.js +0 -0
  33. package/out/common/server.d.ts +8 -0
  34. package/out/{server.js → common/server.js} +94 -34
  35. package/out/{utils/documentServiceHost.d.ts → common/syntaxServicesHost.d.ts} +2 -2
  36. package/out/{utils/documentServiceHost.js → common/syntaxServicesHost.js} +10 -10
  37. package/out/{utils → common/utils}/inferredCompilerOptions.d.ts +0 -0
  38. package/out/{utils → common/utils}/inferredCompilerOptions.js +0 -0
  39. package/out/{registerFeatures.d.ts → common/utils/registerFeatures.d.ts} +2 -3
  40. package/out/{registerFeatures.js → common/utils/registerFeatures.js} +5 -48
  41. package/out/{utils/config.d.ts → common/utils/serverConfig.d.ts} +0 -0
  42. package/out/{utils/config.js → common/utils/serverConfig.js} +1 -1
  43. package/out/{utils → common/utils}/uriMap.d.ts +0 -0
  44. package/out/{utils → common/utils}/uriMap.js +0 -0
  45. package/out/common/workspace.d.ts +1186 -0
  46. package/out/{utils/workspaceProjects.js → common/workspace.js} +29 -13
  47. package/out/common/workspaces.d.ts +1465 -0
  48. package/out/{utils → common}/workspaces.js +15 -10
  49. package/out/{utils/nodeFileSystemHost.d.ts → node/fileSystem.d.ts} +0 -0
  50. package/out/{utils/nodeFileSystemHost.js → node/fileSystem.js} +17 -19
  51. package/out/{node.d.ts → node/index.d.ts} +2 -2
  52. package/out/node/index.js +107 -0
  53. package/out/protocol.d.ts +4 -6
  54. package/out/protocol.js +1 -5
  55. package/out/types.d.ts +5 -3
  56. package/package.json +5 -5
  57. package/out/features/documentFeatures.d.ts +0 -4
  58. package/out/features/languageFeatures.d.ts +0 -4
  59. package/out/node.js +0 -103
  60. package/out/server.d.ts +0 -3
  61. package/out/utils/iterableWeakSet.d.ts +0 -7
  62. package/out/utils/iterableWeakSet.js +0 -40
  63. package/out/utils/workspaceProjects.d.ts +0 -162
  64. package/out/utils/workspaces.d.ts +0 -429
@@ -12,9 +12,11 @@ exports.createWorkspaces = void 0;
12
12
  const shared = require("@volar/shared");
13
13
  const vscode = require("vscode-languageserver");
14
14
  const types_1 = require("../types");
15
- const workspaceProjects_1 = require("./workspaceProjects");
16
- function createWorkspaces(runtimeEnv, plugins, fsHost, configurationHost, ts, tsLocalized, client, options, documents, connection, cancelTokenHost) {
15
+ const workspace_1 = require("./workspace");
16
+ function createWorkspaces(params) {
17
17
  var _a;
18
+ const { fileSystemHost, configurationHost, initParams, initOptions, documents, cancelTokenHost } = params;
19
+ const { connection, runtimeEnv } = params.server;
18
20
  let semanticTokensReq = 0;
19
21
  let documentUpdatedReq = 0;
20
22
  const workspaces = new Map();
@@ -24,8 +26,8 @@ function createWorkspaces(runtimeEnv, plugins, fsHost, configurationHost, ts, ts
24
26
  documents.onDidClose(params => {
25
27
  connection.sendDiagnostics({ uri: params.textDocument.uri, diagnostics: [] });
26
28
  });
27
- fsHost.onDidChangeWatchedFiles(params => {
28
- const tsConfigChanges = params.changes.filter(change => workspaceProjects_1.rootTsConfigNames.includes(change.uri.substring(change.uri.lastIndexOf('/') + 1)));
29
+ fileSystemHost.onDidChangeWatchedFiles(params => {
30
+ const tsConfigChanges = params.changes.filter(change => workspace_1.rootTsConfigNames.includes(change.uri.substring(change.uri.lastIndexOf('/') + 1)));
29
31
  if (tsConfigChanges.length) {
30
32
  reloadDiagnostics();
31
33
  }
@@ -42,7 +44,10 @@ function createWorkspaces(runtimeEnv, plugins, fsHost, configurationHost, ts, ts
42
44
  reloadProject,
43
45
  add: (rootUri) => {
44
46
  if (!workspaces.has(rootUri.toString())) {
45
- workspaces.set(rootUri.toString(), (0, workspaceProjects_1.createWorkspaceProjects)(runtimeEnv, plugins, fsHost, rootUri, ts, tsLocalized, documents, configurationHost, cancelTokenHost, options));
47
+ workspaces.set(rootUri.toString(), (0, workspace_1.createWorkspace)({
48
+ workspaces: params,
49
+ rootUri,
50
+ }));
46
51
  }
47
52
  },
48
53
  remove: (rootUri) => {
@@ -56,7 +61,7 @@ function createWorkspaces(runtimeEnv, plugins, fsHost, configurationHost, ts, ts
56
61
  };
57
62
  function reloadProject() {
58
63
  return __awaiter(this, void 0, void 0, function* () {
59
- fsHost.clearCache();
64
+ fileSystemHost.reload();
60
65
  for (const [_, workspace] of workspaces) {
61
66
  (yield workspace).reload();
62
67
  }
@@ -75,10 +80,10 @@ function createWorkspaces(runtimeEnv, plugins, fsHost, configurationHost, ts, ts
75
80
  const req = ++semanticTokensReq;
76
81
  yield updateDiagnostics();
77
82
  if (req === semanticTokensReq) {
78
- if ((_a = client.textDocument) === null || _a === void 0 ? void 0 : _a.semanticTokens) {
83
+ if ((_a = initParams.capabilities.textDocument) === null || _a === void 0 ? void 0 : _a.semanticTokens) {
79
84
  connection.languages.semanticTokens.refresh();
80
85
  }
81
- if ((_b = client.textDocument) === null || _b === void 0 ? void 0 : _b.inlayHint) {
86
+ if ((_b = initParams.capabilities.textDocument) === null || _b === void 0 ? void 0 : _b.inlayHint) {
82
87
  connection.languages.inlayHint.refresh();
83
88
  }
84
89
  }
@@ -87,7 +92,7 @@ function createWorkspaces(runtimeEnv, plugins, fsHost, configurationHost, ts, ts
87
92
  function updateDiagnostics(docUri) {
88
93
  var _a, _b;
89
94
  return __awaiter(this, void 0, void 0, function* () {
90
- if (((_a = options.diagnosticModel) !== null && _a !== void 0 ? _a : types_1.DiagnosticModel.Push) !== types_1.DiagnosticModel.Push)
95
+ if (((_a = initOptions.diagnosticModel) !== null && _a !== void 0 ? _a : types_1.DiagnosticModel.Push) !== types_1.DiagnosticModel.Push)
91
96
  return;
92
97
  const req = ++documentUpdatedReq;
93
98
  const delay = (_b = yield (configurationHost === null || configurationHost === void 0 ? void 0 : configurationHost.getConfiguration('volar.diagnostics.delay'))) !== null && _b !== void 0 ? _b : 200;
@@ -141,7 +146,7 @@ function createWorkspaces(runtimeEnv, plugins, fsHost, configurationHost, ts, ts
141
146
  return __awaiter(this, void 0, void 0, function* () {
142
147
  const rootUris = [...workspaces.keys()]
143
148
  .filter(rootUri => shared.isFileInDir(shared.getPathOfUri(uri), shared.getPathOfUri(rootUri)))
144
- .sort((a, b) => (0, workspaceProjects_1.sortTsConfigs)(shared.getPathOfUri(uri), shared.getPathOfUri(a), shared.getPathOfUri(b)));
149
+ .sort((a, b) => (0, workspace_1.sortTsConfigs)(shared.getPathOfUri(uri), shared.getPathOfUri(a), shared.getPathOfUri(b)));
145
150
  for (const rootUri of rootUris) {
146
151
  const workspace = yield workspaces.get(rootUri);
147
152
  const project = yield (workspace === null || workspace === void 0 ? void 0 : workspace.getProjectAndTsConfig(uri));
@@ -9,22 +9,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.createNodeFileSystemHost = void 0;
12
- const vscode = require("vscode-languageserver");
13
- const iterableWeakSet_1 = require("./iterableWeakSet");
14
- const uriMap_1 = require("./uriMap");
15
12
  const shared = require("@volar/shared");
13
+ const vscode = require("vscode-languageserver");
14
+ const uriMap_1 = require("../common/utils/uriMap");
16
15
  let currentCwd = '';
17
16
  function createNodeFileSystemHost(ts, capabilities) {
18
17
  const instances = (0, uriMap_1.createUriMap)();
19
18
  const onDidChangeWatchedFilesCb = new Set();
20
- const caches = new iterableWeakSet_1.IterableWeakSet();
21
19
  return {
22
20
  ready(connection) {
23
21
  connection.onDidChangeWatchedFiles((params) => __awaiter(this, void 0, void 0, function* () {
24
22
  if (params.changes.some(change => change.type === vscode.FileChangeType.Created || change.type === vscode.FileChangeType.Deleted)) {
25
- caches.forEach(cache => {
26
- cache.clear();
27
- });
23
+ for (const sys of instances.values()) {
24
+ sys[1].forEach(cache => cache.clear());
25
+ }
28
26
  }
29
27
  for (const cb of [...onDidChangeWatchedFilesCb]) {
30
28
  if (onDidChangeWatchedFilesCb.has(cb)) {
@@ -33,25 +31,25 @@ function createNodeFileSystemHost(ts, capabilities) {
33
31
  }
34
32
  }));
35
33
  },
36
- clearCache() {
37
- caches.forEach(cache => {
38
- cache.clear();
39
- });
34
+ reload() {
35
+ for (const sys of instances.values()) {
36
+ sys[1].forEach(cache => cache.clear());
37
+ }
40
38
  },
41
39
  getWorkspaceFileSystem(rootUri) {
42
40
  let sys = instances.uriGet(rootUri.toString());
43
41
  if (!sys) {
44
- sys = createWorkspaceFileSystem(rootUri);
42
+ sys = createWorkspaceFileSystem(ts, capabilities, rootUri);
45
43
  instances.uriSet(rootUri.toString(), sys);
46
44
  }
47
- return sys;
45
+ return sys[0];
48
46
  },
49
47
  onDidChangeWatchedFiles: cb => {
50
48
  onDidChangeWatchedFilesCb.add(cb);
51
49
  return () => onDidChangeWatchedFilesCb.delete(cb);
52
50
  },
53
51
  };
54
- function createWorkspaceFileSystem(rootUri) {
52
+ function createWorkspaceFileSystem(ts, capabilities, rootUri) {
55
53
  var _a;
56
54
  const rootPath = shared.getPathOfUri(rootUri.toString());
57
55
  const workspaceSys = new Proxy(ts.sys, {
@@ -61,7 +59,9 @@ function createNodeFileSystemHost(ts, capabilities) {
61
59
  return new Proxy(fn, {
62
60
  apply(target, thisArg, args) {
63
61
  if (currentCwd !== rootPath) {
64
- process.chdir(rootPath);
62
+ if (ts.sys.directoryExists(rootPath)) { // #2234, #2039
63
+ process.chdir(rootPath);
64
+ }
65
65
  currentCwd = rootPath;
66
66
  }
67
67
  return target.apply(thisArg, args);
@@ -97,10 +97,8 @@ function createNodeFileSystemHost(ts, capabilities) {
97
97
  },
98
98
  })
99
99
  : workspaceSys;
100
- caches.add(fileExistsCache);
101
- caches.add(directoryExistsCache);
102
- return sys;
100
+ return [sys, [fileExistsCache, directoryExistsCache]];
103
101
  }
104
102
  }
105
103
  exports.createNodeFileSystemHost = createNodeFileSystemHost;
106
- //# sourceMappingURL=nodeFileSystemHost.js.map
104
+ //# sourceMappingURL=fileSystem.js.map
@@ -1,3 +1,3 @@
1
- import { LanguageServerPlugin } from './types';
1
+ import { LanguageServerPlugin } from '../types';
2
+ export * from '../index';
2
3
  export declare function createLanguageServer(plugins: LanguageServerPlugin[]): void;
3
- export * from './index';
@@ -0,0 +1,107 @@
1
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2
+ if (k2 === undefined) k2 = k;
3
+ var desc = Object.getOwnPropertyDescriptor(m, k);
4
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5
+ desc = { enumerable: true, get: function() { return m[k]; } };
6
+ }
7
+ Object.defineProperty(o, k2, desc);
8
+ }) : (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ o[k2] = m[k];
11
+ }));
12
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
13
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
14
+ };
15
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
+ return new (P || (P = Promise))(function (resolve, reject) {
18
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
22
+ });
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.createLanguageServer = void 0;
26
+ const shared = require("@volar/shared");
27
+ const fs = require("fs");
28
+ const request_light_1 = require("request-light");
29
+ const html = require("vscode-html-languageservice");
30
+ const vscode = require("vscode-languageserver/node");
31
+ const server_1 = require("../common/server");
32
+ const file_1 = require("../common/schemaRequestHandlers/file");
33
+ const http_1 = require("../common/schemaRequestHandlers/http");
34
+ const fileSystem_1 = require("./fileSystem");
35
+ __exportStar(require("../index"), exports);
36
+ function createLanguageServer(plugins) {
37
+ const connection = vscode.createConnection(vscode.ProposedFeatures.all);
38
+ (0, server_1.createCommonLanguageServer)({
39
+ plugins,
40
+ connection,
41
+ runtimeEnv: {
42
+ loadTypescript(tsdk) {
43
+ for (const name of ['./typescript.js', './tsserverlibrary.js', './tsserver.js']) {
44
+ try {
45
+ const path = require.resolve(name, { paths: [tsdk] });
46
+ return require(path);
47
+ }
48
+ catch (_a) { }
49
+ }
50
+ },
51
+ loadTypescriptLocalized(tsdk, locale) {
52
+ return __awaiter(this, void 0, void 0, function* () {
53
+ try {
54
+ const path = require.resolve(`./${locale}/diagnosticMessages.generated.json`, { paths: [tsdk] });
55
+ return require(path);
56
+ }
57
+ catch (_a) { }
58
+ });
59
+ },
60
+ schemaRequestHandlers: {
61
+ file: file_1.default,
62
+ http: http_1.default,
63
+ https: http_1.default,
64
+ },
65
+ onDidChangeConfiguration(settings) {
66
+ (0, request_light_1.configure)(settings.http && settings.http.proxy, settings.http && settings.http.proxyStrictSSL);
67
+ },
68
+ createFileSystemHost: fileSystem_1.createNodeFileSystemHost,
69
+ fileSystemProvide: {
70
+ stat: (uri) => {
71
+ return new Promise((resolve, reject) => {
72
+ fs.stat(shared.getPathOfUri(uri), (err, stats) => {
73
+ if (stats) {
74
+ resolve({
75
+ type: stats.isFile() ? html.FileType.File
76
+ : stats.isDirectory() ? html.FileType.Directory
77
+ : stats.isSymbolicLink() ? html.FileType.SymbolicLink
78
+ : html.FileType.Unknown,
79
+ ctime: stats.ctimeMs,
80
+ mtime: stats.mtimeMs,
81
+ size: stats.size,
82
+ });
83
+ }
84
+ else {
85
+ reject(err);
86
+ }
87
+ });
88
+ });
89
+ },
90
+ readDirectory: (uri) => {
91
+ return new Promise((resolve, reject) => {
92
+ fs.readdir(shared.getPathOfUri(uri), (err, files) => {
93
+ if (files) {
94
+ resolve(files.map(file => [file, html.FileType.File]));
95
+ }
96
+ else {
97
+ reject(err);
98
+ }
99
+ });
100
+ });
101
+ },
102
+ },
103
+ },
104
+ });
105
+ }
106
+ exports.createLanguageServer = createLanguageServer;
107
+ //# sourceMappingURL=index.js.map
package/out/protocol.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as vscode from 'vscode-languageserver-protocol';
2
2
  import type * as html from 'vscode-html-languageservice';
3
+ import type { FileRangeCapabilities } from '@volar/language-core';
3
4
  /**
4
5
  * Server request client
5
6
  */
@@ -52,9 +53,6 @@ export declare namespace AutoInsertRequest {
52
53
  type ErrorType = never;
53
54
  const type: vscode.RequestType<ParamsType, ResponseType, never>;
54
55
  }
55
- export declare namespace VerifyAllScriptsNotification {
56
- const type: vscode.NotificationType<vscode.TextDocumentIdentifier>;
57
- }
58
56
  export declare namespace WriteVirtualFilesNotification {
59
57
  const type: vscode.NotificationType<vscode.TextDocumentIdentifier>;
60
58
  }
@@ -74,11 +72,11 @@ export declare namespace GetVirtualFileRequest {
74
72
  };
75
73
  type ResponseType = {
76
74
  content: string;
77
- mappings: {
75
+ mappings: Record<string, {
78
76
  sourceRange: [number, number];
79
77
  generatedRange: [number, number];
80
- data: undefined;
81
- }[];
78
+ data: FileRangeCapabilities;
79
+ }[]>;
82
80
  };
83
81
  type ErrorType = never;
84
82
  const type: vscode.RequestType<ParamsType, ResponseType, never>;
package/out/protocol.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.ReportStats = exports.GetVirtualFileRequest = exports.GetVirtualFileNamesRequest = exports.ReloadProjectNotification = exports.WriteVirtualFilesNotification = exports.VerifyAllScriptsNotification = exports.AutoInsertRequest = exports.GetMatchTsConfigRequest = exports.FindFileReferenceRequest = exports.FsReadDirectoryRequest = exports.FsReadFileRequest = exports.FsStatRequest = exports.ShowReferencesNotification = void 0;
2
+ exports.ReportStats = exports.GetVirtualFileRequest = exports.GetVirtualFileNamesRequest = exports.ReloadProjectNotification = exports.WriteVirtualFilesNotification = exports.AutoInsertRequest = exports.GetMatchTsConfigRequest = exports.FindFileReferenceRequest = exports.FsReadDirectoryRequest = exports.FsReadFileRequest = exports.FsStatRequest = exports.ShowReferencesNotification = void 0;
3
3
  const vscode = require("vscode-languageserver-protocol");
4
4
  /**
5
5
  * Server request client
@@ -35,10 +35,6 @@ var AutoInsertRequest;
35
35
  (function (AutoInsertRequest) {
36
36
  AutoInsertRequest.type = new vscode.RequestType('vue/autoInsert');
37
37
  })(AutoInsertRequest = exports.AutoInsertRequest || (exports.AutoInsertRequest = {}));
38
- var VerifyAllScriptsNotification;
39
- (function (VerifyAllScriptsNotification) {
40
- VerifyAllScriptsNotification.type = new vscode.NotificationType('volar.action.verifyAllScripts');
41
- })(VerifyAllScriptsNotification = exports.VerifyAllScriptsNotification || (exports.VerifyAllScriptsNotification = {}));
42
38
  var WriteVirtualFilesNotification;
43
39
  (function (WriteVirtualFilesNotification) {
44
40
  WriteVirtualFilesNotification.type = new vscode.NotificationType('volar.action.writeVirtualFiles');
package/out/types.d.ts CHANGED
@@ -4,12 +4,10 @@ import * as embedded from '@volar/language-core';
4
4
  import type { FileSystemProvider } from 'vscode-html-languageservice';
5
5
  import type * as ts from 'typescript/lib/tsserverlibrary';
6
6
  import * as vscode from 'vscode-languageserver';
7
- import type * as Requests from './protocol';
8
7
  import { URI } from 'vscode-uri';
9
- export declare let __requests: typeof Requests;
10
8
  export type FileSystemHost = {
11
9
  ready(connection: vscode.Connection): void;
12
- clearCache(): void;
10
+ reload(): void;
13
11
  getWorkspaceFileSystem(rootUri: URI): FileSystem;
14
12
  onDidChangeWatchedFiles(cb: (params: vscode.DidChangeWatchedFilesParams) => void): () => void;
15
13
  };
@@ -68,4 +66,8 @@ export interface LanguageServerInitializationOptions {
68
66
  respectClientCapabilities?: boolean;
69
67
  maxFileSize?: number;
70
68
  configFilePath?: string;
69
+ /**
70
+ * Extra semantic token types and modifiers that are supported by the client.
71
+ */
72
+ semanticTokensLegend?: vscode.SemanticTokensLegend;
71
73
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volar/language-server",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "main": "out/index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -17,9 +17,9 @@
17
17
  "directory": "packages/language-server"
18
18
  },
19
19
  "dependencies": {
20
- "@volar/language-core": "1.0.16",
21
- "@volar/language-service": "1.0.16",
22
- "@volar/shared": "1.0.16",
20
+ "@volar/language-core": "1.0.18",
21
+ "@volar/language-service": "1.0.18",
22
+ "@volar/shared": "1.0.18",
23
23
  "request-light": "^0.6.0",
24
24
  "typesafe-path": "^0.2.2",
25
25
  "vscode-html-languageservice": "^5.0.3",
@@ -28,5 +28,5 @@
28
28
  "vscode-languageserver-textdocument": "^1.0.8",
29
29
  "vscode-uri": "^3.0.7"
30
30
  },
31
- "gitHead": "af476047d8859652254ed36f8aee184f1972a97a"
31
+ "gitHead": "f102ee7bfc96792c63746a5dcb9742e3346d5cc7"
32
32
  }
@@ -1,4 +0,0 @@
1
- import type * as vscode from 'vscode-languageserver';
2
- import { createSnapshots } from '../utils/snapshots';
3
- import { createDocumentServiceHost } from '../utils/documentServiceHost';
4
- export declare function register(connection: vscode.Connection, documents: ReturnType<typeof createSnapshots>, documentServiceHost: ReturnType<typeof createDocumentServiceHost>): void;
@@ -1,4 +0,0 @@
1
- import * as vscode from 'vscode-languageserver';
2
- import { CancellationTokenHost } from '../utils/cancellationPipe';
3
- import type { Workspaces } from '../utils/workspaces';
4
- export declare function register(connection: vscode.Connection, projects: Workspaces, initParams: vscode.InitializeParams, cancelHost: CancellationTokenHost): void;
package/out/node.js DELETED
@@ -1,103 +0,0 @@
1
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2
- if (k2 === undefined) k2 = k;
3
- var desc = Object.getOwnPropertyDescriptor(m, k);
4
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5
- desc = { enumerable: true, get: function() { return m[k]; } };
6
- }
7
- Object.defineProperty(o, k2, desc);
8
- }) : (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- o[k2] = m[k];
11
- }));
12
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
13
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
14
- };
15
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
- return new (P || (P = Promise))(function (resolve, reject) {
18
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
- step((generator = generator.apply(thisArg, _arguments || [])).next());
22
- });
23
- };
24
- Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.createLanguageServer = void 0;
26
- const shared = require("@volar/shared");
27
- const fs = require("fs");
28
- const request_light_1 = require("request-light");
29
- const html = require("vscode-html-languageservice");
30
- const vscode = require("vscode-languageserver/node");
31
- const server_1 = require("./server");
32
- const file_1 = require("./schemaRequestHandlers/file");
33
- const http_1 = require("./schemaRequestHandlers/http");
34
- const nodeFileSystemHost_1 = require("./utils/nodeFileSystemHost");
35
- function createLanguageServer(plugins) {
36
- const connection = vscode.createConnection(vscode.ProposedFeatures.all);
37
- (0, server_1.createCommonLanguageServer)(connection, {
38
- loadTypescript(tsdk) {
39
- for (const name of ['./typescript.js', './tsserverlibrary.js', './tsserver.js']) {
40
- try {
41
- const path = require.resolve(name, { paths: [tsdk] });
42
- return require(path);
43
- }
44
- catch (_a) { }
45
- }
46
- },
47
- loadTypescriptLocalized(tsdk, locale) {
48
- return __awaiter(this, void 0, void 0, function* () {
49
- try {
50
- const path = require.resolve(`./${locale}/diagnosticMessages.generated.json`, { paths: [tsdk] });
51
- return require(path);
52
- }
53
- catch (_a) { }
54
- });
55
- },
56
- schemaRequestHandlers: {
57
- file: file_1.default,
58
- http: http_1.default,
59
- https: http_1.default,
60
- },
61
- onDidChangeConfiguration(settings) {
62
- (0, request_light_1.configure)(settings.http && settings.http.proxy, settings.http && settings.http.proxyStrictSSL);
63
- },
64
- createFileSystemHost: nodeFileSystemHost_1.createNodeFileSystemHost,
65
- fileSystemProvide: {
66
- stat: (uri) => {
67
- return new Promise((resolve, reject) => {
68
- fs.stat(shared.getPathOfUri(uri), (err, stats) => {
69
- if (stats) {
70
- resolve({
71
- type: stats.isFile() ? html.FileType.File
72
- : stats.isDirectory() ? html.FileType.Directory
73
- : stats.isSymbolicLink() ? html.FileType.SymbolicLink
74
- : html.FileType.Unknown,
75
- ctime: stats.ctimeMs,
76
- mtime: stats.mtimeMs,
77
- size: stats.size,
78
- });
79
- }
80
- else {
81
- reject(err);
82
- }
83
- });
84
- });
85
- },
86
- readDirectory: (uri) => {
87
- return new Promise((resolve, reject) => {
88
- fs.readdir(shared.getPathOfUri(uri), (err, files) => {
89
- if (files) {
90
- resolve(files.map(file => [file, html.FileType.File]));
91
- }
92
- else {
93
- reject(err);
94
- }
95
- });
96
- });
97
- },
98
- },
99
- }, plugins);
100
- }
101
- exports.createLanguageServer = createLanguageServer;
102
- __exportStar(require("./index"), exports);
103
- //# sourceMappingURL=node.js.map
package/out/server.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import * as vscode from 'vscode-languageserver';
2
- import { LanguageServerPlugin, RuntimeEnvironment } from './types';
3
- export declare function createCommonLanguageServer(connection: vscode.Connection, runtimeEnv: RuntimeEnvironment, _plugins: LanguageServerPlugin[]): void;
@@ -1,7 +0,0 @@
1
- export declare class IterableWeakSet<T extends object> extends Set {
2
- adds: WeakSet<object>;
3
- add(el: T): this;
4
- forEach(fn: (el: T, el2: T, set: Set<any>) => void): void;
5
- get size(): number;
6
- [Symbol.iterator](): Generator<any, void, unknown>;
7
- }
@@ -1,40 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.IterableWeakSet = void 0;
3
- class IterableWeakSet extends Set {
4
- constructor() {
5
- super(...arguments);
6
- this.adds = new WeakSet();
7
- }
8
- add(el) {
9
- if (!this.adds.has(el)) {
10
- this.adds.add(el);
11
- super.add(new WeakRef(el));
12
- }
13
- return this;
14
- }
15
- forEach(fn) {
16
- super.forEach(ref => {
17
- const value = ref.deref();
18
- if (value)
19
- fn(value, value, this);
20
- });
21
- }
22
- get size() {
23
- let _size = 0;
24
- super.forEach(ref => {
25
- const value = ref.deref();
26
- if (value)
27
- _size++;
28
- });
29
- return _size;
30
- }
31
- *[Symbol.iterator]() {
32
- for (const ref of super.values()) {
33
- const value = ref.deref();
34
- if (value)
35
- yield value;
36
- }
37
- }
38
- }
39
- exports.IterableWeakSet = IterableWeakSet;
40
- //# sourceMappingURL=iterableWeakSet.js.map