Skip to content

Commit

Permalink
💄 remove unused kind-property from SelectionRange
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed May 27, 2019
1 parent a1a7af5 commit 6526507
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 19 deletions.
1 change: 0 additions & 1 deletion src/vs/editor/common/modes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,6 @@ export interface DocumentColorProvider {
}

export interface SelectionRange {
kind: string;
range: IRange;
}

Expand Down
12 changes: 6 additions & 6 deletions src/vs/editor/contrib/smartSelect/bracketSelections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ export class BracketSelectionRangeProvider implements SelectionRangeProvider {
}
const innerBracket = Range.fromPositions(bracket.range.getEndPosition(), closing!.getStartPosition());
const outerBracket = Range.fromPositions(bracket.range.getStartPosition(), closing!.getEndPosition());
bucket.push({ range: innerBracket, kind: 'statement.brackets' });
bucket.push({ range: outerBracket, kind: 'statement.brackets.full' });
bucket.push({ range: innerBracket });
bucket.push({ range: outerBracket });
BracketSelectionRangeProvider._addBracketLeading(model, outerBracket, bucket);
}
}
Expand All @@ -135,8 +135,8 @@ export class BracketSelectionRangeProvider implements SelectionRangeProvider {
const startLine = bracket.startLineNumber;
const column = model.getLineFirstNonWhitespaceColumn(startLine);
if (column !== 0 && column !== bracket.startColumn) {
bucket.push({ range: Range.fromPositions(new Position(startLine, column), bracket.getEndPosition()), kind: 'statement.brackets.leading' });
bucket.push({ range: Range.fromPositions(new Position(startLine, 1), bracket.getEndPosition()), kind: 'statement.brackets.leading.full' });
bucket.push({ range: Range.fromPositions(new Position(startLine, column), bracket.getEndPosition()) });
bucket.push({ range: Range.fromPositions(new Position(startLine, 1), bracket.getEndPosition()) });
}

// xxxxxxxx
Expand All @@ -147,8 +147,8 @@ export class BracketSelectionRangeProvider implements SelectionRangeProvider {
if (aboveLine > 0) {
const column = model.getLineFirstNonWhitespaceColumn(aboveLine);
if (column === bracket.startColumn && column !== model.getLineLastNonWhitespaceColumn(aboveLine)) {
bucket.push({ range: Range.fromPositions(new Position(aboveLine, column), bracket.getEndPosition()), kind: 'statement.brackets.leading' });
bucket.push({ range: Range.fromPositions(new Position(aboveLine, 1), bracket.getEndPosition()), kind: 'statement.brackets.leading.full' });
bucket.push({ range: Range.fromPositions(new Position(aboveLine, column), bracket.getEndPosition()) });
bucket.push({ range: Range.fromPositions(new Position(aboveLine, 1), bracket.getEndPosition()) });
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/vs/editor/contrib/smartSelect/test/smartSelect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,9 @@ suite('SmartSelect', () => {
const reg = SelectionRangeRegistry.register('*', {
provideSelectionRanges() {
return [[
{ range: { startLineNumber: 1, startColumn: 10, endLineNumber: 1, endColumn: 11 }, kind: 'somekind' },
{ range: { startLineNumber: 1, startColumn: 10, endLineNumber: 3, endColumn: 2 }, kind: 'somekind' },
{ range: { startLineNumber: 1, startColumn: 1, endLineNumber: 3, endColumn: 2 }, kind: 'somekind' },
{ range: { startLineNumber: 1, startColumn: 10, endLineNumber: 1, endColumn: 11 } },
{ range: { startLineNumber: 1, startColumn: 10, endLineNumber: 3, endColumn: 2 } },
{ range: { startLineNumber: 1, startColumn: 1, endLineNumber: 3, endColumn: 2 } },
]];
}
});
Expand Down
8 changes: 4 additions & 4 deletions src/vs/editor/contrib/smartSelect/wordSelections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class WordSelectionRangeProvider implements SelectionRangeProvider {
this._addInWordRanges(bucket, model, position);
this._addWordRanges(bucket, model, position);
this._addWhitespaceLine(bucket, model, position);
bucket.push({ range: model.getFullModelRange(), kind: 'statement.all' });
bucket.push({ range: model.getFullModelRange() });
}
return result;
}
Expand Down Expand Up @@ -65,14 +65,14 @@ export class WordSelectionRangeProvider implements SelectionRangeProvider {
}

if (start < end) {
bucket.push({ range: new Range(pos.lineNumber, startColumn + start, pos.lineNumber, startColumn + end), kind: 'statement.word.part' });
bucket.push({ range: new Range(pos.lineNumber, startColumn + start, pos.lineNumber, startColumn + end) });
}
}

private _addWordRanges(bucket: SelectionRange[], model: ITextModel, pos: Position): void {
const word = model.getWordAtPosition(pos);
if (word) {
bucket.push({ range: new Range(pos.lineNumber, word.startColumn, pos.lineNumber, word.endColumn), kind: 'statement.word' });
bucket.push({ range: new Range(pos.lineNumber, word.startColumn, pos.lineNumber, word.endColumn) });
}
}

Expand All @@ -81,7 +81,7 @@ export class WordSelectionRangeProvider implements SelectionRangeProvider {
&& model.getLineFirstNonWhitespaceColumn(pos.lineNumber) === 0
&& model.getLineLastNonWhitespaceColumn(pos.lineNumber) === 0
) {
bucket.push({ range: new Range(pos.lineNumber, 1, pos.lineNumber, model.getLineMaxColumn(pos.lineNumber)), kind: 'statement.line' });
bucket.push({ range: new Range(pos.lineNumber, 1, pos.lineNumber, model.getLineMaxColumn(pos.lineNumber)) });
}
}
}
1 change: 0 additions & 1 deletion src/vs/monaco.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5343,7 +5343,6 @@ declare namespace monaco.languages {
}

export interface SelectionRange {
kind: string;
range: IRange;
}

Expand Down
5 changes: 1 addition & 4 deletions src/vs/workbench/api/common/extHostTypeConverters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -859,10 +859,7 @@ export namespace Color {

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

export function to(obj: modes.SelectionRange): vscode.SelectionRange {
Expand Down

0 comments on commit 6526507

Please sign in to comment.