@volar/language-service
Advanced tools
Comparing version 2.4.0 to 2.4.1
@@ -55,11 +55,16 @@ "use strict"; | ||
codeActions?.forEach(codeAction => { | ||
codeAction.data = { | ||
uri: uri.toString(), | ||
version: document.version, | ||
original: { | ||
data: codeAction.data, | ||
edit: codeAction.edit, | ||
}, | ||
pluginIndex: context.plugins.indexOf(plugin), | ||
}; | ||
if (plugin[1].resolveCodeAction) { | ||
codeAction.data = { | ||
uri: uri.toString(), | ||
version: document.version, | ||
original: { | ||
data: codeAction.data, | ||
edit: codeAction.edit, | ||
}, | ||
pluginIndex: context.plugins.indexOf(plugin), | ||
}; | ||
} | ||
else { | ||
delete codeAction.data; | ||
} | ||
}); | ||
@@ -66,0 +71,0 @@ if (codeActions && plugin[1].transformCodeAction) { |
@@ -16,10 +16,15 @@ "use strict"; | ||
codeLens?.forEach(codeLens => { | ||
codeLens.data = { | ||
kind: 'normal', | ||
uri: uri.toString(), | ||
original: { | ||
data: codeLens.data, | ||
}, | ||
pluginIndex, | ||
}; | ||
if (plugin[1].resolveCodeLens) { | ||
codeLens.data = { | ||
kind: 'normal', | ||
uri: uri.toString(), | ||
original: { | ||
data: codeLens.data, | ||
}, | ||
pluginIndex, | ||
}; | ||
} | ||
else { | ||
delete codeLens.data; | ||
} | ||
}); | ||
@@ -26,0 +31,0 @@ const ranges = await plugin[1].provideReferencesCodeLensRanges?.(document, token); |
@@ -55,12 +55,17 @@ "use strict"; | ||
for (const item of cacheData.list.items) { | ||
item.data = { | ||
uri: uri.toString(), | ||
original: { | ||
additionalTextEdits: item.additionalTextEdits, | ||
textEdit: item.textEdit, | ||
data: item.data, | ||
}, | ||
pluginIndex: pluginIndex, | ||
embeddedDocumentUri: embeddedDocument.uri, | ||
}; | ||
if (cacheData.plugin.resolveCompletionItem) { | ||
item.data = { | ||
uri: uri.toString(), | ||
original: { | ||
additionalTextEdits: item.additionalTextEdits, | ||
textEdit: item.textEdit, | ||
data: item.data, | ||
}, | ||
pluginIndex: pluginIndex, | ||
embeddedDocumentUri: embeddedDocument.uri, | ||
}; | ||
} | ||
else { | ||
delete item.data; | ||
} | ||
} | ||
@@ -81,12 +86,17 @@ cacheData.list = (0, transform_1.transformCompletionList)(cacheData.list, range => (0, featureWorkers_1.getSourceRange)(docs, range), embeddedDocument, context); | ||
for (const item of cacheData.list.items) { | ||
item.data = { | ||
uri: uri.toString(), | ||
original: { | ||
additionalTextEdits: item.additionalTextEdits, | ||
textEdit: item.textEdit, | ||
data: item.data, | ||
}, | ||
pluginIndex: pluginIndex, | ||
embeddedDocumentUri: undefined, | ||
}; | ||
if (cacheData.plugin.resolveCompletionItem) { | ||
item.data = { | ||
uri: uri.toString(), | ||
original: { | ||
additionalTextEdits: item.additionalTextEdits, | ||
textEdit: item.textEdit, | ||
data: item.data, | ||
}, | ||
pluginIndex: pluginIndex, | ||
embeddedDocumentUri: undefined, | ||
}; | ||
} | ||
else { | ||
delete item.data; | ||
} | ||
} | ||
@@ -141,12 +151,17 @@ } | ||
for (const item of completionList.items) { | ||
item.data = { | ||
uri: uri.toString(), | ||
original: { | ||
additionalTextEdits: item.additionalTextEdits, | ||
textEdit: item.textEdit, | ||
data: item.data, | ||
}, | ||
pluginIndex, | ||
embeddedDocumentUri: docs ? document.uri : undefined, | ||
}; | ||
if (plugin[1].resolveCompletionItem) { | ||
item.data = { | ||
uri: uri.toString(), | ||
original: { | ||
additionalTextEdits: item.additionalTextEdits, | ||
textEdit: item.textEdit, | ||
data: item.data, | ||
}, | ||
pluginIndex, | ||
embeddedDocumentUri: docs ? document.uri : undefined, | ||
}; | ||
} | ||
else { | ||
delete item.data; | ||
} | ||
} | ||
@@ -153,0 +168,0 @@ if (docs) { |
@@ -1,2 +0,1 @@ | ||
import { type CodeInformation } from '@volar/language-core'; | ||
import type * as vscode from 'vscode-languageserver-protocol'; | ||
@@ -19,3 +18,3 @@ import { URI } from 'vscode-uri'; | ||
export declare function register(context: LanguageServiceContext): (uri: URI, response?: (result: vscode.Diagnostic[]) => void, token?: vscode.CancellationToken) => Promise<vscode.Diagnostic[]>; | ||
export declare function transformDiagnostic(context: LanguageServiceContext, error: vscode.Diagnostic, docs: DocumentsAndMap | undefined, filter: (data: CodeInformation) => boolean): vscode.Diagnostic | undefined; | ||
export declare function transformDiagnostic(context: LanguageServiceContext, error: vscode.Diagnostic, docs: DocumentsAndMap | undefined): vscode.Diagnostic | undefined; | ||
export declare function updateRange(range: vscode.Range, change: { | ||
@@ -22,0 +21,0 @@ range: vscode.Range; |
@@ -121,3 +121,3 @@ "use strict"; | ||
return errors | ||
.map(error => transformDiagnostic(context, error, map, language_core_1.shouldReportDiagnostics)) | ||
.map(error => transformDiagnostic(context, error, map)) | ||
.filter(error => !!error); | ||
@@ -132,7 +132,7 @@ }, arr => dedupe.withDiagnostics(arr.flat())); | ||
} | ||
function transformDiagnostic(context, error, docs, filter) { | ||
function transformDiagnostic(context, error, docs) { | ||
// clone it to avoid modify cache | ||
let _error = { ...error }; | ||
if (docs) { | ||
const range = (0, featureWorkers_1.getSourceRange)(docs, error.range, filter); | ||
const range = (0, featureWorkers_1.getSourceRange)(docs, error.range, data => (0, language_core_1.shouldReportDiagnostics)(data, error.source, error.code)); | ||
if (!range) { | ||
@@ -154,3 +154,3 @@ return; | ||
const docs = [sourceDocument, embeddedDocument, map]; | ||
const range = (0, featureWorkers_1.getSourceRange)(docs, info.location.range, filter); | ||
const range = (0, featureWorkers_1.getSourceRange)(docs, info.location.range, data => (0, language_core_1.shouldReportDiagnostics)(data, undefined, undefined)); | ||
if (range) { | ||
@@ -157,0 +157,0 @@ relatedInfos.push({ |
@@ -16,9 +16,14 @@ "use strict"; | ||
for (const link of links ?? []) { | ||
link.data = { | ||
uri: uri.toString(), | ||
original: { | ||
data: link.data, | ||
}, | ||
pluginIndex: context.plugins.indexOf(plugin), | ||
}; | ||
if (plugin[1].resolveDocumentLink) { | ||
link.data = { | ||
uri: uri.toString(), | ||
original: { | ||
data: link.data, | ||
}, | ||
pluginIndex: context.plugins.indexOf(plugin), | ||
}; | ||
} | ||
else { | ||
delete link.data; | ||
} | ||
} | ||
@@ -25,0 +30,0 @@ return links; |
@@ -29,9 +29,14 @@ "use strict"; | ||
hints?.forEach(link => { | ||
link.data = { | ||
uri: uri.toString(), | ||
original: { | ||
data: link.data, | ||
}, | ||
pluginIndex: context.plugins.indexOf(plugin), | ||
}; | ||
if (plugin[1].resolveInlayHint) { | ||
link.data = { | ||
uri: uri.toString(), | ||
original: { | ||
data: link.data, | ||
}, | ||
pluginIndex: context.plugins.indexOf(plugin), | ||
}; | ||
} | ||
else { | ||
delete link.data; | ||
} | ||
}); | ||
@@ -38,0 +43,0 @@ return hints; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.register = register; | ||
const language_core_1 = require("@volar/language-core"); | ||
const vscode_uri_1 = require("vscode-uri"); | ||
@@ -47,3 +46,3 @@ const cancellation_1 = require("../utils/cancellation"); | ||
items: item.items | ||
.map(error => (0, provideDiagnostics_1.transformDiagnostic)(context, error, docs, language_core_1.shouldReportDiagnostics)) | ||
.map(error => (0, provideDiagnostics_1.transformDiagnostic)(context, error, docs)) | ||
.filter(error => !!error) | ||
@@ -60,3 +59,3 @@ }; | ||
items: item.items | ||
.map(error => (0, provideDiagnostics_1.transformDiagnostic)(context, error, undefined, language_core_1.shouldReportDiagnostics)) | ||
.map(error => (0, provideDiagnostics_1.transformDiagnostic)(context, error, undefined)) | ||
.filter(error => !!error) | ||
@@ -63,0 +62,0 @@ }; |
@@ -47,8 +47,13 @@ "use strict"; | ||
symbols?.forEach(symbol => { | ||
symbol.data = { | ||
original: { | ||
data: symbol.data, | ||
}, | ||
pluginIndex: context.plugins.indexOf(plugin), | ||
}; | ||
if (plugin[1].resolveWorkspaceSymbol) { | ||
symbol.data = { | ||
original: { | ||
data: symbol.data, | ||
}, | ||
pluginIndex: context.plugins.indexOf(plugin), | ||
}; | ||
} | ||
else { | ||
delete symbol.data; | ||
} | ||
}); | ||
@@ -55,0 +60,0 @@ symbolsList.push(symbols); |
@@ -12,2 +12,3 @@ "use strict"; | ||
if (!plugin[1].resolveCodeAction) { | ||
delete item.data; | ||
return item; | ||
@@ -25,2 +26,3 @@ } | ||
} | ||
delete item.data; | ||
return item; | ||
@@ -27,0 +29,0 @@ }; |
@@ -14,2 +14,3 @@ "use strict"; | ||
if (!plugin[1].resolveCodeLens) { | ||
delete item.data; | ||
return item; | ||
@@ -21,6 +22,7 @@ } | ||
} | ||
if (data?.kind === 'references') { | ||
else if (data?.kind === 'references') { | ||
const references = await findReferences(vscode_uri_1.URI.parse(data.sourceFileUri), item.range.start, { includeDeclaration: false }, token) ?? []; | ||
item.command = context.commands.showReferences.create(data.sourceFileUri, item.range.start, references); | ||
} | ||
delete item.data; | ||
return item; | ||
@@ -27,0 +29,0 @@ }; |
@@ -14,2 +14,3 @@ "use strict"; | ||
if (!plugin[1].resolveCompletionItem) { | ||
delete item.data; | ||
return item; | ||
@@ -40,2 +41,3 @@ } | ||
} | ||
delete item.data; | ||
return item; | ||
@@ -42,0 +44,0 @@ }; |
@@ -12,2 +12,3 @@ "use strict"; | ||
if (!plugin[1].resolveDocumentLink) { | ||
delete item.data; | ||
return item; | ||
@@ -21,2 +22,3 @@ } | ||
} | ||
delete item.data; | ||
return item; | ||
@@ -23,0 +25,0 @@ }; |
@@ -11,2 +11,3 @@ "use strict"; | ||
if (!plugin[1].resolveInlayHint) { | ||
delete item.data; | ||
return item; | ||
@@ -17,2 +18,3 @@ } | ||
} | ||
delete item.data; | ||
return item; | ||
@@ -19,0 +21,0 @@ }; |
import type * as vscode from 'vscode-languageserver-protocol'; | ||
import type { LanguageServiceContext } from '../types'; | ||
export declare function register(context: LanguageServiceContext): (symbol: vscode.WorkspaceSymbol, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceSymbol>; | ||
export declare function register(context: LanguageServiceContext): (item: vscode.WorkspaceSymbol, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceSymbol>; |
@@ -6,15 +6,17 @@ "use strict"; | ||
function register(context) { | ||
return async (symbol, token = cancellation_1.NoneCancellationToken) => { | ||
const data = symbol.data; | ||
return async (item, token = cancellation_1.NoneCancellationToken) => { | ||
const data = item.data; | ||
if (data) { | ||
const plugin = context.plugins[data.pluginIndex]; | ||
if (!plugin[1].resolveWorkspaceSymbol) { | ||
return symbol; | ||
delete item.data; | ||
return item; | ||
} | ||
Object.assign(symbol, data.original); | ||
symbol = await plugin[1].resolveWorkspaceSymbol(symbol, token); | ||
Object.assign(item, data.original); | ||
item = await plugin[1].resolveWorkspaceSymbol(item, token); | ||
} | ||
return symbol; | ||
delete item.data; | ||
return item; | ||
}; | ||
} | ||
//# sourceMappingURL=resolveWorkspaceSymbol.js.map |
@@ -75,3 +75,3 @@ import { type Language } from '@volar/language-core'; | ||
resolveInlayHint: (item: vscode.InlayHint, token?: vscode.CancellationToken) => Promise<vscode.InlayHint>; | ||
resolveWorkspaceSymbol: (symbol: vscode.WorkspaceSymbol, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceSymbol>; | ||
resolveWorkspaceSymbol: (item: vscode.WorkspaceSymbol, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceSymbol>; | ||
}; | ||
@@ -151,4 +151,4 @@ export declare function decodeEmbeddedDocumentUri(maybeEmbeddedContentUri: URI): [ | ||
resolveInlayHint: (item: vscode.InlayHint, token?: vscode.CancellationToken) => Promise<vscode.InlayHint>; | ||
resolveWorkspaceSymbol: (symbol: vscode.WorkspaceSymbol, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceSymbol>; | ||
resolveWorkspaceSymbol: (item: vscode.WorkspaceSymbol, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceSymbol>; | ||
}; | ||
export {}; |
{ | ||
"name": "@volar/language-service", | ||
"version": "2.4.0", | ||
"version": "2.4.1", | ||
"license": "MIT", | ||
@@ -15,3 +15,3 @@ "files": [ | ||
"dependencies": { | ||
"@volar/language-core": "2.4.0", | ||
"@volar/language-core": "2.4.1", | ||
"vscode-languageserver-protocol": "^3.17.5", | ||
@@ -21,3 +21,3 @@ "vscode-languageserver-textdocument": "^1.0.11", | ||
}, | ||
"gitHead": "7e98885cfe284451e655cf1c3954786b51aea2f8" | ||
"gitHead": "b920b6c4a3e4b2d8f46c676ea414e94c437cb5b7" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
227807
4437
+ Added@volar/language-core@2.4.1(transitive)
+ Added@volar/source-map@2.4.1(transitive)
- Removed@volar/language-core@2.4.0(transitive)
- Removed@volar/source-map@2.4.0(transitive)
Updated@volar/language-core@2.4.1