@volar/language-service 1.0.0-alpha.5 → 1.0.0-beta.0

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.
@@ -4,7 +4,7 @@ import { TextDocument } from 'vscode-languageserver-textdocument';
4
4
  import { EmbeddedLanguageServicePlugin } from './plugin';
5
5
  import { EmbeddedLanguageModule } from '@volar/language-core';
6
6
  import type * as _0 from 'vscode-languageserver-protocol';
7
- export declare type DocumentService = ReturnType<typeof createDocumentService>;
7
+ export type DocumentService = ReturnType<typeof createDocumentService>;
8
8
  export declare function createDocumentServiceContext(options: {
9
9
  ts: typeof import('typescript/lib/tsserverlibrary');
10
10
  getLanguageModules(): EmbeddedLanguageModule[];
@@ -3,7 +3,7 @@ import * as executeCommand from './languageFeatures/executeCommand';
3
3
  import { EmbeddedLanguageServicePlugin } from './plugin';
4
4
  import { LanguageServiceRuntimeContext as LanguageServiceContext, PluginContext } from './types';
5
5
  import type * as _0 from 'vscode-languageserver-protocol';
6
- export declare type LanguageService = ReturnType<typeof createLanguageService>;
6
+ export type LanguageService = ReturnType<typeof createLanguageService>;
7
7
  export declare function createLanguageServiceContext(options: {
8
8
  host: LanguageServiceHost;
9
9
  context: ReturnType<typeof createEmbeddedLanguageServiceHost>;
@@ -4,8 +4,8 @@ import { SourceMapBase } from '@volar/source-map';
4
4
  import * as vscode from 'vscode-languageserver-protocol';
5
5
  import { TextDocument } from 'vscode-languageserver-textdocument';
6
6
  import { URI } from 'vscode-uri';
7
- export declare type SourceFileDocuments = ReturnType<typeof parseSourceFileDocuments>;
8
- export declare type SourceFileDocument = ReturnType<typeof parseSourceFileDocument>;
7
+ export type SourceFileDocuments = ReturnType<typeof parseSourceFileDocuments>;
8
+ export type SourceFileDocument = ReturnType<typeof parseSourceFileDocument>;
9
9
  export declare class SourceMap<Data = undefined> {
10
10
  sourceDocument: TextDocument;
11
11
  mappedDocument: TextDocument;
@@ -24,15 +24,14 @@ function register(context) {
24
24
  var _a;
25
25
  const items = yield ((_a = plugin.callHierarchy) === null || _a === void 0 ? void 0 : _a.prepare(document, position));
26
26
  return items === null || items === void 0 ? void 0 : items.map(item => {
27
- const data = {
28
- uri,
29
- originalItem: item,
30
- pluginId: context.plugins.indexOf(plugin),
31
- sourceMap: sourceMap ? {
32
- embeddedDocumentUri: sourceMap.mappedDocument.uri,
33
- } : undefined,
34
- };
35
- return Object.assign(Object.assign({}, item), { data: data });
27
+ return Object.assign(Object.assign({}, item), { data: {
28
+ uri,
29
+ originalItem: item,
30
+ pluginId: context.plugins.indexOf(plugin),
31
+ sourceMap: sourceMap ? {
32
+ embeddedDocumentUri: sourceMap.mappedDocument.uri,
33
+ } : undefined,
34
+ } });
36
35
  });
37
36
  }), (data, sourceMap) => !sourceMap ? data : data
38
37
  .map(item => { var _a; return (_a = transformCallHierarchyItem(item, [])) === null || _a === void 0 ? void 0 : _a[0]; })
@@ -55,15 +55,14 @@ function register(context) {
55
55
  var _a, _b;
56
56
  const codeActions = yield ((_b = (_a = plugin.codeAction) === null || _a === void 0 ? void 0 : _a.on) === null || _b === void 0 ? void 0 : _b.call(_a, document, arg.range, arg.codeActionContext));
57
57
  return codeActions === null || codeActions === void 0 ? void 0 : codeActions.map(_codeAction => {
58
- const data = {
59
- uri,
60
- originalItem: _codeAction,
61
- pluginId: context.plugins.indexOf(plugin),
62
- sourceMap: sourceMap ? {
63
- embeddedDocumentUri: sourceMap.mappedDocument.uri,
64
- } : undefined,
65
- };
66
- return Object.assign(Object.assign({}, _codeAction), { data: data });
58
+ return Object.assign(Object.assign({}, _codeAction), { data: {
59
+ uri,
60
+ originalItem: _codeAction,
61
+ pluginId: context.plugins.indexOf(plugin),
62
+ sourceMap: sourceMap ? {
63
+ embeddedDocumentUri: sourceMap.mappedDocument.uri,
64
+ } : undefined,
65
+ } });
67
66
  });
68
67
  }), (_codeActions, sourceMap) => _codeActions.map(_codeAction => {
69
68
  if (!sourceMap)
@@ -20,14 +20,12 @@ function register(context) {
20
20
  const codeLens = yield ((_c = (_b = plugin.codeLens) === null || _b === void 0 ? void 0 : _b.on) === null || _c === void 0 ? void 0 : _c.call(_b, document));
21
21
  if (codeLens) {
22
22
  return codeLens.map(item => {
23
- const data = {
24
- uri,
25
- originalItem: item,
26
- pluginId: context.plugins.indexOf(plugin),
27
- };
28
23
  const commandArgs = item.command ? [uri, context.plugins.indexOf(plugin), item.command] : undefined;
29
- const codeLens = Object.assign(Object.assign({}, item), { command: item.command && commandArgs ? Object.assign(Object.assign({}, item.command), { command: executeCommand_1.executePluginCommand, arguments: commandArgs }) : undefined, data: data });
30
- return codeLens;
24
+ return Object.assign(Object.assign({}, item), { command: item.command && commandArgs ? Object.assign(Object.assign({}, item.command), { command: executeCommand_1.executePluginCommand, arguments: commandArgs }) : undefined, data: {
25
+ uri,
26
+ originalItem: item,
27
+ pluginId: context.plugins.indexOf(plugin),
28
+ } });
31
29
  });
32
30
  }
33
31
  }), (data, sourceMap) => data.map(codeLens => {
@@ -35,15 +35,14 @@ function register(context) {
35
35
  continue;
36
36
  }
37
37
  cacheData.list = Object.assign(Object.assign({}, embeddedCompletionList), { items: embeddedCompletionList.items.map(item => {
38
- const data = {
39
- uri,
40
- originalItem: item,
41
- pluginId: context.plugins.indexOf(cacheData.plugin),
42
- sourceMap: {
43
- embeddedDocumentUri: sourceMap.mappedDocument.uri,
44
- },
45
- };
46
- return Object.assign(Object.assign({}, (0, transforms_1.transformCompletionItem)(item, embeddedRange => { var _a; return (_a = sourceMap.getSourceRange(embeddedRange.start, embeddedRange.end)) === null || _a === void 0 ? void 0 : _a[0]; })), { data: data });
38
+ return Object.assign(Object.assign({}, (0, transforms_1.transformCompletionItem)(item, embeddedRange => { var _a; return (_a = sourceMap.getSourceRange(embeddedRange.start, embeddedRange.end)) === null || _a === void 0 ? void 0 : _a[0]; })), { data: {
39
+ uri,
40
+ originalItem: item,
41
+ pluginId: context.plugins.indexOf(cacheData.plugin),
42
+ sourceMap: {
43
+ embeddedDocumentUri: sourceMap.mappedDocument.uri,
44
+ },
45
+ } });
47
46
  }) });
48
47
  }
49
48
  }
@@ -56,13 +55,12 @@ function register(context) {
56
55
  continue;
57
56
  }
58
57
  cacheData.list = Object.assign(Object.assign({}, completionList), { items: completionList.items.map(item => {
59
- const data = {
60
- uri,
61
- originalItem: item,
62
- pluginId: context.plugins.indexOf(cacheData.plugin),
63
- sourceMap: undefined,
64
- };
65
- return Object.assign(Object.assign({}, item), { data: data });
58
+ return Object.assign(Object.assign({}, item), { data: {
59
+ uri,
60
+ originalItem: item,
61
+ pluginId: context.plugins.indexOf(cacheData.plugin),
62
+ sourceMap: undefined,
63
+ } });
66
64
  }) });
67
65
  }
68
66
  }
@@ -101,15 +99,14 @@ function register(context) {
101
99
  cache.mainCompletion = { documentUri: sourceMap.mappedDocument.uri };
102
100
  }
103
101
  const completionList = Object.assign(Object.assign({}, embeddedCompletionList), { items: embeddedCompletionList.items.map(item => {
104
- const data = {
105
- uri,
106
- originalItem: item,
107
- pluginId: context.plugins.indexOf(plugin),
108
- sourceMap: {
109
- embeddedDocumentUri: sourceMap.mappedDocument.uri,
110
- }
111
- };
112
- return Object.assign(Object.assign({}, (0, transforms_1.transformCompletionItem)(item, embeddedRange => { var _a; return (_a = sourceMap.getSourceRange(embeddedRange.start, embeddedRange.end)) === null || _a === void 0 ? void 0 : _a[0]; })), { data: data });
102
+ return Object.assign(Object.assign({}, (0, transforms_1.transformCompletionItem)(item, embeddedRange => { var _a; return (_a = sourceMap.getSourceRange(embeddedRange.start, embeddedRange.end)) === null || _a === void 0 ? void 0 : _a[0]; })), { data: {
103
+ uri,
104
+ originalItem: item,
105
+ pluginId: context.plugins.indexOf(plugin),
106
+ sourceMap: {
107
+ embeddedDocumentUri: sourceMap.mappedDocument.uri,
108
+ }
109
+ } });
113
110
  }) });
114
111
  cache.data.push({
115
112
  sourceMap: {
@@ -148,13 +145,12 @@ function register(context) {
148
145
  sourceMap: undefined,
149
146
  plugin,
150
147
  list: Object.assign(Object.assign({}, completionList), { items: completionList.items.map(item => {
151
- const data = {
152
- uri,
153
- originalItem: item,
154
- pluginId: context.plugins.indexOf(plugin),
155
- sourceMap: undefined,
156
- };
157
- return Object.assign(Object.assign({}, item), { data: data });
148
+ return Object.assign(Object.assign({}, item), { data: {
149
+ uri,
150
+ originalItem: item,
151
+ pluginId: context.plugins.indexOf(plugin),
152
+ sourceMap: undefined,
153
+ } });
158
154
  }) }),
159
155
  });
160
156
  }
@@ -2,7 +2,7 @@ import type { LanguageServiceRuntimeContext } from '../types';
2
2
  import { ExecuteCommandContext } from '@volar/language-service';
3
3
  import * as vscode from 'vscode-languageserver-protocol';
4
4
  export declare const executePluginCommand = "volar.executtePluginCommand";
5
- export declare type ExecutePluginCommandArgs = [
5
+ export type ExecutePluginCommandArgs = [
6
6
  string,
7
7
  // uri
8
8
  number | undefined,
package/out/plugin.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import type * as vscode from 'vscode-languageserver-protocol';
2
2
  import type { TextDocument } from 'vscode-languageserver-textdocument';
3
3
  import { PluginContext } from './types';
4
- export declare type NotNullableResult<T> = T | Thenable<T>;
5
- export declare type NullableResult<T> = NotNullableResult<T | undefined | null>;
6
- export declare type SemanticToken = [number, number, number, number, number];
4
+ export type NotNullableResult<T> = T | Thenable<T>;
5
+ export type NullableResult<T> = NotNullableResult<T | undefined | null>;
6
+ export type SemanticToken = [number, number, number, number, number];
7
7
  export interface ExecuteCommandContext {
8
8
  token: vscode.CancellationToken;
9
9
  workDoneProgress: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volar/language-service",
3
- "version": "1.0.0-alpha.5",
3
+ "version": "1.0.0-beta.0",
4
4
  "main": "out/index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -13,14 +13,14 @@
13
13
  "directory": "packages/language-service"
14
14
  },
15
15
  "devDependencies": {
16
- "typescript": "latest"
16
+ "typescript": "beta"
17
17
  },
18
18
  "dependencies": {
19
- "@volar/language-core": "1.0.0-alpha.5",
20
- "@volar/shared": "1.0.0-alpha.5",
21
- "@volar/source-map": "1.0.0-alpha.5",
22
- "@volar/transforms": "1.0.0-alpha.5",
23
- "@volar/typescript-faster": "1.0.0-alpha.5",
19
+ "@volar/language-core": "1.0.0-beta.0",
20
+ "@volar/shared": "1.0.0-beta.0",
21
+ "@volar/source-map": "1.0.0-beta.0",
22
+ "@volar/transforms": "1.0.0-beta.0",
23
+ "@volar/typescript-faster": "1.0.0-beta.0",
24
24
  "@vue/reactivity": "^3.2.38",
25
25
  "upath": "^2.0.1",
26
26
  "vscode-html-languageservice": "^5.0.1",
@@ -29,5 +29,5 @@
29
29
  "vscode-languageserver-textdocument": "^1.0.7",
30
30
  "vscode-uri": "^3.0.3"
31
31
  },
32
- "gitHead": "dd3efd3f7458aca9ba5dcdf549ce80999cb7affd"
32
+ "gitHead": "e93a2cf6e614f6c8fa9b8a61e314c123cbe9a95a"
33
33
  }