Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
14673191
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
14673191
编写于
3月 24, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Cache configuration in view parts
上级
07b89fa3
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
167 addition
and
40 deletion
+167
-40
src/vs/editor/browser/view/viewOverlays.ts
src/vs/editor/browser/view/viewOverlays.ts
+7
-3
src/vs/editor/browser/viewLayout/layoutProvider.ts
src/vs/editor/browser/viewLayout/layoutProvider.ts
+2
-2
src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts
...editor/browser/viewParts/contentWidgets/contentWidgets.ts
+7
-2
src/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.ts
...er/viewParts/currentLineHighlight/currentLineHighlight.ts
+13
-2
src/vs/editor/browser/viewParts/decorations/decorations.ts
src/vs/editor/browser/viewParts/decorations/decorations.ts
+7
-2
src/vs/editor/browser/viewParts/glyphMargin/glyphMargin.ts
src/vs/editor/browser/viewParts/glyphMargin/glyphMargin.ts
+12
-2
src/vs/editor/browser/viewParts/lineNumbers/lineNumbers.ts
src/vs/editor/browser/viewParts/lineNumbers/lineNumbers.ts
+13
-3
src/vs/editor/browser/viewParts/lines/viewLine.ts
src/vs/editor/browser/viewParts/lines/viewLine.ts
+32
-10
src/vs/editor/browser/viewParts/lines/viewLines.ts
src/vs/editor/browser/viewParts/lines/viewLines.ts
+22
-4
src/vs/editor/browser/viewParts/linesDecorations/linesDecorations.ts
...or/browser/viewParts/linesDecorations/linesDecorations.ts
+6
-1
src/vs/editor/browser/viewParts/scrollDecoration/scrollDecoration.ts
...or/browser/viewParts/scrollDecoration/scrollDecoration.ts
+6
-1
src/vs/editor/browser/viewParts/selections/selections.ts
src/vs/editor/browser/viewParts/selections/selections.ts
+13
-3
src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts
src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts
+22
-3
src/vs/editor/browser/viewParts/viewZones/viewZones.ts
src/vs/editor/browser/viewParts/viewZones/viewZones.ts
+5
-2
未找到文件。
src/vs/editor/browser/view/viewOverlays.ts
浏览文件 @
14673191
...
...
@@ -90,9 +90,11 @@ class ViewOverlayLine implements IVisibleLineData {
private
_dynamicOverlays
:
editorBrowser
.
IDynamicViewOverlay
[];
private
_domNode
:
HTMLElement
;
private
_renderPieces
:
string
;
private
_lineHeight
:
number
;
constructor
(
context
:
editorBrowser
.
IViewContext
,
dynamicOverlays
:
editorBrowser
.
IDynamicViewOverlay
[])
{
this
.
_context
=
context
;
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
this
.
_dynamicOverlays
=
dynamicOverlays
;
this
.
_domNode
=
null
;
...
...
@@ -122,7 +124,9 @@ class ViewOverlayLine implements IVisibleLineData {
// Nothing
}
onConfigurationChanged
(
e
:
IConfigurationChangedEvent
):
void
{
// Nothing
if
(
e
.
lineHeight
)
{
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
}
}
shouldUpdateHTML
(
startLineNumber
:
number
,
lineNumber
:
number
,
inlineDecorations
:
IModelDecoration
[]):
boolean
{
...
...
@@ -146,7 +150,7 @@ class ViewOverlayLine implements IVisibleLineData {
out
.
push
(
'
" style="top:
'
);
out
.
push
(
deltaTop
.
toString
());
out
.
push
(
'
px;height:
'
);
out
.
push
(
this
.
_
context
.
configuration
.
editor
.
lineHeight
.
toString
());
out
.
push
(
this
.
_lineHeight
.
toString
());
out
.
push
(
'
px;" class="
'
);
out
.
push
(
editorBrowser
.
ClassNames
.
VIEW_LINE
);
out
.
push
(
'
">
'
);
...
...
@@ -164,7 +168,7 @@ class ViewOverlayLine implements IVisibleLineData {
this
.
_domNode
.
setAttribute
(
'
lineNumber
'
,
lineNumber
.
toString
());
}
StyleMutator
.
setTop
(
this
.
_domNode
,
deltaTop
);
StyleMutator
.
setHeight
(
this
.
_domNode
,
this
.
_
context
.
configuration
.
editor
.
lineHeight
);
StyleMutator
.
setHeight
(
this
.
_domNode
,
this
.
_lineHeight
);
}
}
...
...
src/vs/editor/browser/viewLayout/layoutProvider.ts
浏览文件 @
14673191
...
...
@@ -107,8 +107,8 @@ export class LayoutProvider extends ViewEventHandler implements IDisposable, ILa
return
{
top
:
this
.
scrollable
.
getScrollTop
(),
left
:
this
.
scrollable
.
getScrollLeft
(),
width
:
this
.
configuration
.
editor
.
layoutInfo
.
contentWidth
,
height
:
this
.
configuration
.
editor
.
layoutInfo
.
contentHeight
width
:
this
.
scrollable
.
getWidth
()
,
height
:
this
.
scrollable
.
getHeight
()
};
}
...
...
src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts
浏览文件 @
14673191
...
...
@@ -46,6 +46,7 @@ export class ViewContentWidgets extends ViewPart {
private
_widgets
:
IWidgetMap
;
private
_contentWidth
:
number
;
private
_contentLeft
:
number
;
private
_lineHeight
:
number
;
public
domNode
:
HTMLElement
;
public
overflowingContentWidgetsDomNode
:
HTMLElement
;
...
...
@@ -58,6 +59,7 @@ export class ViewContentWidgets extends ViewPart {
this
.
_widgets
=
{};
this
.
_contentWidth
=
0
;
this
.
_contentLeft
=
0
;
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
this
.
domNode
=
document
.
createElement
(
'
div
'
);
this
.
domNode
.
className
=
ClassNames
.
CONTENT_WIDGETS
;
...
...
@@ -100,6 +102,9 @@ export class ViewContentWidgets extends ViewPart {
return
false
;
}
public
onConfigurationChanged
(
e
:
editorCommon
.
IConfigurationChangedEvent
):
boolean
{
if
(
e
.
lineHeight
)
{
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
}
return
true
;
}
public
onLayoutChanged
(
layoutInfo
:
editorCommon
.
IEditorLayoutInfo
):
boolean
{
...
...
@@ -200,7 +205,7 @@ export class ViewContentWidgets extends ViewPart {
let
heightAboveLine
=
aboveLineTop
;
// b) the box under the line
let
underLineTop
=
visibleRange
.
top
+
this
.
_
context
.
configuration
.
editor
.
lineHeight
;
let
underLineTop
=
visibleRange
.
top
+
this
.
_lineHeight
;
let
heightUnderLine
=
ctx
.
viewportHeight
-
underLineTop
;
let
aboveTop
=
aboveLineTop
-
height
;
...
...
@@ -243,7 +248,7 @@ export class ViewContentWidgets extends ViewPart {
}
let
aboveTop
=
visibleRange
.
top
-
height
,
belowTop
=
visibleRange
.
top
+
this
.
_
context
.
configuration
.
editor
.
lineHeight
,
belowTop
=
visibleRange
.
top
+
this
.
_lineHeight
,
left
=
left0
+
this
.
_contentLeft
;
let
domNodePosition
=
dom
.
getDomNodePosition
(
this
.
_viewDomNode
);
...
...
src/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.ts
浏览文件 @
14673191
...
...
@@ -12,6 +12,8 @@ import {IDynamicViewOverlay, ILayoutProvider, IRenderingContext, IViewContext} f
export
class
CurrentLineHighlightOverlay
extends
ViewEventHandler
implements
IDynamicViewOverlay
{
private
_context
:
IViewContext
;
private
_lineHeight
:
number
;
private
_readOnly
:
boolean
;
private
_layoutProvider
:
ILayoutProvider
;
private
_selectionIsEmpty
:
boolean
;
private
_primaryCursorIsInEditableRange
:
boolean
;
...
...
@@ -21,6 +23,9 @@ export class CurrentLineHighlightOverlay extends ViewEventHandler implements IDy
constructor
(
context
:
IViewContext
,
layoutProvider
:
ILayoutProvider
)
{
super
();
this
.
_context
=
context
;
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
this
.
_readOnly
=
this
.
_context
.
configuration
.
editor
.
readOnly
;
this
.
_layoutProvider
=
layoutProvider
;
this
.
_selectionIsEmpty
=
true
;
...
...
@@ -72,6 +77,12 @@ export class CurrentLineHighlightOverlay extends ViewEventHandler implements IDy
return
false
;
}
public
onConfigurationChanged
(
e
:
editorCommon
.
IConfigurationChangedEvent
):
boolean
{
if
(
e
.
lineHeight
)
{
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
}
if
(
e
.
readOnly
)
{
this
.
_readOnly
=
this
.
_context
.
configuration
.
editor
.
readOnly
;
}
return
true
;
}
public
onLayoutChanged
(
layoutInfo
:
editorCommon
.
IEditorLayoutInfo
):
boolean
{
...
...
@@ -108,7 +119,7 @@ export class CurrentLineHighlightOverlay extends ViewEventHandler implements IDy
'
<div class="current-line" style="width:
'
+
String
(
this
.
_scrollWidth
)
+
'
px; height:
'
+
String
(
this
.
_
context
.
configuration
.
editor
.
lineHeight
)
+
String
(
this
.
_lineHeight
)
+
'
px;"></div>
'
);
}
else
{
...
...
@@ -119,6 +130,6 @@ export class CurrentLineHighlightOverlay extends ViewEventHandler implements IDy
}
private
_shouldShowCurrentLine
():
boolean
{
return
this
.
_selectionIsEmpty
&&
this
.
_primaryCursorIsInEditableRange
&&
!
this
.
_
context
.
configuration
.
editor
.
readOnly
;
return
this
.
_selectionIsEmpty
&&
this
.
_primaryCursorIsInEditableRange
&&
!
this
.
_readOnly
;
}
}
src/vs/editor/browser/viewParts/decorations/decorations.ts
浏览文件 @
14673191
...
...
@@ -13,11 +13,13 @@ import {IDynamicViewOverlay, IRenderingContext, IViewContext} from 'vs/editor/br
export
class
DecorationsOverlay
extends
ViewEventHandler
implements
IDynamicViewOverlay
{
private
_context
:
IViewContext
;
private
_lineHeight
:
number
;
private
_renderResult
:
string
[];
constructor
(
context
:
IViewContext
)
{
super
();
this
.
_context
=
context
;
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
this
.
_renderResult
=
null
;
this
.
_context
.
addEventHandler
(
this
);
...
...
@@ -56,6 +58,9 @@ export class DecorationsOverlay extends ViewEventHandler implements IDynamicView
return
false
;
}
public
onConfigurationChanged
(
e
:
editorCommon
.
IConfigurationChangedEvent
):
boolean
{
if
(
e
.
lineHeight
)
{
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
}
return
true
;
}
public
onLayoutChanged
(
layoutInfo
:
editorCommon
.
IEditorLayoutInfo
):
boolean
{
...
...
@@ -125,7 +130,7 @@ export class DecorationsOverlay extends ViewEventHandler implements IDynamicView
}
private
_renderWholeLineDecorations
(
ctx
:
IRenderingContext
,
decorations
:
editorCommon
.
IModelDecoration
[],
output
:
string
[]):
void
{
let
lineHeight
=
String
(
this
.
_
context
.
configuration
.
editor
.
lineHeight
);
let
lineHeight
=
String
(
this
.
_lineHeight
);
let
visibleStartLineNumber
=
ctx
.
visibleRange
.
startLineNumber
;
let
visibleEndLineNumber
=
ctx
.
visibleRange
.
endLineNumber
;
...
...
@@ -154,7 +159,7 @@ export class DecorationsOverlay extends ViewEventHandler implements IDynamicView
}
private
_renderNormalDecorations
(
ctx
:
IRenderingContext
,
decorations
:
editorCommon
.
IModelDecoration
[],
output
:
string
[]):
void
{
let
lineHeight
=
String
(
this
.
_
context
.
configuration
.
editor
.
lineHeight
);
let
lineHeight
=
String
(
this
.
_lineHeight
);
let
visibleStartLineNumber
=
ctx
.
visibleRange
.
startLineNumber
;
for
(
let
i
=
0
,
lenI
=
decorations
.
length
;
i
<
lenI
;
i
++
)
{
...
...
src/vs/editor/browser/viewParts/glyphMargin/glyphMargin.ts
浏览文件 @
14673191
...
...
@@ -108,6 +108,8 @@ export abstract class DedupOverlay extends ViewEventHandler {
export
class
GlyphMarginOverlay
extends
DedupOverlay
implements
IDynamicViewOverlay
{
private
_context
:
IViewContext
;
private
_lineHeight
:
number
;
private
_glyphMargin
:
boolean
;
private
_glyphMarginLeft
:
number
;
private
_glyphMarginWidth
:
number
;
private
_renderResult
:
string
[];
...
...
@@ -115,6 +117,8 @@ export class GlyphMarginOverlay extends DedupOverlay implements IDynamicViewOver
constructor
(
context
:
IViewContext
)
{
super
();
this
.
_context
=
context
;
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
this
.
_glyphMargin
=
this
.
_context
.
configuration
.
editor
.
glyphMargin
;
this
.
_glyphMarginLeft
=
0
;
this
.
_glyphMarginWidth
=
0
;
this
.
_renderResult
=
null
;
...
...
@@ -154,6 +158,12 @@ export class GlyphMarginOverlay extends DedupOverlay implements IDynamicViewOver
return
false
;
}
public
onConfigurationChanged
(
e
:
editorCommon
.
IConfigurationChangedEvent
):
boolean
{
if
(
e
.
lineHeight
)
{
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
}
if
(
e
.
glyphMargin
)
{
this
.
_glyphMargin
=
this
.
_context
.
configuration
.
editor
.
glyphMargin
;
}
return
true
;
}
public
onLayoutChanged
(
layoutInfo
:
editorCommon
.
IEditorLayoutInfo
):
boolean
{
...
...
@@ -194,7 +204,7 @@ export class GlyphMarginOverlay extends DedupOverlay implements IDynamicViewOver
}
this
.
shouldRender
=
false
;
if
(
!
this
.
_
context
.
configuration
.
editor
.
glyphMargin
)
{
if
(
!
this
.
_glyphMargin
)
{
this
.
_renderResult
=
null
;
return
false
;
}
...
...
@@ -203,7 +213,7 @@ export class GlyphMarginOverlay extends DedupOverlay implements IDynamicViewOver
let
visibleEndLineNumber
=
ctx
.
visibleRange
.
endLineNumber
;
let
toRender
=
this
.
_render
(
visibleStartLineNumber
,
visibleEndLineNumber
,
this
.
_getDecorations
(
ctx
));
let
lineHeight
=
this
.
_
context
.
configuration
.
editor
.
lineHeight
.
toString
();
let
lineHeight
=
this
.
_lineHeight
.
toString
();
let
left
=
this
.
_glyphMarginLeft
.
toString
();
let
width
=
this
.
_glyphMarginWidth
.
toString
();
let
common
=
'
" style="left:
'
+
left
+
'
px;width:
'
+
width
+
'
px
'
+
'
;height:
'
+
lineHeight
+
'
px;"></div>
'
;
...
...
src/vs/editor/browser/viewParts/lineNumbers/lineNumbers.ts
浏览文件 @
14673191
...
...
@@ -14,6 +14,8 @@ import {ClassNames, IDynamicViewOverlay, IRenderingContext, IViewContext} from '
export
class
LineNumbersOverlay
extends
ViewEventHandler
implements
IDynamicViewOverlay
{
private
_context
:
IViewContext
;
private
_lineHeight
:
number
;
private
_lineNumbers
:
any
;
private
_lineNumbersLeft
:
number
;
private
_lineNumbersWidth
:
number
;
private
_renderResult
:
string
[];
...
...
@@ -21,6 +23,8 @@ export class LineNumbersOverlay extends ViewEventHandler implements IDynamicView
constructor
(
context
:
IViewContext
)
{
super
();
this
.
_context
=
context
;
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
this
.
_lineNumbers
=
this
.
_context
.
configuration
.
editor
.
lineNumbers
;
this
.
_lineNumbersLeft
=
0
;
this
.
_lineNumbersWidth
=
0
;
this
.
_renderResult
=
null
;
...
...
@@ -60,6 +64,12 @@ export class LineNumbersOverlay extends ViewEventHandler implements IDynamicView
return
false
;
}
public
onConfigurationChanged
(
e
:
editorCommon
.
IConfigurationChangedEvent
):
boolean
{
if
(
e
.
lineHeight
)
{
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
}
if
(
e
.
lineNumbers
)
{
this
.
_lineNumbers
=
this
.
_context
.
configuration
.
editor
.
lineNumbers
;
}
return
true
;
}
public
onLayoutChanged
(
layoutInfo
:
editorCommon
.
IEditorLayoutInfo
):
boolean
{
...
...
@@ -88,13 +98,13 @@ export class LineNumbersOverlay extends ViewEventHandler implements IDynamicView
}
this
.
shouldRender
=
false
;
if
(
!
this
.
_
context
.
configuration
.
editor
.
lineNumbers
)
{
if
(
!
this
.
_lineNumbers
)
{
this
.
_renderResult
=
null
;
return
false
;
}
let
lineHeightClassName
=
(
platform
.
isLinux
?
(
this
.
_
context
.
configuration
.
editor
.
lineHeight
%
2
===
0
?
'
lh-even
'
:
'
lh-odd
'
)
:
''
);
let
lineHeight
=
this
.
_
context
.
configuration
.
editor
.
lineHeight
.
toString
();
let
lineHeightClassName
=
(
platform
.
isLinux
?
(
this
.
_lineHeight
%
2
===
0
?
'
lh-even
'
:
'
lh-odd
'
)
:
''
);
let
lineHeight
=
this
.
_lineHeight
.
toString
();
let
visibleStartLineNumber
=
ctx
.
visibleRange
.
startLineNumber
;
let
visibleEndLineNumber
=
ctx
.
visibleRange
.
endLineNumber
;
let
common
=
'
<div class="
'
+
ClassNames
.
LINE_NUMBERS
+
lineHeightClassName
+
'
" style="left:
'
+
this
.
_lineNumbersLeft
.
toString
()
+
'
px;width:
'
+
this
.
_lineNumbersWidth
.
toString
()
+
'
px;height:
'
+
lineHeight
+
'
px;">
'
;
...
...
src/vs/editor/browser/viewParts/lines/viewLine.ts
浏览文件 @
14673191
...
...
@@ -15,6 +15,11 @@ import {IVisibleLineData} from 'vs/editor/browser/view/viewLayer';
export
class
ViewLine
implements
IVisibleLineData
{
protected
_context
:
IViewContext
;
private
_renderWhitespace
:
boolean
;
private
_lineHeight
:
number
;
private
_stopRenderingLineAfter
:
number
;
protected
_fontLigatures
:
boolean
;
private
_domNode
:
FastDomNode
;
private
_lineParts
:
ILineParts
;
...
...
@@ -28,6 +33,11 @@ export class ViewLine implements IVisibleLineData {
constructor
(
context
:
IViewContext
)
{
this
.
_context
=
context
;
this
.
_renderWhitespace
=
this
.
_context
.
configuration
.
editor
.
renderWhitespace
;
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
this
.
_stopRenderingLineAfter
=
this
.
_context
.
configuration
.
editor
.
stopRenderingLineAfter
;
this
.
_fontLigatures
=
this
.
_context
.
configuration
.
editor
.
fontLigatures
;
this
.
_domNode
=
null
;
this
.
_isInvalid
=
true
;
this
.
_isMaybeInvalid
=
false
;
...
...
@@ -67,6 +77,18 @@ export class ViewLine implements IVisibleLineData {
this
.
_isMaybeInvalid
=
true
;
}
public
onConfigurationChanged
(
e
:
IConfigurationChangedEvent
):
void
{
if
(
e
.
renderWhitespace
)
{
this
.
_renderWhitespace
=
this
.
_context
.
configuration
.
editor
.
renderWhitespace
;
}
if
(
e
.
lineHeight
)
{
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
}
if
(
e
.
stopRenderingLineAfter
)
{
this
.
_stopRenderingLineAfter
=
this
.
_context
.
configuration
.
editor
.
stopRenderingLineAfter
;
}
if
(
e
.
fontLigatures
)
{
this
.
_fontLigatures
=
this
.
_context
.
configuration
.
editor
.
fontLigatures
;
}
this
.
_isInvalid
=
true
;
}
...
...
@@ -81,7 +103,7 @@ export class ViewLine implements IVisibleLineData {
this
.
_context
.
model
.
getLineContent
(
lineNumber
),
this
.
_context
.
model
.
getLineTokens
(
lineNumber
),
inlineDecorations
,
this
.
_
context
.
configuration
.
editor
.
renderWhitespace
this
.
_renderWhitespace
);
}
...
...
@@ -108,7 +130,7 @@ export class ViewLine implements IVisibleLineData {
out
.
push
(
'
" style="top:
'
);
out
.
push
(
deltaTop
.
toString
());
out
.
push
(
'
px;height:
'
);
out
.
push
(
this
.
_
context
.
configuration
.
editor
.
lineHeight
.
toString
());
out
.
push
(
this
.
_lineHeight
.
toString
());
out
.
push
(
'
px;" class="
'
);
out
.
push
(
ClassNames
.
VIEW_LINE
);
out
.
push
(
'
">
'
);
...
...
@@ -124,7 +146,7 @@ export class ViewLine implements IVisibleLineData {
public
layoutLine
(
lineNumber
:
number
,
deltaTop
:
number
):
void
{
this
.
_domNode
.
setLineNumber
(
String
(
lineNumber
));
this
.
_domNode
.
setTop
(
deltaTop
);
this
.
_domNode
.
setHeight
(
this
.
_
context
.
configuration
.
editor
.
lineHeight
);
this
.
_domNode
.
setHeight
(
this
.
_lineHeight
);
}
// --- end IVisibleLineData
...
...
@@ -136,8 +158,8 @@ export class ViewLine implements IVisibleLineData {
let
r
=
renderLine
(
new
RenderLineInput
(
this
.
_context
.
model
.
getLineContent
(
lineNumber
),
this
.
_context
.
model
.
getTabSize
(),
this
.
_
context
.
configuration
.
editor
.
stopRenderingLineAfter
,
this
.
_
context
.
configuration
.
editor
.
renderWhitespace
,
this
.
_stopRenderingLineAfter
,
this
.
_renderWhitespace
,
lineParts
.
getParts
()
));
...
...
@@ -170,7 +192,7 @@ export class ViewLine implements IVisibleLineData {
startColumn
=
+
startColumn
;
// @perf
endColumn
=
+
endColumn
;
// @perf
clientRectDeltaLeft
=
+
clientRectDeltaLeft
;
// @perf
let
stopRenderingLineAfter
=
+
this
.
_
context
.
configuration
.
editor
.
stopRenderingLineAfter
;
// @perf
let
stopRenderingLineAfter
=
+
this
.
_stopRenderingLineAfter
;
// @perf
if
(
stopRenderingLineAfter
!==
-
1
&&
startColumn
>
stopRenderingLineAfter
&&
endColumn
>
stopRenderingLineAfter
)
{
// This range is obviously not visible
...
...
@@ -325,7 +347,7 @@ export class ViewLine implements IVisibleLineData {
let
lineParts
=
this
.
_lineParts
.
getParts
();
if
(
spanIndex
>=
lineParts
.
length
)
{
return
this
.
_
context
.
configuration
.
editor
.
stopRenderingLineAfter
;
return
this
.
_stopRenderingLineAfter
;
}
if
(
offset
===
0
)
{
...
...
@@ -348,8 +370,8 @@ export class ViewLine implements IVisibleLineData {
let
min
=
originalMin
;
let
max
=
originalMax
;
if
(
this
.
_
context
.
configuration
.
editor
.
stopRenderingLineAfter
!==
-
1
)
{
max
=
Math
.
min
(
this
.
_
context
.
configuration
.
editor
.
stopRenderingLineAfter
-
1
,
originalMax
);
if
(
this
.
_stopRenderingLineAfter
!==
-
1
)
{
max
=
Math
.
min
(
this
.
_stopRenderingLineAfter
-
1
,
originalMax
);
}
let
nextStartOffset
:
number
;
...
...
@@ -429,7 +451,7 @@ class WebKitViewLine extends ViewLine {
protected
_readVisibleRangesForRange
(
startColumn
:
number
,
endColumn
:
number
,
clientRectDeltaLeft
:
number
,
endNode
:
HTMLElement
):
HorizontalRange
[]
{
let
output
=
super
.
_readVisibleRangesForRange
(
startColumn
,
endColumn
,
clientRectDeltaLeft
,
endNode
);
if
(
this
.
_
context
.
configuration
.
editor
.
fontLigatures
&&
output
.
length
===
1
&&
endColumn
>
1
&&
endColumn
===
this
.
_charOffsetInPart
.
length
)
{
if
(
this
.
_fontLigatures
&&
output
.
length
===
1
&&
endColumn
>
1
&&
endColumn
===
this
.
_charOffsetInPart
.
length
)
{
let
lastSpanBoundingClientRect
=
(
<
HTMLElement
>
this
.
_getReadingTarget
().
lastChild
).
getBoundingClientRect
();
let
lastSpanBoundingClientRectRight
=
lastSpanBoundingClientRect
.
right
-
clientRectDeltaLeft
;
if
(
startColumn
===
endColumn
)
{
...
...
src/vs/editor/browser/viewParts/lines/viewLines.ts
浏览文件 @
14673191
...
...
@@ -30,6 +30,10 @@ export class ViewLines extends ViewLayer {
public
textRangeRestingSpot
:
HTMLElement
;
private
_lineHeight
:
number
;
private
_isViewportWrapping
:
boolean
;
private
_revealHorizontalRightPadding
:
number
;
// --- width
private
_maxLineWidth
:
number
;
private
_asyncUpdateLineWidths
:
RunOnceScheduler
;
...
...
@@ -41,6 +45,9 @@ export class ViewLines extends ViewLayer {
constructor
(
context
:
IViewContext
,
layoutProvider
:
ILayoutProvider
)
{
super
(
context
);
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
this
.
_isViewportWrapping
=
this
.
_context
.
configuration
.
editor
.
wrappingInfo
.
isViewportWrapping
;
this
.
_revealHorizontalRightPadding
=
this
.
_context
.
configuration
.
editor
.
revealHorizontalRightPadding
;
this
.
_layoutProvider
=
layoutProvider
;
this
.
domNode
.
className
=
ClassNames
.
VIEW_LINES
;
...
...
@@ -74,6 +81,17 @@ export class ViewLines extends ViewLayer {
if
(
e
.
wrappingInfo
)
{
this
.
_maxLineWidth
=
0
;
}
if
(
e
.
lineHeight
)
{
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
}
if
(
e
.
wrappingInfo
)
{
this
.
_isViewportWrapping
=
this
.
_context
.
configuration
.
editor
.
wrappingInfo
.
isViewportWrapping
;
}
if
(
e
.
revealHorizontalRightPadding
)
{
this
.
_revealHorizontalRightPadding
=
this
.
_context
.
configuration
.
editor
.
revealHorizontalRightPadding
;
}
return
shouldRender
;
}
...
...
@@ -116,7 +134,7 @@ export class ViewLines extends ViewLayer {
public
onCursorScrollRequest
(
e
:
editorCommon
.
IViewScrollRequestEvent
):
boolean
{
let
currentScrollTop
=
this
.
_layoutProvider
.
getScrollTop
();
let
newScrollTop
=
currentScrollTop
+
e
.
deltaLines
*
this
.
_
context
.
configuration
.
editor
.
lineHeight
;
let
newScrollTop
=
currentScrollTop
+
e
.
deltaLines
*
this
.
_lineHeight
;
this
.
_layoutProvider
.
setScrollTop
(
newScrollTop
);
return
true
;
}
...
...
@@ -321,7 +339,7 @@ export class ViewLines extends ViewLayer {
var
newScrollLeft
=
this
.
_computeScrollLeftToRevealRange
(
this
.
_lastCursorRevealRangeHorizontallyEvent
.
range
);
this
.
_lastCursorRevealRangeHorizontallyEvent
=
null
;
var
isViewportWrapping
=
this
.
_
context
.
configuration
.
editor
.
wrappingInfo
.
isViewportWrapping
;
var
isViewportWrapping
=
this
.
_isViewportWrapping
;
if
(
!
isViewportWrapping
)
{
this
.
_ensureMaxLineWidth
(
newScrollLeft
.
maxHorizontalOffset
);
}
...
...
@@ -403,7 +421,7 @@ export class ViewLines extends ViewLayer {
boxEndY
=
this
.
_layoutProvider
.
getVerticalOffsetForLineNumber
(
range
.
endLineNumber
)
+
this
.
_layoutProvider
.
heightInPxForLine
(
range
.
endLineNumber
);
if
(
verticalType
===
editorCommon
.
VerticalRevealType
.
Simple
)
{
// Reveal one line more for the arrow down case, when the last line would be covered by the scrollbar
boxEndY
+=
this
.
_
context
.
configuration
.
editor
.
lineHeight
;
boxEndY
+=
this
.
_lineHeight
;
}
var
newScrollTop
:
number
;
...
...
@@ -468,7 +486,7 @@ export class ViewLines extends ViewLayer {
maxHorizontalOffset
=
boxEndX
;
boxStartX
=
Math
.
max
(
0
,
boxStartX
-
ViewLines
.
HORIZONTAL_EXTRA_PX
);
boxEndX
+=
this
.
_
context
.
configuration
.
editor
.
revealHorizontalRightPadding
;
boxEndX
+=
this
.
_revealHorizontalRightPadding
;
var
newScrollLeft
=
this
.
_computeMinimumScrolling
(
viewportStartX
,
viewportEndX
,
boxStartX
,
boxEndX
);
return
{
...
...
src/vs/editor/browser/viewParts/linesDecorations/linesDecorations.ts
浏览文件 @
14673191
...
...
@@ -13,6 +13,7 @@ import {DecorationToRender, DedupOverlay} from 'vs/editor/browser/viewParts/glyp
export
class
LinesDecorationsOverlay
extends
DedupOverlay
implements
IDynamicViewOverlay
{
private
_context
:
IViewContext
;
private
_lineHeight
:
number
;
private
_decorationsLeft
:
number
;
private
_decorationsWidth
:
number
;
...
...
@@ -21,6 +22,7 @@ export class LinesDecorationsOverlay extends DedupOverlay implements IDynamicVie
constructor
(
context
:
IViewContext
)
{
super
();
this
.
_context
=
context
;
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
this
.
_decorationsLeft
=
0
;
this
.
_decorationsWidth
=
0
;
this
.
_renderResult
=
null
;
...
...
@@ -60,6 +62,9 @@ export class LinesDecorationsOverlay extends DedupOverlay implements IDynamicVie
return
false
;
}
public
onConfigurationChanged
(
e
:
editorCommon
.
IConfigurationChangedEvent
):
boolean
{
if
(
e
.
lineHeight
)
{
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
}
return
true
;
}
public
onLayoutChanged
(
layoutInfo
:
editorCommon
.
IEditorLayoutInfo
):
boolean
{
...
...
@@ -104,7 +109,7 @@ export class LinesDecorationsOverlay extends DedupOverlay implements IDynamicVie
let
visibleEndLineNumber
=
ctx
.
visibleRange
.
endLineNumber
;
let
toRender
=
this
.
_render
(
visibleStartLineNumber
,
visibleEndLineNumber
,
this
.
_getDecorations
(
ctx
));
let
lineHeight
=
this
.
_
context
.
configuration
.
editor
.
lineHeight
.
toString
();
let
lineHeight
=
this
.
_lineHeight
.
toString
();
let
left
=
this
.
_decorationsLeft
.
toString
();
let
width
=
this
.
_decorationsWidth
.
toString
();
let
common
=
'
" style="left:
'
+
left
+
'
px;width:
'
+
width
+
'
px
'
+
'
;height:
'
+
lineHeight
+
'
px;"></div>
'
;
...
...
src/vs/editor/browser/viewParts/scrollDecoration/scrollDecoration.ts
浏览文件 @
14673191
...
...
@@ -18,6 +18,7 @@ export class ScrollDecorationViewPart extends ViewPart {
private
_scrollTop
:
number
;
private
_width
:
number
;
private
_shouldShow
:
boolean
;
private
_useShadows
:
boolean
;
constructor
(
context
:
IViewContext
)
{
super
(
context
);
...
...
@@ -25,11 +26,12 @@ export class ScrollDecorationViewPart extends ViewPart {
this
.
_scrollTop
=
0
;
this
.
_width
=
0
;
this
.
_shouldShow
=
false
;
this
.
_useShadows
=
this
.
_context
.
configuration
.
editor
.
scrollbar
.
useShadows
;
this
.
_domNode
=
document
.
createElement
(
'
div
'
);
}
private
_updateShouldShow
():
boolean
{
var
newShouldShow
=
(
this
.
_
context
.
configuration
.
editor
.
scrollbar
.
useShadows
&&
this
.
_scrollTop
>
0
);
var
newShouldShow
=
(
this
.
_useShadows
&&
this
.
_scrollTop
>
0
);
if
(
this
.
_shouldShow
!==
newShouldShow
)
{
this
.
_shouldShow
=
newShouldShow
;
return
true
;
...
...
@@ -44,6 +46,9 @@ export class ScrollDecorationViewPart extends ViewPart {
// --- begin event handlers
public
onConfigurationChanged
(
e
:
IConfigurationChangedEvent
):
boolean
{
if
(
e
.
scrollbar
)
{
this
.
_useShadows
=
this
.
_context
.
configuration
.
editor
.
scrollbar
.
useShadows
;
}
return
this
.
_updateShouldShow
();
}
public
onLayoutChanged
(
layoutInfo
:
IEditorLayoutInfo
):
boolean
{
...
...
src/vs/editor/browser/viewParts/selections/selections.ts
浏览文件 @
14673191
...
...
@@ -77,12 +77,16 @@ export class SelectionsOverlay extends ViewEventHandler implements IDynamicViewO
private
static
ROUNDED_PIECE_WIDTH
=
10
;
private
_context
:
IViewContext
;
private
_lineHeight
:
number
;
private
_roundedSelection
:
boolean
;
private
_selections
:
editorCommon
.
IEditorRange
[];
private
_renderResult
:
string
[];
constructor
(
context
:
IViewContext
)
{
super
();
this
.
_context
=
context
;
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
this
.
_roundedSelection
=
this
.
_context
.
configuration
.
editor
.
roundedSelection
;
this
.
_selections
=
[];
this
.
_renderResult
=
null
;
this
.
_context
.
addEventHandler
(
this
);
...
...
@@ -125,6 +129,12 @@ export class SelectionsOverlay extends ViewEventHandler implements IDynamicViewO
return
false
;
}
public
onConfigurationChanged
(
e
:
editorCommon
.
IConfigurationChangedEvent
):
boolean
{
if
(
e
.
lineHeight
)
{
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
}
if
(
e
.
roundedSelection
)
{
this
.
_roundedSelection
=
this
.
_context
.
configuration
.
editor
.
roundedSelection
;
}
return
true
;
}
public
onLayoutChanged
(
layoutInfo
:
editorCommon
.
IEditorLayoutInfo
):
boolean
{
...
...
@@ -273,7 +283,7 @@ export class SelectionsOverlay extends ViewEventHandler implements IDynamicViewO
let
linesVisibleRanges
=
_linesVisibleRanges
.
map
(
toStyled
);
let
visibleRangesHaveGaps
=
this
.
_visibleRangesHaveGaps
(
linesVisibleRanges
);
if
(
!
isIEWithZoomingIssuesNearRoundedBorders
&&
!
visibleRangesHaveGaps
&&
this
.
_
context
.
configuration
.
editor
.
roundedSelection
)
{
if
(
!
isIEWithZoomingIssuesNearRoundedBorders
&&
!
visibleRangesHaveGaps
&&
this
.
_roundedSelection
)
{
this
.
_enrichVisibleRangesWithStyle
(
linesVisibleRanges
,
previousFrame
);
}
...
...
@@ -299,8 +309,8 @@ export class SelectionsOverlay extends ViewEventHandler implements IDynamicViewO
private
_actualRenderOneSelection
(
output2
:
string
[],
visibleStartLineNumber
:
number
,
hasMultipleSelections
:
boolean
,
visibleRanges
:
LineVisibleRangesWithStyle
[]):
void
{
let
visibleRangesHaveStyle
=
(
visibleRanges
.
length
>
0
&&
visibleRanges
[
0
].
ranges
[
0
].
startStyle
);
let
fullLineHeight
=
(
this
.
_
context
.
configuration
.
editor
.
lineHeight
).
toString
();
let
reducedLineHeight
=
(
this
.
_
context
.
configuration
.
editor
.
lineHeight
-
1
).
toString
();
let
fullLineHeight
=
(
this
.
_lineHeight
).
toString
();
let
reducedLineHeight
=
(
this
.
_lineHeight
-
1
).
toString
();
let
firstLineNumber
=
(
visibleRanges
.
length
>
0
?
visibleRanges
[
0
].
lineNumber
:
0
);
let
lastLineNumber
=
(
visibleRanges
.
length
>
0
?
visibleRanges
[
visibleRanges
.
length
-
1
].
lineNumber
:
0
);
...
...
src/vs/editor/browser/viewParts/viewCursors/viewCursors.ts
浏览文件 @
14673191
...
...
@@ -22,6 +22,10 @@ export class ViewCursors extends ViewPart {
static
BLINK_INTERVAL
=
500
;
private
_readOnly
:
boolean
;
private
_cursorBlinking
:
string
;
private
_cursorStyle
:
editorCommon
.
TextEditorCursorStyle
;
private
_isVisible
:
boolean
;
private
_domNode
:
HTMLElement
;
...
...
@@ -36,6 +40,10 @@ export class ViewCursors extends ViewPart {
constructor
(
context
:
IViewContext
)
{
super
(
context
);
this
.
_readOnly
=
this
.
_context
.
configuration
.
editor
.
readOnly
;
this
.
_cursorBlinking
=
this
.
_context
.
configuration
.
editor
.
cursorBlinking
;
this
.
_cursorStyle
=
this
.
_context
.
configuration
.
editor
.
cursorStyle
;
this
.
_primaryCursor
=
new
ViewCursor
(
this
.
_context
,
false
);
this
.
_secondaryCursors
=
[];
...
...
@@ -134,6 +142,17 @@ export class ViewCursors extends ViewPart {
return
false
;
}
public
onConfigurationChanged
(
e
:
editorCommon
.
IConfigurationChangedEvent
):
boolean
{
if
(
e
.
readOnly
)
{
this
.
_readOnly
=
this
.
_context
.
configuration
.
editor
.
readOnly
;
}
if
(
e
.
cursorBlinking
)
{
this
.
_cursorBlinking
=
this
.
_context
.
configuration
.
editor
.
cursorBlinking
;
}
if
(
e
.
cursorStyle
)
{
this
.
_cursorStyle
=
this
.
_context
.
configuration
.
editor
.
cursorStyle
;
}
this
.
_primaryCursor
.
onConfigurationChanged
(
e
);
this
.
_updateBlinking
();
if
(
e
.
cursorStyle
)
{
...
...
@@ -174,8 +193,8 @@ export class ViewCursors extends ViewPart {
private
_getRenderType
():
RenderType
{
if
(
this
.
_editorHasFocus
)
{
if
(
this
.
_primaryCursor
.
getIsInEditableRange
()
&&
!
this
.
_
context
.
configuration
.
editor
.
readOnly
)
{
switch
(
this
.
_c
ontext
.
configuration
.
editor
.
c
ursorBlinking
)
{
if
(
this
.
_primaryCursor
.
getIsInEditableRange
()
&&
!
this
.
_readOnly
)
{
switch
(
this
.
_cursorBlinking
)
{
case
'
blink
'
:
return
RenderType
.
Blink
;
case
'
visible
'
:
...
...
@@ -218,7 +237,7 @@ export class ViewCursors extends ViewPart {
private
_getClassName
():
string
{
let
result
=
ClassNames
.
VIEW_CURSORS_LAYER
;
let
extraClassName
:
string
;
switch
(
this
.
_c
ontext
.
configuration
.
editor
.
c
ursorStyle
)
{
switch
(
this
.
_cursorStyle
)
{
case
editorCommon
.
TextEditorCursorStyle
.
Line
:
extraClassName
=
'
cursor-line-style
'
;
break
;
...
...
src/vs/editor/browser/viewParts/viewZones/viewZones.ts
浏览文件 @
14673191
...
...
@@ -29,11 +29,13 @@ export class ViewZones extends ViewPart {
private
_whitespaceManager
:
editorCommon
.
IWhitespaceManager
;
private
_zones
:
{
[
id
:
string
]:
IMyViewZone
;
};
private
_lineHeight
:
number
;
public
domNode
:
HTMLElement
;
constructor
(
context
:
IViewContext
,
whitespaceManager
:
editorCommon
.
IWhitespaceManager
)
{
super
(
context
);
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
this
.
_whitespaceManager
=
whitespaceManager
;
this
.
domNode
=
document
.
createElement
(
'
div
'
);
this
.
domNode
.
className
=
ClassNames
.
VIEW_ZONES
;
...
...
@@ -87,6 +89,7 @@ export class ViewZones extends ViewPart {
public
onConfigurationChanged
(
e
:
editorCommon
.
IConfigurationChangedEvent
):
boolean
{
if
(
e
.
lineHeight
)
{
this
.
_lineHeight
=
this
.
_context
.
configuration
.
editor
.
lineHeight
;
return
this
.
_recomputeWhitespacesProps
();
}
...
...
@@ -259,9 +262,9 @@ export class ViewZones extends ViewPart {
return
zone
.
heightInPx
;
}
if
(
typeof
zone
.
heightInLines
===
'
number
'
)
{
return
this
.
_
context
.
configuration
.
editor
.
lineHeight
*
zone
.
heightInLines
;
return
this
.
_lineHeight
*
zone
.
heightInLines
;
}
return
this
.
_
context
.
configuration
.
editor
.
lineHeight
;
return
this
.
_lineHeight
;
}
private
_safeCallOnComputedHeight
(
zone
:
IViewZone
,
height
:
number
):
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录