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

Clarify file names

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