mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-21 18:59:15 +00:00
use vscode-languageserver-protocol-foldingprovider
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
import { TextDocument, Position, CancellationToken } from 'vscode-languageserver';
|
||||
import { createScanner, SyntaxKind, ScanError } from 'jsonc-parser';
|
||||
import { FoldingRangeType, FoldingRange, FoldingRangeList } from './protocol/foldingProvider.proposed';
|
||||
import { FoldingRangeType, FoldingRange, FoldingRangeList } from 'vscode-languageserver-protocol-foldingprovider';
|
||||
|
||||
export function getFoldingRegions(document: TextDocument, maxRanges: number | undefined, cancellationToken: CancellationToken | null) {
|
||||
let ranges: FoldingRange[] = [];
|
||||
|
||||
@@ -20,7 +20,7 @@ import { JSONDocument, JSONSchema, getLanguageService, DocumentLanguageSettings,
|
||||
import { getLanguageModelCache } from './languageModelCache';
|
||||
import { getFoldingRegions } from './jsonFolding';
|
||||
|
||||
import { FoldingRangesRequest, FoldingProviderServerCapabilities } from './protocol/foldingProvider.proposed';
|
||||
import { FoldingRangesRequest, FoldingProviderServerCapabilities } from 'vscode-languageserver-protocol-foldingprovider';
|
||||
|
||||
interface ISchemaAssociations {
|
||||
[pattern: string]: string[];
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { TextDocumentIdentifier } from 'vscode-languageserver-types';
|
||||
import { RequestType, TextDocumentRegistrationOptions, StaticRegistrationOptions } from 'vscode-languageserver-protocol';
|
||||
|
||||
// ---- capabilities
|
||||
|
||||
export interface FoldingProviderClientCapabilities {
|
||||
/**
|
||||
* The text document client capabilities
|
||||
*/
|
||||
textDocument?: {
|
||||
/**
|
||||
* Capabilities specific to the foldingProvider
|
||||
*/
|
||||
foldingProvider?: {
|
||||
/**
|
||||
* Whether implementation supports dynamic registration. If this is set to `true`
|
||||
* the client supports the new `(FoldingProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions)`
|
||||
* return value for the corresponding server capability as well.
|
||||
*/
|
||||
dynamicRegistration?: boolean;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export interface FoldingProviderOptions {
|
||||
}
|
||||
|
||||
export interface FoldingProviderServerCapabilities {
|
||||
/**
|
||||
* The server provides folding provider support.
|
||||
*/
|
||||
foldingProvider?: FoldingProviderOptions | (FoldingProviderOptions & TextDocumentRegistrationOptions & StaticRegistrationOptions);
|
||||
}
|
||||
|
||||
export interface FoldingRangeList {
|
||||
/**
|
||||
* The folding ranges.
|
||||
*/
|
||||
ranges: FoldingRange[];
|
||||
}
|
||||
|
||||
export enum FoldingRangeType {
|
||||
/**
|
||||
* Folding range for a comment
|
||||
*/
|
||||
Comment = 'comment',
|
||||
/**
|
||||
* Folding range for a imports or includes
|
||||
*/
|
||||
Imports = 'imports',
|
||||
/**
|
||||
* Folding range for a region (e.g. `#region`)
|
||||
*/
|
||||
Region = 'region'
|
||||
}
|
||||
|
||||
export interface FoldingRange {
|
||||
|
||||
/**
|
||||
* The start line number
|
||||
*/
|
||||
startLine: number;
|
||||
|
||||
/**
|
||||
* The end line number
|
||||
*/
|
||||
endLine: number;
|
||||
|
||||
/**
|
||||
* The actual color value for this folding range.
|
||||
*/
|
||||
type?: FoldingRangeType | string;
|
||||
}
|
||||
|
||||
export interface FoldingRangeRequestParam {
|
||||
/**
|
||||
* The text document.
|
||||
*/
|
||||
textDocument: TextDocumentIdentifier;
|
||||
|
||||
/**
|
||||
* The maximum number of ranges to provide
|
||||
*/
|
||||
maxRanges?: number;
|
||||
}
|
||||
|
||||
export namespace FoldingRangesRequest {
|
||||
export const type: RequestType<FoldingRangeRequestParam, FoldingRangeList | null, any, any> = new RequestType('textDocument/foldingRanges');
|
||||
}
|
||||
Reference in New Issue
Block a user