mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-22 03:09:13 +00:00
Updated initial version of css folding
This commit is contained in:
@@ -16,6 +16,7 @@ import { getLanguageModelCache } from './languageModelCache';
|
||||
import { formatError, runSafe } from './utils/errors';
|
||||
import URI from 'vscode-uri';
|
||||
import { getPathCompletionParticipant } from './pathCompletion';
|
||||
import { FoldingProviderServerCapabilities, FoldingRangesRequest } from './protocol/foldingProvider.proposed';
|
||||
|
||||
export interface Settings {
|
||||
css: LanguageSettings;
|
||||
@@ -72,7 +73,8 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
|
||||
}
|
||||
let snippetSupport = hasClientCapability('textDocument.completion.completionItem.snippetSupport');
|
||||
scopedSettingsSupport = hasClientCapability('workspace.configuration');
|
||||
let capabilities: ServerCapabilities = {
|
||||
|
||||
let capabilities: ServerCapabilities & FoldingProviderServerCapabilities = {
|
||||
// Tell the client that the server works in FULL text document sync mode
|
||||
textDocumentSync: documents.syncKind,
|
||||
completionProvider: snippetSupport ? { resolveProvider: false } : undefined,
|
||||
@@ -83,7 +85,8 @@ connection.onInitialize((params: InitializeParams): InitializeResult => {
|
||||
documentHighlightProvider: true,
|
||||
codeActionProvider: true,
|
||||
renameProvider: true,
|
||||
colorProvider: true
|
||||
colorProvider: true,
|
||||
foldingProvider: true
|
||||
};
|
||||
return { capabilities };
|
||||
});
|
||||
@@ -274,5 +277,13 @@ connection.onRenameRequest(renameParameters => {
|
||||
}, null, `Error while computing renames for ${renameParameters.textDocument.uri}`);
|
||||
});
|
||||
|
||||
connection.onRequest(FoldingRangesRequest.type, (params, token) => {
|
||||
return runSafe(() => {
|
||||
let document = documents.get(params[0].textDocument.uri);
|
||||
let stylesheet = stylesheets.get(document);
|
||||
return getLanguageService(document).findFoldingRegions(document, stylesheet);
|
||||
}, null, `Error while computing folding ranges for ${params[0].textDocument.uri}`);
|
||||
});
|
||||
|
||||
// Listen on the connection
|
||||
connection.listen();
|
||||
Reference in New Issue
Block a user