@volar/language-service 2.0.0-alpha.2 → 2.0.0-alpha.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.
@@ -16,4 +16,4 @@ export declare const errorMarkups: Record<string, {
16
16
  error: vscode.Diagnostic;
17
17
  markup: vscode.MarkupContent;
18
18
  }[]>;
19
- export declare function register(context: ServiceContext): (uri: string, mode: 'all' | 'semantic' | 'syntactic', token?: vscode.CancellationToken, response?: ((result: vscode.Diagnostic[]) => void) | undefined) => Promise<vscode.Diagnostic[]>;
19
+ export declare function register(context: ServiceContext): (uri: string, token?: vscode.CancellationToken, response?: ((result: vscode.Diagnostic[]) => void) | undefined) => Promise<vscode.Diagnostic[]>;
@@ -88,7 +88,7 @@ function register(context) {
88
88
  syntax_rules: new Map(),
89
89
  format_rules: new Map(),
90
90
  };
91
- return async (uri, mode, token = cancellation_1.NoneCancellationToken, response) => {
91
+ return async (uri, token = cancellation_1.NoneCancellationToken, response) => {
92
92
  const sourceFile = context.language.files.getSourceFile(context.env.uriToFileName(uri));
93
93
  if (!sourceFile)
94
94
  return [];
@@ -125,13 +125,9 @@ function register(context) {
125
125
  }
126
126
  }
127
127
  }
128
- if (mode === 'all' || mode === 'syntactic') {
129
- await worker('provideDiagnostics', cacheMaps.syntactic, lastResponse.syntactic);
130
- }
131
- if (mode === 'all' || mode === 'semantic') {
132
- await doResponse();
133
- await worker('provideSemanticDiagnostics', cacheMaps.semantic, lastResponse.semantic);
134
- }
128
+ await worker('provideDiagnostics', cacheMaps.syntactic, lastResponse.syntactic);
129
+ await doResponse();
130
+ await worker('provideSemanticDiagnostics', cacheMaps.semantic, lastResponse.semantic);
135
131
  return await collectErrors();
136
132
  async function doResponse() {
137
133
  if (errorsUpdated && !updateCacheRangeFailed) {
@@ -42,7 +42,7 @@ function register(context) {
42
42
  && file.mappings[0].lengths[0] === file.snapshot.getLength();
43
43
  if (onTypeParams && !isCodeBlock)
44
44
  continue;
45
- const docMap = createDocMap(file, context.env.fileNameToUri(sourceFile.fileName), sourceFile.languageId, tempSourceSnapshot);
45
+ const docMap = createDocMap(file, sourceFile.fileName, sourceFile.languageId, tempSourceSnapshot);
46
46
  if (!docMap)
47
47
  continue;
48
48
  let embeddedCodeResult;
@@ -194,16 +194,16 @@ function register(context) {
194
194
  }
195
195
  }
196
196
  };
197
- function createDocMap(file, sourceFileUri, sourceLanguageId, _sourceSnapshot) {
198
- const maps = (0, language_core_1.updateVirtualFileMaps)(file, (sourceFileName) => {
199
- if (!sourceFileName) {
200
- return [sourceFileUri, _sourceSnapshot];
197
+ function createDocMap(file, sourceFileName, sourceLanguageId, _sourceSnapshot) {
198
+ const maps = (0, language_core_1.updateVirtualFileMaps)(file, (sourceFileName2) => {
199
+ if (!sourceFileName2) {
200
+ return [sourceFileName, _sourceSnapshot];
201
201
  }
202
202
  });
203
- if (maps.has(sourceFileUri) && maps.get(sourceFileUri)[0] === _sourceSnapshot) {
204
- const map = maps.get(sourceFileUri);
203
+ if (maps.has(sourceFileName) && maps.get(sourceFileName)[0] === _sourceSnapshot) {
204
+ const map = maps.get(sourceFileName);
205
205
  const version = fakeVersion++;
206
- return new documents_1.SourceMapWithDocuments(vscode_languageserver_textdocument_1.TextDocument.create(sourceFileUri, sourceLanguageId ?? (0, language_core_1.resolveCommonLanguageId)(sourceFileUri), version, _sourceSnapshot.getText(0, _sourceSnapshot.getLength())), vscode_languageserver_textdocument_1.TextDocument.create(context.env.fileNameToUri(file.fileName), file.languageId, version, file.snapshot.getText(0, file.snapshot.getLength())), map[1]);
206
+ return new documents_1.SourceMapWithDocuments(vscode_languageserver_textdocument_1.TextDocument.create(context.env.fileNameToUri(sourceFileName), sourceLanguageId ?? (0, language_core_1.resolveCommonLanguageId)(sourceFileName), version, _sourceSnapshot.getText(0, _sourceSnapshot.getLength())), vscode_languageserver_textdocument_1.TextDocument.create(context.env.fileNameToUri(file.fileName), file.languageId, version, file.snapshot.getText(0, file.snapshot.getLength())), map[1]);
207
207
  }
208
208
  }
209
209
  }
@@ -17,7 +17,7 @@ export declare function createLanguageService(language: Language, servicePlugins
17
17
  findDocumentSymbols: (uri: string, token?: vscode.CancellationToken) => Promise<vscode.DocumentSymbol[] | undefined>;
18
18
  findDocumentColors: (uri: string, token?: vscode.CancellationToken) => Promise<vscode.ColorInformation[] | undefined>;
19
19
  getColorPresentations: (uri: string, color: vscode.Color, range: vscode.Range, token?: vscode.CancellationToken) => Promise<vscode.ColorPresentation[] | undefined>;
20
- doValidation: (uri: string, mode: "all" | "semantic" | "syntactic", token?: vscode.CancellationToken, response?: ((result: vscode.Diagnostic[]) => void) | undefined) => Promise<vscode.Diagnostic[]>;
20
+ doValidation: (uri: string, token?: vscode.CancellationToken, response?: ((result: vscode.Diagnostic[]) => void) | undefined) => Promise<vscode.Diagnostic[]>;
21
21
  findReferences: (uri: string, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.Location[] | undefined>;
22
22
  findFileReferences: (uri: string, token?: vscode.CancellationToken) => import("./types").NullableResult<vscode.Location[]>;
23
23
  findDefinition: (uri: string, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.LocationLink[] | undefined>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volar/language-service",
3
- "version": "2.0.0-alpha.2",
3
+ "version": "2.0.0-alpha.3",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -12,10 +12,10 @@
12
12
  "directory": "packages/language-service"
13
13
  },
14
14
  "dependencies": {
15
- "@volar/language-core": "2.0.0-alpha.2",
15
+ "@volar/language-core": "2.0.0-alpha.3",
16
16
  "vscode-languageserver-protocol": "^3.17.5",
17
17
  "vscode-languageserver-textdocument": "^1.0.11",
18
18
  "vscode-uri": "^3.0.8"
19
19
  },
20
- "gitHead": "88e80b9f00541ab9478b9c7b7af213813fc8cb20"
20
+ "gitHead": "0bb685a72cff180bb9b3420aaf3136c8e899c908"
21
21
  }