@volar/language-server
Advanced tools
Comparing version 2.4.0-alpha.19 to 2.4.0
@@ -19,2 +19,3 @@ "use strict"; | ||
let lastCallHierarchyLs; | ||
let lastTypeHierarchyLs; | ||
let lastDocumentLinkLs; | ||
@@ -106,7 +107,18 @@ let lastInlayHintLs; | ||
const uri = vscode_uri_1.URI.parse(params.textDocument.uri); | ||
return await worker(uri, token, languageService => { | ||
return languageService.getImplementations(uri, params.position, token); | ||
return await worker(uri, token, async (languageService) => { | ||
const definitions = await languageService.getImplementations(uri, params.position, token); | ||
return handleDefinitions(initializeParams, 'implementation', definitions ?? []); | ||
}); | ||
}); | ||
} | ||
if (languageServicePlugins.some(({ capabilities }) => capabilities.declarationProvider)) { | ||
serverCapabilities.declarationProvider = true; | ||
server.connection.onDeclaration(async (params, token) => { | ||
const uri = vscode_uri_1.URI.parse(params.textDocument.uri); | ||
return await worker(uri, token, async (languageService) => { | ||
const definitions = await languageService.getDeclaration(uri, params.position, token); | ||
return handleDefinitions(initializeParams, 'declaration', definitions ?? []); | ||
}); | ||
}); | ||
} | ||
if (languageServicePlugins.some(({ capabilities }) => capabilities.definitionProvider)) { | ||
@@ -116,4 +128,5 @@ serverCapabilities.definitionProvider = true; | ||
const uri = vscode_uri_1.URI.parse(params.textDocument.uri); | ||
return await worker(uri, token, languageService => { | ||
return languageService.getDefinition(uri, params.position, token); | ||
return await worker(uri, token, async (languageService) => { | ||
const definitions = await languageService.getDefinition(uri, params.position, token); | ||
return handleDefinitions(initializeParams, 'definition', definitions ?? []); | ||
}); | ||
@@ -126,4 +139,5 @@ }); | ||
const uri = vscode_uri_1.URI.parse(params.textDocument.uri); | ||
return await worker(uri, token, languageService => { | ||
return languageService.getTypeDefinition(uri, params.position, token); | ||
return await worker(uri, token, async (languageService) => { | ||
const definitions = await languageService.getTypeDefinition(uri, params.position, token); | ||
return handleDefinitions(initializeParams, 'typeDefinition', definitions ?? []); | ||
}); | ||
@@ -148,2 +162,18 @@ }); | ||
} | ||
if (languageServicePlugins.some(({ capabilities }) => capabilities.typeHierarchyProvider)) { | ||
serverCapabilities.typeHierarchyProvider = true; | ||
server.connection.languages.typeHierarchy.onPrepare(async (params, token) => { | ||
const uri = vscode_uri_1.URI.parse(params.textDocument.uri); | ||
return await worker(uri, token, languageService => { | ||
lastTypeHierarchyLs = languageService; | ||
return languageService.getTypeHierarchyItems(uri, params.position, token); | ||
}) ?? []; | ||
}); | ||
server.connection.languages.typeHierarchy.onSupertypes(async (params, token) => { | ||
return await lastTypeHierarchyLs?.getTypeHierarchySupertypes(params.item, token) ?? []; | ||
}); | ||
server.connection.languages.typeHierarchy.onSubtypes(async (params, token) => { | ||
return await lastTypeHierarchyLs?.getTypeHierarchySubtypes(params.item, token) ?? []; | ||
}); | ||
} | ||
if (languageServicePlugins.some(({ capabilities }) => capabilities.hoverProvider)) { | ||
@@ -305,5 +335,3 @@ serverCapabilities.hoverProvider = true; | ||
const list = await languageService.getCompletionItems(uri, params.position, params.context, token); | ||
for (const item of list.items) { | ||
fixTextEdit(initializeParams, item); | ||
} | ||
list.items = list.items.map(item => handleCompletionItem(initializeParams, item)); | ||
return list; | ||
@@ -317,3 +345,3 @@ }); | ||
item = await lastCompleteLs.resolveCompletionItem(item, token); | ||
fixTextEdit(initializeParams, item); | ||
item = handleCompletionItem(initializeParams, item); | ||
} | ||
@@ -413,2 +441,28 @@ return item; | ||
} | ||
if (languageServicePlugins.some(({ capabilities }) => capabilities.monikerProvider)) { | ||
serverCapabilities.monikerProvider = true; | ||
server.connection.languages.moniker.on(async (params, token) => { | ||
const uri = vscode_uri_1.URI.parse(params.textDocument.uri); | ||
return await worker(uri, token, languageService => { | ||
return languageService.getMoniker(uri, params.position, token); | ||
}) ?? null; | ||
}); | ||
} | ||
if (languageServicePlugins.some(({ capabilities }) => capabilities.inlineValueProvider)) { | ||
serverCapabilities.inlineValueProvider = true; | ||
server.connection.languages.inlineValue.on(async (params, token) => { | ||
const uri = vscode_uri_1.URI.parse(params.textDocument.uri); | ||
return await worker(uri, token, languageService => { | ||
return languageService.getInlineValue(uri, params.range, params.context, token); | ||
}); | ||
}); | ||
if (initializeParams.capabilities.workspace?.inlineValue?.refreshSupport) { | ||
refreshHandlers.push(() => { | ||
server.connection.languages.inlineValue.refresh(); | ||
}); | ||
} | ||
else { | ||
console.warn('Inline value refresh is not supported by the client.'); | ||
} | ||
} | ||
if (languageServicePlugins.some(({ capabilities }) => capabilities.autoInsertionProvider)) { | ||
@@ -659,3 +713,3 @@ const triggerCharacterToConfigurationSections = new Map(); | ||
} | ||
function fixTextEdit(initializeParams, item) { | ||
function handleCompletionItem(initializeParams, item) { | ||
const insertReplaceSupport = initializeParams.capabilities.textDocument?.completion?.completionItem?.insertReplaceSupport ?? false; | ||
@@ -667,3 +721,16 @@ if (!insertReplaceSupport) { | ||
} | ||
return item; | ||
} | ||
function handleDefinitions(initializeParams, type, items) { | ||
const linkSupport = initializeParams.capabilities.textDocument?.[type]?.linkSupport ?? false; | ||
if (!linkSupport) { | ||
return items.map(item => ({ | ||
uri: item.targetUri, | ||
range: item.targetRange, | ||
})); | ||
} | ||
else { | ||
return items; | ||
} | ||
} | ||
} | ||
@@ -670,0 +737,0 @@ function sleep(ms) { |
@@ -23,6 +23,2 @@ "use strict"; | ||
}, | ||
getScriptSnapshot(fileName) { | ||
const uri = uriConverter.asUri(fileName); | ||
return server.documents.get(uri)?.getSnapshot(); | ||
}, | ||
getCompilationSettings() { | ||
@@ -52,3 +48,3 @@ return parsedCommandLine.options; | ||
{ getLanguageId: uri => (0, typescript_1.resolveFileLanguageId)(uri.path) }, | ||
], (0, language_service_1.createUriMap)(sys.useCaseSensitiveFileNames), uri => { | ||
], (0, language_service_1.createUriMap)(sys.useCaseSensitiveFileNames), (uri, includeFsFiles) => { | ||
const syncedDocument = server.documents.get(uri); | ||
@@ -59,4 +55,3 @@ let snapshot; | ||
} | ||
else { | ||
// fs files | ||
else if (includeFsFiles) { | ||
const cache = fsFileSnapshots.get(uri); | ||
@@ -63,0 +58,0 @@ const fileName = uriConverter.asFileName(uri); |
{ | ||
"name": "@volar/language-server", | ||
"version": "2.4.0-alpha.19", | ||
"version": "2.4.0", | ||
"license": "MIT", | ||
@@ -15,5 +15,5 @@ "files": [ | ||
"dependencies": { | ||
"@volar/language-core": "2.4.0-alpha.19", | ||
"@volar/language-service": "2.4.0-alpha.19", | ||
"@volar/typescript": "2.4.0-alpha.19", | ||
"@volar/language-core": "2.4.0", | ||
"@volar/language-service": "2.4.0", | ||
"@volar/typescript": "2.4.0", | ||
"path-browserify": "^1.0.1", | ||
@@ -29,3 +29,3 @@ "request-light": "^0.7.0", | ||
}, | ||
"gitHead": "cbb14a44f72c365c1e8d52eff9580fb4e9765f15" | ||
"gitHead": "7e98885cfe284451e655cf1c3954786b51aea2f8" | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
137615
2820
1
2
+ Added@volar/language-core@2.4.0(transitive)
+ Added@volar/language-service@2.4.0(transitive)
+ Added@volar/source-map@2.4.0(transitive)
+ Added@volar/typescript@2.4.0(transitive)
- Removed@volar/language-core@2.4.0-alpha.19(transitive)
- Removed@volar/language-service@2.4.0-alpha.19(transitive)
- Removed@volar/source-map@2.4.0-alpha.19(transitive)
- Removed@volar/typescript@2.4.0-alpha.19(transitive)
Updated@volar/language-core@2.4.0
Updated@volar/typescript@2.4.0