Skip to content

Commit

Permalink
for now remove SelectionRangeKind #67872
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Mar 11, 2019
1 parent d77d8d5 commit 6892cfc
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 72 deletions.
3 changes: 1 addition & 2 deletions extensions/css-language-features/client/src/cssMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ export function activate(context: ExtensionContext) {
return rawResult.map(rawSelectionRanges => {
return rawSelectionRanges.map(selectionRange => {
return {
range: client.protocol2CodeConverter.asRange(selectionRange.range),
kind: selectionRange.kind
range: client.protocol2CodeConverter.asRange(selectionRange.range)
};
});
});
Expand Down
1 change: 0 additions & 1 deletion extensions/html-language-features/client/src/htmlMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ export function activate(context: ExtensionContext) {
return rawSelectionRanges.map(selectionRange => {
return {
range: client.protocol2CodeConverter.asRange(selectionRange.range),
kind: selectionRange.kind
};
});
});
Expand Down
1 change: 0 additions & 1 deletion extensions/json-language-features/client/src/jsonMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ export function activate(context: ExtensionContext) {
return rawSelectionRanges.map(selectionRange => {
return {
range: client.protocol2CodeConverter.asRange(selectionRange.range),
kind: selectionRange.kind
};
});
});
Expand Down
29 changes: 1 addition & 28 deletions src/vs/vscode.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,36 +84,9 @@ declare module 'vscode' {

//#region Joh - selection range provider

export class SelectionRangeKind {

/**
* Empty Kind.
*/
static readonly Empty: SelectionRangeKind;

/**
* The statement kind, its value is `statement`, possible extensions can be
* `statement.if` etc
*/
static readonly Statement: SelectionRangeKind;

/**
* The declaration kind, its value is `declaration`, possible extensions can be
* `declaration.function`, `declaration.class` etc.
*/
static readonly Declaration: SelectionRangeKind;

readonly value: string;

private constructor(value: string);

append(value: string): SelectionRangeKind;
}

export class SelectionRange {
kind: SelectionRangeKind;
range: Range;
constructor(range: Range, kind: SelectionRangeKind);
constructor(range: Range);
}

export interface SelectionRangeProvider {
Expand Down
1 change: 0 additions & 1 deletion src/vs/workbench/api/node/extHost.api.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,6 @@ export function createApiFactory(
ResolvedAuthority: extHostTypes.ResolvedAuthority,
Selection: extHostTypes.Selection,
SelectionRange: extHostTypes.SelectionRange,
SelectionRangeKind: extHostTypes.SelectionRangeKind,
ShellExecution: extHostTypes.ShellExecution,
ShellQuoting: extHostTypes.ShellQuoting,
SignatureHelpTriggerKind: extHostTypes.SignatureHelpTriggerKind,
Expand Down
14 changes: 2 additions & 12 deletions src/vs/workbench/api/node/extHostTypeConverters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -854,27 +854,17 @@ export namespace Color {
}
}

export namespace SelectionRangeKind {

export function from(kind: vscode.SelectionRangeKind): string {
return kind.value;
}

export function to(value: string): vscode.SelectionRangeKind {
return new types.SelectionRangeKind(value);
}
}

export namespace SelectionRange {
export function from(obj: vscode.SelectionRange): modes.SelectionRange {
return {
kind: SelectionRangeKind.from(obj.kind),
kind: '',
range: Range.from(obj.range)
};
}

export function to(obj: modes.SelectionRange): vscode.SelectionRange {
return new types.SelectionRange(Range.to(obj.range), SelectionRangeKind.to(obj.kind));
return new types.SelectionRange(Range.to(obj.range));
}
}

Expand Down
24 changes: 1 addition & 23 deletions src/vs/workbench/api/node/extHostTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1094,35 +1094,13 @@ CodeActionKind.Source = CodeActionKind.Empty.append('source');
CodeActionKind.SourceOrganizeImports = CodeActionKind.Source.append('organizeImports');
CodeActionKind.SourceFixAll = CodeActionKind.Source.append('fixAll');

@es5ClassCompat
export class SelectionRangeKind {

private static readonly _sep = '.';

static readonly Empty = new SelectionRangeKind('');
static readonly Statement = SelectionRangeKind.Empty.append('statement');
static readonly Declaration = SelectionRangeKind.Empty.append('declaration');

readonly value: string;

constructor(value: string) {
this.value = value;
}

append(value: string): SelectionRangeKind {
return new SelectionRangeKind(this.value ? this.value + SelectionRangeKind._sep + value : value);
}
}

@es5ClassCompat
export class SelectionRange {

kind: SelectionRangeKind;
range: Range;

constructor(range: Range, kind: SelectionRangeKind, ) {
constructor(range: Range) {
this.range = range;
this.kind = kind;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -800,8 +800,8 @@ suite('ExtHostLanguageFeatureCommands', function () {
disposables.push(extHost.registerSelectionRangeProvider(nullExtensionDescription, defaultSelector, <vscode.SelectionRangeProvider>{
provideSelectionRanges() {
return [[
new types.SelectionRange(new types.Range(0, 10, 0, 18), types.SelectionRangeKind.Empty),
new types.SelectionRange(new types.Range(0, 2, 0, 20), types.SelectionRangeKind.Empty)
new types.SelectionRange(new types.Range(0, 10, 0, 18)),
new types.SelectionRange(new types.Range(0, 2, 0, 20))
]];
}
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1105,8 +1105,8 @@ suite('ExtHostLanguageFeatures', function () {
disposables.push(extHost.registerSelectionRangeProvider(defaultExtension, defaultSelector, new class implements vscode.SelectionRangeProvider {
provideSelectionRanges() {
return [[
new types.SelectionRange(new types.Range(0, 10, 0, 18), types.SelectionRangeKind.Empty),
new types.SelectionRange(new types.Range(0, 2, 0, 20), types.SelectionRangeKind.Empty)
new types.SelectionRange(new types.Range(0, 10, 0, 18)),
new types.SelectionRange(new types.Range(0, 2, 0, 20))
]];
}
}));
Expand Down

0 comments on commit 6892cfc

Please sign in to comment.