提交 5b957666 编写于 作者: A Alex Dima

Clarify file names

上级 5bc9073f
...@@ -9,7 +9,7 @@ import * as platform from 'vs/base/common/platform'; ...@@ -9,7 +9,7 @@ import * as platform from 'vs/base/common/platform';
import * as strings from 'vs/base/common/strings'; import * as strings from 'vs/base/common/strings';
import { FastDomNode, createFastDomNode } from 'vs/base/browser/fastDomNode'; import { FastDomNode, createFastDomNode } from 'vs/base/browser/fastDomNode';
import { IConfiguration } from 'vs/editor/common/editorCommon'; import { IConfiguration } from 'vs/editor/common/editorCommon';
import { Decoration } from 'vs/editor/common/viewLayout/viewLineParts'; import { LineDecoration } from 'vs/editor/common/viewLayout/lineDecorations';
import { renderViewLine, RenderLineInput, CharacterMapping } from 'vs/editor/common/viewLayout/viewLineRenderer'; import { renderViewLine, RenderLineInput, CharacterMapping } from 'vs/editor/common/viewLayout/viewLineRenderer';
import { ClassNames } from 'vs/editor/browser/editorBrowser'; import { ClassNames } from 'vs/editor/browser/editorBrowser';
import { IVisibleLine } from 'vs/editor/browser/view/viewLayer'; import { IVisibleLine } from 'vs/editor/browser/view/viewLayer';
...@@ -149,7 +149,7 @@ export class ViewLine implements IVisibleLine { ...@@ -149,7 +149,7 @@ export class ViewLine implements IVisibleLine {
const lineData = viewportData.getViewLineRenderingData(lineNumber); const lineData = viewportData.getViewLineRenderingData(lineNumber);
const options = this._options; const options = this._options;
const actualInlineDecorations = Decoration.filter(lineData.inlineDecorations, lineNumber, lineData.minColumn, lineData.maxColumn); const actualInlineDecorations = LineDecoration.filter(lineData.inlineDecorations, lineNumber, lineData.minColumn, lineData.maxColumn);
let renderLineInput = new RenderLineInput( let renderLineInput = new RenderLineInput(
options.useMonospaceOptimizations, options.useMonospaceOptimizations,
lineData.content, lineData.content,
......
...@@ -19,7 +19,7 @@ import { DefaultConfig } from 'vs/editor/common/config/defaultConfig'; ...@@ -19,7 +19,7 @@ import { DefaultConfig } from 'vs/editor/common/config/defaultConfig';
import { Range } from 'vs/editor/common/core/range'; import { Range } from 'vs/editor/common/core/range';
import * as editorCommon from 'vs/editor/common/editorCommon'; import * as editorCommon from 'vs/editor/common/editorCommon';
import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService'; import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService';
import { Decoration } from 'vs/editor/common/viewLayout/viewLineParts'; import { LineDecoration } from 'vs/editor/common/viewLayout/lineDecorations';
import { renderViewLine, RenderLineInput } from 'vs/editor/common/viewLayout/viewLineRenderer'; import { renderViewLine, RenderLineInput } from 'vs/editor/common/viewLayout/viewLineRenderer';
import * as editorBrowser from 'vs/editor/browser/editorBrowser'; import * as editorBrowser from 'vs/editor/browser/editorBrowser';
import { CodeEditor } from 'vs/editor/browser/codeEditor'; import { CodeEditor } from 'vs/editor/browser/codeEditor';
...@@ -1903,7 +1903,7 @@ class InlineViewZonesComputer extends ViewZonesComputer { ...@@ -1903,7 +1903,7 @@ class InlineViewZonesComputer extends ViewZonesComputer {
private renderOriginalLine(count: number, originalModel: editorCommon.IModel, config: editorCommon.InternalEditorOptions, tabSize: number, lineNumber: number, decorations: InlineDecoration[]): string[] { private renderOriginalLine(count: number, originalModel: editorCommon.IModel, config: editorCommon.InternalEditorOptions, tabSize: number, lineNumber: number, decorations: InlineDecoration[]): string[] {
let lineContent = originalModel.getLineContent(lineNumber); let lineContent = originalModel.getLineContent(lineNumber);
let actualDecorations = Decoration.filter(decorations, lineNumber, 1, lineContent.length + 1); let actualDecorations = LineDecoration.filter(decorations, lineNumber, 1, lineContent.length + 1);
const defaultMetadata = ( const defaultMetadata = (
(FontStyle.None << MetadataConsts.FONT_STYLE_OFFSET) (FontStyle.None << MetadataConsts.FONT_STYLE_OFFSET)
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
import { InlineDecoration } from 'vs/editor/common/viewModel/viewModel'; import { InlineDecoration } from 'vs/editor/common/viewModel/viewModel';
import { Constants } from 'vs/editor/common/core/uint'; import { Constants } from 'vs/editor/common/core/uint';
export class Decoration { export class LineDecoration {
_decorationBrand: void; _lineDecorationBrand: void;
public readonly startColumn: number; public readonly startColumn: number;
public readonly endColumn: number; public readonly endColumn: number;
...@@ -22,7 +22,7 @@ export class Decoration { ...@@ -22,7 +22,7 @@ export class Decoration {
this.insertsBeforeOrAfter = insertsBeforeOrAfter; this.insertsBeforeOrAfter = insertsBeforeOrAfter;
} }
private static _equals(a: Decoration, b: Decoration): boolean { private static _equals(a: LineDecoration, b: LineDecoration): boolean {
return ( return (
a.startColumn === b.startColumn a.startColumn === b.startColumn
&& a.endColumn === b.endColumn && a.endColumn === b.endColumn
...@@ -31,26 +31,26 @@ export class Decoration { ...@@ -31,26 +31,26 @@ export class Decoration {
); );
} }
public static equalsArr(a: Decoration[], b: Decoration[]): boolean { public static equalsArr(a: LineDecoration[], b: LineDecoration[]): boolean {
let aLen = a.length; let aLen = a.length;
let bLen = b.length; let bLen = b.length;
if (aLen !== bLen) { if (aLen !== bLen) {
return false; return false;
} }
for (let i = 0; i < aLen; i++) { for (let i = 0; i < aLen; i++) {
if (!Decoration._equals(a[i], b[i])) { if (!LineDecoration._equals(a[i], b[i])) {
return false; return false;
} }
} }
return true; return true;
} }
public static filter(lineDecorations: InlineDecoration[], lineNumber: number, minLineColumn: number, maxLineColumn: number): Decoration[] { public static filter(lineDecorations: InlineDecoration[], lineNumber: number, minLineColumn: number, maxLineColumn: number): LineDecoration[] {
if (lineDecorations.length === 0) { if (lineDecorations.length === 0) {
return []; return [];
} }
let result: Decoration[] = [], resultLen = 0; let result: LineDecoration[] = [], resultLen = 0;
for (let i = 0, len = lineDecorations.length; i < len; i++) { for (let i = 0, len = lineDecorations.length; i < len; i++) {
let d = lineDecorations[i]; let d = lineDecorations[i];
...@@ -74,13 +74,13 @@ export class Decoration { ...@@ -74,13 +74,13 @@ export class Decoration {
continue; continue;
} }
result[resultLen++] = new Decoration(startColumn, endColumn, d.inlineClassName, d.insertsBeforeOrAfter); result[resultLen++] = new LineDecoration(startColumn, endColumn, d.inlineClassName, d.insertsBeforeOrAfter);
} }
return result; return result;
} }
public static compare(a: Decoration, b: Decoration): number { public static compare(a: LineDecoration, b: LineDecoration): number {
if (a.startColumn === b.startColumn) { if (a.startColumn === b.startColumn) {
if (a.endColumn === b.endColumn) { if (a.endColumn === b.endColumn) {
if (a.className < b.className) { if (a.className < b.className) {
...@@ -172,7 +172,7 @@ export class LineDecorationsNormalizer { ...@@ -172,7 +172,7 @@ export class LineDecorationsNormalizer {
/** /**
* Normalize line decorations. Overlapping decorations will generate multiple segments * Normalize line decorations. Overlapping decorations will generate multiple segments
*/ */
public static normalize(lineDecorations: Decoration[]): DecorationSegment[] { public static normalize(lineDecorations: LineDecoration[]): DecorationSegment[] {
if (lineDecorations.length === 0) { if (lineDecorations.length === 0) {
return []; return [];
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
import { ViewLineToken } from 'vs/editor/common/core/viewLineToken'; import { ViewLineToken } from 'vs/editor/common/core/viewLineToken';
import { CharCode } from 'vs/base/common/charCode'; import { CharCode } from 'vs/base/common/charCode';
import { Decoration, LineDecorationsNormalizer } from 'vs/editor/common/viewLayout/viewLineParts'; import { LineDecoration, LineDecorationsNormalizer } from 'vs/editor/common/viewLayout/lineDecorations';
import * as strings from 'vs/base/common/strings'; import * as strings from 'vs/base/common/strings';
export const enum RenderWhitespace { export const enum RenderWhitespace {
...@@ -37,7 +37,7 @@ export class RenderLineInput { ...@@ -37,7 +37,7 @@ export class RenderLineInput {
public readonly mightContainRTL: boolean; public readonly mightContainRTL: boolean;
public readonly fauxIndentLength: number; public readonly fauxIndentLength: number;
public readonly lineTokens: ViewLineToken[]; public readonly lineTokens: ViewLineToken[];
public readonly lineDecorations: Decoration[]; public readonly lineDecorations: LineDecoration[];
public readonly tabSize: number; public readonly tabSize: number;
public readonly spaceWidth: number; public readonly spaceWidth: number;
public readonly stopRenderingLineAfter: number; public readonly stopRenderingLineAfter: number;
...@@ -50,7 +50,7 @@ export class RenderLineInput { ...@@ -50,7 +50,7 @@ export class RenderLineInput {
mightContainRTL: boolean, mightContainRTL: boolean,
fauxIndentLength: number, fauxIndentLength: number,
lineTokens: ViewLineToken[], lineTokens: ViewLineToken[],
lineDecorations: Decoration[], lineDecorations: LineDecoration[],
tabSize: number, tabSize: number,
spaceWidth: number, spaceWidth: number,
stopRenderingLineAfter: number, stopRenderingLineAfter: number,
...@@ -87,7 +87,7 @@ export class RenderLineInput { ...@@ -87,7 +87,7 @@ export class RenderLineInput {
&& this.stopRenderingLineAfter === other.stopRenderingLineAfter && this.stopRenderingLineAfter === other.stopRenderingLineAfter
&& this.renderWhitespace === other.renderWhitespace && this.renderWhitespace === other.renderWhitespace
&& this.renderControlCharacters === other.renderControlCharacters && this.renderControlCharacters === other.renderControlCharacters
&& Decoration.equalsArr(this.lineDecorations, other.lineDecorations) && LineDecoration.equalsArr(this.lineDecorations, other.lineDecorations)
&& ViewLineToken.equalsArr(this.lineTokens, other.lineTokens) && ViewLineToken.equalsArr(this.lineTokens, other.lineTokens)
); );
} }
...@@ -493,8 +493,8 @@ function _applyRenderWhitespace(lineContent: string, len: number, tokens: LinePa ...@@ -493,8 +493,8 @@ function _applyRenderWhitespace(lineContent: string, len: number, tokens: LinePa
* Inline decorations are "merged" on top of tokens. * Inline decorations are "merged" on top of tokens.
* Special care must be taken when multiple inline decorations are at play and they overlap. * Special care must be taken when multiple inline decorations are at play and they overlap.
*/ */
function _applyInlineDecorations(lineContent: string, len: number, tokens: LinePart[], _lineDecorations: Decoration[]): LinePart[] { function _applyInlineDecorations(lineContent: string, len: number, tokens: LinePart[], _lineDecorations: LineDecoration[]): LinePart[] {
_lineDecorations.sort(Decoration.compare); _lineDecorations.sort(LineDecoration.compare);
const lineDecorations = LineDecorationsNormalizer.normalize(_lineDecorations); const lineDecorations = LineDecorationsNormalizer.normalize(_lineDecorations);
const lineDecorationsLen = lineDecorations.length; const lineDecorationsLen = lineDecorations.length;
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
'use strict'; 'use strict';
import * as assert from 'assert'; import * as assert from 'assert';
import { DecorationSegment, LineDecorationsNormalizer, Decoration } from 'vs/editor/common/viewLayout/viewLineParts'; import { DecorationSegment, LineDecorationsNormalizer, LineDecoration } from 'vs/editor/common/viewLayout/lineDecorations';
import { Range } from 'vs/editor/common/core/range'; import { Range } from 'vs/editor/common/core/range';
import { InlineDecoration } from 'vs/editor/common/viewModel/viewModel'; import { InlineDecoration } from 'vs/editor/common/viewModel/viewModel';
...@@ -18,8 +18,8 @@ suite('Editor ViewLayout - ViewLineParts', () => { ...@@ -18,8 +18,8 @@ suite('Editor ViewLayout - ViewLineParts', () => {
test('Bug 9827:Overlapping inline decorations can cause wrong inline class to be applied', () => { test('Bug 9827:Overlapping inline decorations can cause wrong inline class to be applied', () => {
var result = LineDecorationsNormalizer.normalize([ var result = LineDecorationsNormalizer.normalize([
new Decoration(1, 11, 'c1', false), new LineDecoration(1, 11, 'c1', false),
new Decoration(3, 4, 'c2', false) new LineDecoration(3, 4, 'c2', false)
]); ]);
assert.deepEqual(result, [ assert.deepEqual(result, [
...@@ -32,8 +32,8 @@ suite('Editor ViewLayout - ViewLineParts', () => { ...@@ -32,8 +32,8 @@ suite('Editor ViewLayout - ViewLineParts', () => {
test('issue #3462: no whitespace shown at the end of a decorated line', () => { test('issue #3462: no whitespace shown at the end of a decorated line', () => {
var result = LineDecorationsNormalizer.normalize([ var result = LineDecorationsNormalizer.normalize([
new Decoration(15, 21, 'vs-whitespace', false), new LineDecoration(15, 21, 'vs-whitespace', false),
new Decoration(20, 21, 'inline-folded', false), new LineDecoration(20, 21, 'inline-folded', false),
]); ]);
assert.deepEqual(result, [ assert.deepEqual(result, [
...@@ -44,77 +44,77 @@ suite('Editor ViewLayout - ViewLineParts', () => { ...@@ -44,77 +44,77 @@ suite('Editor ViewLayout - ViewLineParts', () => {
test('issue #3661: Link decoration bleeds to next line when wrapping', () => { test('issue #3661: Link decoration bleeds to next line when wrapping', () => {
let result = Decoration.filter([ let result = LineDecoration.filter([
newDecoration(2, 12, 3, 30, 'detected-link') newDecoration(2, 12, 3, 30, 'detected-link')
], 3, 12, 500); ], 3, 12, 500);
assert.deepEqual(result, [ assert.deepEqual(result, [
new Decoration(12, 30, 'detected-link', false), new LineDecoration(12, 30, 'detected-link', false),
]); ]);
}); });
test('ViewLineParts', () => { test('ViewLineParts', () => {
assert.deepEqual(LineDecorationsNormalizer.normalize([ assert.deepEqual(LineDecorationsNormalizer.normalize([
new Decoration(1, 2, 'c1', false), new LineDecoration(1, 2, 'c1', false),
new Decoration(3, 4, 'c2', false) new LineDecoration(3, 4, 'c2', false)
]), [ ]), [
new DecorationSegment(0, 0, 'c1'), new DecorationSegment(0, 0, 'c1'),
new DecorationSegment(2, 2, 'c2') new DecorationSegment(2, 2, 'c2')
]); ]);
assert.deepEqual(LineDecorationsNormalizer.normalize([ assert.deepEqual(LineDecorationsNormalizer.normalize([
new Decoration(1, 3, 'c1', false), new LineDecoration(1, 3, 'c1', false),
new Decoration(3, 4, 'c2', false) new LineDecoration(3, 4, 'c2', false)
]), [ ]), [
new DecorationSegment(0, 1, 'c1'), new DecorationSegment(0, 1, 'c1'),
new DecorationSegment(2, 2, 'c2') new DecorationSegment(2, 2, 'c2')
]); ]);
assert.deepEqual(LineDecorationsNormalizer.normalize([ assert.deepEqual(LineDecorationsNormalizer.normalize([
new Decoration(1, 4, 'c1', false), new LineDecoration(1, 4, 'c1', false),
new Decoration(3, 4, 'c2', false) new LineDecoration(3, 4, 'c2', false)
]), [ ]), [
new DecorationSegment(0, 1, 'c1'), new DecorationSegment(0, 1, 'c1'),
new DecorationSegment(2, 2, 'c1 c2') new DecorationSegment(2, 2, 'c1 c2')
]); ]);
assert.deepEqual(LineDecorationsNormalizer.normalize([ assert.deepEqual(LineDecorationsNormalizer.normalize([
new Decoration(1, 4, 'c1', false), new LineDecoration(1, 4, 'c1', false),
new Decoration(1, 4, 'c1*', false), new LineDecoration(1, 4, 'c1*', false),
new Decoration(3, 4, 'c2', false) new LineDecoration(3, 4, 'c2', false)
]), [ ]), [
new DecorationSegment(0, 1, 'c1 c1*'), new DecorationSegment(0, 1, 'c1 c1*'),
new DecorationSegment(2, 2, 'c1 c1* c2') new DecorationSegment(2, 2, 'c1 c1* c2')
]); ]);
assert.deepEqual(LineDecorationsNormalizer.normalize([ assert.deepEqual(LineDecorationsNormalizer.normalize([
new Decoration(1, 4, 'c1', false), new LineDecoration(1, 4, 'c1', false),
new Decoration(1, 4, 'c1*', false), new LineDecoration(1, 4, 'c1*', false),
new Decoration(1, 4, 'c1**', false), new LineDecoration(1, 4, 'c1**', false),
new Decoration(3, 4, 'c2', false) new LineDecoration(3, 4, 'c2', false)
]), [ ]), [
new DecorationSegment(0, 1, 'c1 c1* c1**'), new DecorationSegment(0, 1, 'c1 c1* c1**'),
new DecorationSegment(2, 2, 'c1 c1* c1** c2') new DecorationSegment(2, 2, 'c1 c1* c1** c2')
]); ]);
assert.deepEqual(LineDecorationsNormalizer.normalize([ assert.deepEqual(LineDecorationsNormalizer.normalize([
new Decoration(1, 4, 'c1', false), new LineDecoration(1, 4, 'c1', false),
new Decoration(1, 4, 'c1*', false), new LineDecoration(1, 4, 'c1*', false),
new Decoration(1, 4, 'c1**', false), new LineDecoration(1, 4, 'c1**', false),
new Decoration(3, 4, 'c2', false), new LineDecoration(3, 4, 'c2', false),
new Decoration(3, 4, 'c2*', false) new LineDecoration(3, 4, 'c2*', false)
]), [ ]), [
new DecorationSegment(0, 1, 'c1 c1* c1**'), new DecorationSegment(0, 1, 'c1 c1* c1**'),
new DecorationSegment(2, 2, 'c1 c1* c1** c2 c2*') new DecorationSegment(2, 2, 'c1 c1* c1** c2 c2*')
]); ]);
assert.deepEqual(LineDecorationsNormalizer.normalize([ assert.deepEqual(LineDecorationsNormalizer.normalize([
new Decoration(1, 4, 'c1', false), new LineDecoration(1, 4, 'c1', false),
new Decoration(1, 4, 'c1*', false), new LineDecoration(1, 4, 'c1*', false),
new Decoration(1, 4, 'c1**', false), new LineDecoration(1, 4, 'c1**', false),
new Decoration(3, 4, 'c2', false), new LineDecoration(3, 4, 'c2', false),
new Decoration(3, 5, 'c2*', false) new LineDecoration(3, 5, 'c2*', false)
]), [ ]), [
new DecorationSegment(0, 1, 'c1 c1* c1**'), new DecorationSegment(0, 1, 'c1 c1* c1**'),
new DecorationSegment(2, 2, 'c1 c1* c1** c2 c2*'), new DecorationSegment(2, 2, 'c1 c1* c1** c2 c2*'),
......
...@@ -9,7 +9,7 @@ import { renderViewLine, RenderLineInput, CharacterMapping } from 'vs/editor/com ...@@ -9,7 +9,7 @@ import { renderViewLine, RenderLineInput, CharacterMapping } from 'vs/editor/com
import { ViewLineToken } from 'vs/editor/common/core/viewLineToken'; import { ViewLineToken } from 'vs/editor/common/core/viewLineToken';
import { CharCode } from 'vs/base/common/charCode'; import { CharCode } from 'vs/base/common/charCode';
import { MetadataConsts } from 'vs/editor/common/modes'; import { MetadataConsts } from 'vs/editor/common/modes';
import { Decoration } from 'vs/editor/common/viewLayout/viewLineParts'; import { LineDecoration } from 'vs/editor/common/viewLayout/lineDecorations';
suite('viewLineRenderer.renderLine', () => { suite('viewLineRenderer.renderLine', () => {
...@@ -639,7 +639,7 @@ suite('viewLineRenderer.renderLine 2', () => { ...@@ -639,7 +639,7 @@ suite('viewLineRenderer.renderLine 2', () => {
false, false,
0, 0,
[createPart(21, 3)], [createPart(21, 3)],
[new Decoration(1, 22, 'link', false)], [new LineDecoration(1, 22, 'link', false)],
4, 4,
10, 10,
-1, -1,
...@@ -673,7 +673,7 @@ suite('viewLineRenderer.renderLine 2', () => { ...@@ -673,7 +673,7 @@ suite('viewLineRenderer.renderLine 2', () => {
createPart(84, 6), createPart(84, 6),
], ],
[ [
new Decoration(13, 51, 'detected-link', false) new LineDecoration(13, 51, 'detected-link', false)
], ],
4, 4,
10, 10,
...@@ -930,9 +930,9 @@ suite('viewLineRenderer.renderLine 2', () => { ...@@ -930,9 +930,9 @@ suite('viewLineRenderer.renderLine 2', () => {
0, 0,
[createPart(11, 0)], [createPart(11, 0)],
[ [
new Decoration(5, 7, 'a', false), new LineDecoration(5, 7, 'a', false),
new Decoration(1, 3, 'b', false), new LineDecoration(1, 3, 'b', false),
new Decoration(2, 8, 'c', false), new LineDecoration(2, 8, 'c', false),
], ],
4, 4,
10, 10,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册