mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 19:18:59 +01:00
Replace FoldingRangeKind type with normal enum. Fixes #48956
This commit is contained in:
@@ -625,7 +625,27 @@ export namespace ProgressLocation {
|
||||
|
||||
export namespace FoldingRange {
|
||||
export function from(r: vscode.FoldingRange): modes.FoldingRange {
|
||||
return { start: r.start + 1, end: r.end + 1, kind: r.kind };
|
||||
let range: modes.FoldingRange = { start: r.start + 1, end: r.end + 1 };
|
||||
if (r.kind) {
|
||||
range.kind = FoldingRangeKind.from(r.kind);
|
||||
}
|
||||
return range;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace FoldingRangeKind {
|
||||
export function from(kind: vscode.FoldingRangeKind | undefined): modes.FoldingRangeKind | undefined {
|
||||
if (kind) {
|
||||
switch (kind) {
|
||||
case types.FoldingRangeKind.Comment:
|
||||
return modes.FoldingRangeKind.Comment;
|
||||
case types.FoldingRangeKind.Imports:
|
||||
return modes.FoldingRangeKind.Imports;
|
||||
case types.FoldingRangeKind.Region:
|
||||
return modes.FoldingRangeKind.Region;
|
||||
}
|
||||
}
|
||||
return void 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1912,28 +1912,10 @@ export class FoldingRange {
|
||||
}
|
||||
}
|
||||
|
||||
export class FoldingRangeKind {
|
||||
/**
|
||||
* Kind for folding range representing a comment. The value of the kind is 'comment'.
|
||||
*/
|
||||
static readonly Comment = new FoldingRangeKind('comment');
|
||||
/**
|
||||
* Kind for folding range representing a import. The value of the kind is 'imports'.
|
||||
*/
|
||||
static readonly Imports = new FoldingRangeKind('imports');
|
||||
/**
|
||||
* Kind for folding range representing regions (for example marked by `#region`, `#endregion`).
|
||||
* The value of the kind is 'region'.
|
||||
*/
|
||||
static readonly Region = new FoldingRangeKind('region');
|
||||
|
||||
/**
|
||||
* Creates a new [FoldingRangeKind](#FoldingRangeKind).
|
||||
*
|
||||
* @param value of the kind.
|
||||
*/
|
||||
public constructor(public value: string) {
|
||||
}
|
||||
export enum FoldingRangeKind {
|
||||
Comment = 1,
|
||||
Imports = 2,
|
||||
Region = 3
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
Reference in New Issue
Block a user