Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
5b957666
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
5b957666
编写于
3月 03, 2017
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clarify file names
上级
5bc9073f
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
56 addition
and
56 deletion
+56
-56
src/vs/editor/browser/viewParts/lines/viewLine.ts
src/vs/editor/browser/viewParts/lines/viewLine.ts
+2
-2
src/vs/editor/browser/widget/diffEditorWidget.ts
src/vs/editor/browser/widget/diffEditorWidget.ts
+2
-2
src/vs/editor/common/viewLayout/lineDecorations.ts
src/vs/editor/common/viewLayout/lineDecorations.ts
+10
-10
src/vs/editor/common/viewLayout/viewLineRenderer.ts
src/vs/editor/common/viewLayout/viewLineRenderer.ts
+6
-6
src/vs/editor/test/common/viewLayout/lineDecorations.test.ts
src/vs/editor/test/common/viewLayout/lineDecorations.test.ts
+30
-30
src/vs/editor/test/common/viewLayout/viewLineRenderer.test.ts
...vs/editor/test/common/viewLayout/viewLineRenderer.test.ts
+6
-6
未找到文件。
src/vs/editor/browser/viewParts/lines/viewLine.ts
浏览文件 @
5b957666
...
...
@@ -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/viewLinePart
s
'
;
import
{
LineDecoration
}
from
'
vs/editor/common/viewLayout/lineDecoration
s
'
;
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
=
Line
Decoration
.
filter
(
lineData
.
inlineDecorations
,
lineNumber
,
lineData
.
minColumn
,
lineData
.
maxColumn
);
let
renderLineInput
=
new
RenderLineInput
(
options
.
useMonospaceOptimizations
,
lineData
.
content
,
...
...
src/vs/editor/browser/widget/diffEditorWidget.ts
浏览文件 @
5b957666
...
...
@@ -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/viewLinePart
s
'
;
import
{
LineDecoration
}
from
'
vs/editor/common/viewLayout/lineDecoration
s
'
;
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
=
Line
Decoration
.
filter
(
decorations
,
lineNumber
,
1
,
lineContent
.
length
+
1
);
const
defaultMetadata
=
(
(
FontStyle
.
None
<<
MetadataConsts
.
FONT_STYLE_OFFSET
)
...
...
src/vs/editor/common/viewLayout/
viewLinePart
s.ts
→
src/vs/editor/common/viewLayout/
lineDecoration
s.ts
浏览文件 @
5b957666
...
...
@@ -7,8 +7,8 @@
import
{
InlineDecoration
}
from
'
vs/editor/common/viewModel/viewModel
'
;
import
{
Constants
}
from
'
vs/editor/common/core/uint
'
;
export
class
Decoration
{
_
d
ecorationBrand
:
void
;
export
class
Line
Decoration
{
_
lineD
ecorationBrand
:
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
:
Line
Decoration
):
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
:
Line
Decoration
[]):
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
(
!
Line
Decoration
.
_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
):
Line
Decoration
[]
{
if
(
lineDecorations
.
length
===
0
)
{
return
[];
}
let
result
:
Decoration
[]
=
[],
resultLen
=
0
;
let
result
:
Line
Decoration
[]
=
[],
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
Line
Decoration
(
startColumn
,
endColumn
,
d
.
inlineClassName
,
d
.
insertsBeforeOrAfter
);
}
return
result
;
}
public
static
compare
(
a
:
Decoration
,
b
:
Decoration
):
number
{
public
static
compare
(
a
:
LineDecoration
,
b
:
Line
Decoration
):
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
:
Line
Decoration
[]):
DecorationSegment
[]
{
if
(
lineDecorations
.
length
===
0
)
{
return
[];
}
...
...
src/vs/editor/common/viewLayout/viewLineRenderer.ts
浏览文件 @
5b957666
...
...
@@ -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/viewLinePart
s
'
;
import
{
LineDecoration
,
LineDecorationsNormalizer
}
from
'
vs/editor/common/viewLayout/lineDecoration
s
'
;
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
:
Line
Decoration
[];
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
:
Line
Decoration
[],
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
)
&&
Line
Decoration
.
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
:
Line
Decoration
[]):
LinePart
[]
{
_lineDecorations
.
sort
(
Line
Decoration
.
compare
);
const
lineDecorations
=
LineDecorationsNormalizer
.
normalize
(
_lineDecorations
);
const
lineDecorationsLen
=
lineDecorations
.
length
;
...
...
src/vs/editor/test/common/viewLayout/
viewLinePart
s.test.ts
→
src/vs/editor/test/common/viewLayout/
lineDecoration
s.test.ts
浏览文件 @
5b957666
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
*
as
assert
from
'
assert
'
;
import
{
DecorationSegment
,
LineDecorationsNormalizer
,
Decoration
}
from
'
vs/editor/common/viewLayout/viewLinePart
s
'
;
import
{
DecorationSegment
,
LineDecorationsNormalizer
,
LineDecoration
}
from
'
vs/editor/common/viewLayout/lineDecoration
s
'
;
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
Line
Decoration
(
1
,
11
,
'
c1
'
,
false
),
new
Line
Decoration
(
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
Line
Decoration
(
15
,
21
,
'
vs-whitespace
'
,
false
),
new
Line
Decoration
(
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
=
Line
Decoration
.
filter
([
newDecoration
(
2
,
12
,
3
,
30
,
'
detected-link
'
)
],
3
,
12
,
500
);
assert
.
deepEqual
(
result
,
[
new
Decoration
(
12
,
30
,
'
detected-link
'
,
false
),
new
Line
Decoration
(
12
,
30
,
'
detected-link
'
,
false
),
]);
});
test
(
'
ViewLineParts
'
,
()
=>
{
assert
.
deepEqual
(
LineDecorationsNormalizer
.
normalize
([
new
Decoration
(
1
,
2
,
'
c1
'
,
false
),
new
Decoration
(
3
,
4
,
'
c2
'
,
false
)
new
Line
Decoration
(
1
,
2
,
'
c1
'
,
false
),
new
Line
Decoration
(
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
Line
Decoration
(
1
,
3
,
'
c1
'
,
false
),
new
Line
Decoration
(
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
Line
Decoration
(
1
,
4
,
'
c1
'
,
false
),
new
Line
Decoration
(
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
Line
Decoration
(
1
,
4
,
'
c1
'
,
false
),
new
Line
Decoration
(
1
,
4
,
'
c1*
'
,
false
),
new
Line
Decoration
(
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
Line
Decoration
(
1
,
4
,
'
c1
'
,
false
),
new
Line
Decoration
(
1
,
4
,
'
c1*
'
,
false
),
new
Line
Decoration
(
1
,
4
,
'
c1**
'
,
false
),
new
Line
Decoration
(
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
Line
Decoration
(
1
,
4
,
'
c1
'
,
false
),
new
Line
Decoration
(
1
,
4
,
'
c1*
'
,
false
),
new
Line
Decoration
(
1
,
4
,
'
c1**
'
,
false
),
new
Line
Decoration
(
3
,
4
,
'
c2
'
,
false
),
new
Line
Decoration
(
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
Line
Decoration
(
1
,
4
,
'
c1
'
,
false
),
new
Line
Decoration
(
1
,
4
,
'
c1*
'
,
false
),
new
Line
Decoration
(
1
,
4
,
'
c1**
'
,
false
),
new
Line
Decoration
(
3
,
4
,
'
c2
'
,
false
),
new
Line
Decoration
(
3
,
5
,
'
c2*
'
,
false
)
]),
[
new
DecorationSegment
(
0
,
1
,
'
c1 c1* c1**
'
),
new
DecorationSegment
(
2
,
2
,
'
c1 c1* c1** c2 c2*
'
),
...
...
src/vs/editor/test/common/viewLayout/viewLineRenderer.test.ts
浏览文件 @
5b957666
...
...
@@ -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/viewLinePart
s
'
;
import
{
LineDecoration
}
from
'
vs/editor/common/viewLayout/lineDecoration
s
'
;
suite
(
'
viewLineRenderer.renderLine
'
,
()
=>
{
...
...
@@ -639,7 +639,7 @@ suite('viewLineRenderer.renderLine 2', () => {
false
,
0
,
[
createPart
(
21
,
3
)],
[
new
Decoration
(
1
,
22
,
'
link
'
,
false
)],
[
new
Line
Decoration
(
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
Line
Decoration
(
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
Line
Decoration
(
5
,
7
,
'
a
'
,
false
),
new
Line
Decoration
(
1
,
3
,
'
b
'
,
false
),
new
Line
Decoration
(
2
,
8
,
'
c
'
,
false
),
],
4
,
10
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录