Replace FoldingRangeKind type with normal enum. Fixes #48956

This commit is contained in:
Martin Aeschlimann
2018-04-30 18:11:20 +02:00
parent 638c9c3764
commit f2d37611f1
6 changed files with 68 additions and 74 deletions

View File

@@ -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;
}
}

View File

@@ -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