astro-ghostcms/.pnpm-store/v3/files/a0/0a72f7de09bceb01c4d8f816acc...

96 lines
3.6 KiB
Plaintext
Raw Normal View History

2024-02-14 19:45:06 +00:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.setupCapabilities = void 0;
const types_1 = require("./types");
const vscode = require("vscode-languageserver");
function setupCapabilities(server, initOptions, watchExts, services, semanticTokensLegend) {
server.selectionRangeProvider = true;
server.foldingRangeProvider = true;
server.linkedEditingRangeProvider = true;
server.colorProvider = true;
server.documentSymbolProvider = true;
server.documentFormattingProvider = true;
server.documentRangeFormattingProvider = true;
const characters = [...new Set(services.map(service => service.autoFormatTriggerCharacters ?? []).flat())];
if (characters.length) {
server.documentOnTypeFormattingProvider = {
firstTriggerCharacter: characters[0],
moreTriggerCharacter: characters.slice(1),
};
}
server.referencesProvider = true;
server.implementationProvider = true;
server.definitionProvider = true;
server.typeDefinitionProvider = true;
server.callHierarchyProvider = true;
server.hoverProvider = true;
server.renameProvider = {
prepareProvider: true,
};
server.signatureHelpProvider = {
triggerCharacters: [...new Set(services.map(service => service.signatureHelpTriggerCharacters ?? []).flat())],
retriggerCharacters: [...new Set(services.map(service => service.signatureHelpRetriggerCharacters ?? []).flat())],
};
server.completionProvider = {
triggerCharacters: [...new Set(services.map(service => service.triggerCharacters ?? []).flat())],
resolveProvider: true,
};
if (initOptions.ignoreTriggerCharacters) {
server.completionProvider.triggerCharacters = server.completionProvider.triggerCharacters
?.filter(c => !initOptions.ignoreTriggerCharacters.includes(c));
}
server.documentHighlightProvider = true;
server.documentLinkProvider = {
resolveProvider: true,
};
server.codeLensProvider = {
resolveProvider: true,
};
server.semanticTokensProvider = {
range: true,
full: false,
legend: semanticTokensLegend,
};
server.codeActionProvider = {
codeActionKinds: [
vscode.CodeActionKind.Empty,
vscode.CodeActionKind.QuickFix,
vscode.CodeActionKind.Refactor,
vscode.CodeActionKind.RefactorExtract,
vscode.CodeActionKind.RefactorInline,
vscode.CodeActionKind.RefactorRewrite,
vscode.CodeActionKind.Source,
vscode.CodeActionKind.SourceFixAll,
vscode.CodeActionKind.SourceOrganizeImports,
],
resolveProvider: true,
};
server.inlayHintProvider = {
resolveProvider: true,
};
if (watchExts.length) {
server.workspace = {
fileOperations: {
willRename: {
filters: [
{
pattern: {
glob: `**/*.{${watchExts.join(',')}}`
}
},
]
}
}
};
}
server.workspaceSymbolProvider = true;
// diagnostics are shunted in the api
if ((initOptions.diagnosticModel ?? types_1.DiagnosticModel.Push) === types_1.DiagnosticModel.Pull) {
server.diagnosticProvider = {
interFileDependencies: true,
workspaceDiagnostics: false,
};
}
}
exports.setupCapabilities = setupCapabilities;
//# sourceMappingURL=setupCapabilities.js.map