Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
bc6d7655
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,发现更多精彩内容 >>
提交
bc6d7655
编写于
3月 23, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More optimizations
上级
521d200b
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
365 addition
and
145 deletion
+365
-145
src/vs/base/browser/styleMutator.ts
src/vs/base/browser/styleMutator.ts
+172
-0
src/vs/editor/browser/viewParts/lines/viewLine.ts
src/vs/editor/browser/viewParts/lines/viewLine.ts
+11
-12
src/vs/editor/common/config/commonEditorConfig.ts
src/vs/editor/common/config/commonEditorConfig.ts
+160
-103
src/vs/editor/common/model/modelLine.ts
src/vs/editor/common/model/modelLine.ts
+0
-24
src/vs/editor/common/model/textModelWithTokens.ts
src/vs/editor/common/model/textModelWithTokens.ts
+16
-5
src/vs/editor/common/viewLayout/viewLineRenderer.ts
src/vs/editor/common/viewLayout/viewLineRenderer.ts
+1
-1
src/vs/editor/common/viewModel/characterHardWrappingLineMapper.ts
...ditor/common/viewModel/characterHardWrappingLineMapper.ts
+5
-0
未找到文件。
src/vs/base/browser/styleMutator.ts
浏览文件 @
bc6d7655
...
...
@@ -4,6 +4,178 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
export
abstract
class
FastDomNode
{
private
_domNode
:
HTMLElement
;
private
_maxWidth
:
number
;
private
_width
:
number
;
private
_height
:
number
;
private
_top
:
number
;
private
_left
:
number
;
private
_bottom
:
number
;
private
_right
:
number
;
private
_fontSize
:
number
;
private
_lineHeight
:
number
;
private
_display
:
string
;
private
_visibility
:
string
;
private
_transform
:
string
;
private
_lineNumber
:
string
;
public
get
domNode
():
HTMLElement
{
return
this
.
_domNode
;
}
constructor
(
domNode
:
HTMLElement
)
{
this
.
_domNode
=
domNode
;
this
.
_maxWidth
=
-
1
;
this
.
_width
=
-
1
;
this
.
_height
=
-
1
;
this
.
_top
=
-
1
;
this
.
_left
=
-
1
;
this
.
_bottom
=
-
1
;
this
.
_right
=
-
1
;
this
.
_fontSize
=
-
1
;
this
.
_lineHeight
=
-
1
;
this
.
_display
=
''
;
this
.
_visibility
=
''
;
this
.
_transform
=
''
;
this
.
_lineNumber
=
''
;
}
public
setMaxWidth
(
maxWidth
:
number
):
void
{
if
(
this
.
_maxWidth
===
maxWidth
)
{
return
;
}
this
.
_maxWidth
=
maxWidth
;
this
.
_domNode
.
style
.
maxWidth
=
this
.
_maxWidth
+
'
px
'
;
}
public
setWidth
(
width
:
number
):
void
{
if
(
this
.
_width
===
width
)
{
return
;
}
this
.
_width
=
width
;
this
.
_domNode
.
style
.
width
=
this
.
_width
+
'
px
'
;
}
public
setHeight
(
height
:
number
):
void
{
if
(
this
.
_height
===
height
)
{
return
;
}
this
.
_height
=
height
;
this
.
_domNode
.
style
.
height
=
this
.
_height
+
'
px
'
;
}
public
setTop
(
top
:
number
):
void
{
if
(
this
.
_top
===
top
)
{
return
;
}
this
.
_top
=
top
;
this
.
_domNode
.
style
.
top
=
this
.
_top
+
'
px
'
;
}
public
setLeft
(
left
:
number
):
void
{
if
(
this
.
_left
===
left
)
{
return
;
}
this
.
_left
=
left
;
this
.
_domNode
.
style
.
left
=
this
.
_left
+
'
px
'
;
}
public
setBottom
(
bottom
:
number
):
void
{
if
(
this
.
_bottom
===
bottom
)
{
return
;
}
this
.
_bottom
=
bottom
;
this
.
_domNode
.
style
.
bottom
=
this
.
_bottom
+
'
px
'
;
}
public
setRight
(
right
:
number
):
void
{
if
(
this
.
_right
===
right
)
{
return
;
}
this
.
_right
=
right
;
this
.
_domNode
.
style
.
right
=
this
.
_right
+
'
px
'
;
}
public
setFontSize
(
fontSize
:
number
):
void
{
if
(
this
.
_fontSize
===
fontSize
)
{
return
;
}
this
.
_fontSize
=
fontSize
;
this
.
_domNode
.
style
.
fontSize
=
this
.
_fontSize
+
'
px
'
;
}
public
setLineHeight
(
lineHeight
:
number
):
void
{
if
(
this
.
_lineHeight
===
lineHeight
)
{
return
;
}
this
.
_lineHeight
=
lineHeight
;
this
.
_domNode
.
style
.
lineHeight
=
this
.
_lineHeight
+
'
px
'
;
}
public
setDisplay
(
display
:
string
):
void
{
if
(
this
.
_display
===
display
)
{
return
;
}
this
.
_display
=
display
;
this
.
_domNode
.
style
.
display
=
this
.
_display
;
}
public
setVisibility
(
visibility
:
string
):
void
{
if
(
this
.
_visibility
===
visibility
)
{
return
;
}
this
.
_visibility
=
visibility
;
this
.
_domNode
.
style
.
visibility
=
this
.
_visibility
;
}
public
setTransform
(
transform
:
string
):
void
{
if
(
this
.
_transform
===
transform
)
{
return
;
}
this
.
_transform
=
transform
;
this
.
_setTransform
(
this
.
_domNode
,
this
.
_transform
);
}
protected
abstract
_setTransform
(
domNode
:
HTMLElement
,
transform
:
string
):
void
;
public
setLineNumber
(
lineNumber
:
string
):
void
{
if
(
this
.
_lineNumber
===
lineNumber
)
{
return
;
}
this
.
_lineNumber
=
lineNumber
;
this
.
_domNode
.
setAttribute
(
'
lineNumber
'
,
this
.
_lineNumber
);
}
}
class
WebKitFastDomNode
extends
FastDomNode
{
protected
_setTransform
(
domNode
:
HTMLElement
,
transform
:
string
):
void
{
(
<
any
>
domNode
.
style
).
webkitTransform
=
transform
;
}
}
class
StandardFastDomNode
extends
FastDomNode
{
protected
_setTransform
(
domNode
:
HTMLElement
,
transform
:
string
):
void
{
domNode
.
style
.
transform
=
transform
;
}
}
let
useWebKitFastDomNode
=
false
;
(
function
()
{
let
testDomNode
=
document
.
createElement
(
'
div
'
);
if
(
typeof
(
<
any
>
testDomNode
.
style
).
webkitTransform
!==
'
undefined
'
)
{
useWebKitFastDomNode
=
true
;
}
})();
export
function
createFastDomNode
(
domNode
:
HTMLElement
):
FastDomNode
{
if
(
useWebKitFastDomNode
)
{
return
new
WebKitFastDomNode
(
domNode
);
}
else
{
return
new
StandardFastDomNode
(
domNode
);
}
}
export
const
StyleMutator
=
{
setMaxWidth
:
(
domNode
:
HTMLElement
,
maxWidth
:
number
)
=>
{
let
desiredValue
=
maxWidth
+
'
px
'
;
...
...
src/vs/editor/browser/viewParts/lines/viewLine.ts
浏览文件 @
bc6d7655
...
...
@@ -5,7 +5,7 @@
'
use strict
'
;
import
*
as
browser
from
'
vs/base/browser/browser
'
;
import
{
StyleMutator
}
from
'
vs/base/browser/styleMutator
'
;
import
{
FastDomNode
,
createFastDomNode
}
from
'
vs/base/browser/styleMutator
'
;
import
{
HorizontalRange
,
IConfigurationChangedEvent
,
IModelDecoration
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ILineParts
,
createLineParts
}
from
'
vs/editor/common/viewLayout/viewLineParts
'
;
import
{
renderLine
,
RenderLineInput
}
from
'
vs/editor/common/viewLayout/viewLineRenderer
'
;
...
...
@@ -15,7 +15,7 @@ import {IVisibleLineData} from 'vs/editor/browser/view/viewLayer';
export
class
ViewLine
implements
IVisibleLineData
{
protected
_context
:
IViewContext
;
private
_domNode
:
HTMLElement
;
private
_domNode
:
FastDomNode
;
private
_lineParts
:
ILineParts
;
...
...
@@ -39,10 +39,13 @@ export class ViewLine implements IVisibleLineData {
// --- begin IVisibleLineData
public
getDomNode
():
HTMLElement
{
return
this
.
_domNode
;
if
(
!
this
.
_domNode
)
{
return
null
;
}
return
this
.
_domNode
.
domNode
;
}
public
setDomNode
(
domNode
:
HTMLElement
):
void
{
this
.
_domNode
=
domNode
;
this
.
_domNode
=
createFastDomNode
(
domNode
)
;
}
public
onContentChanged
():
void
{
...
...
@@ -119,13 +122,9 @@ export class ViewLine implements IVisibleLineData {
}
public
layoutLine
(
lineNumber
:
number
,
deltaTop
:
number
):
void
{
let
desiredLineNumber
=
String
(
lineNumber
);
let
currentLineNumber
=
this
.
_domNode
.
getAttribute
(
'
lineNumber
'
);
if
(
currentLineNumber
!==
desiredLineNumber
)
{
this
.
_domNode
.
setAttribute
(
'
lineNumber
'
,
desiredLineNumber
);
}
StyleMutator
.
setTop
(
this
.
_domNode
,
deltaTop
);
StyleMutator
.
setHeight
(
this
.
_domNode
,
this
.
_context
.
configuration
.
editor
.
lineHeight
);
this
.
_domNode
.
setLineNumber
(
String
(
lineNumber
));
this
.
_domNode
.
setTop
(
deltaTop
);
this
.
_domNode
.
setHeight
(
this
.
_context
.
configuration
.
editor
.
lineHeight
);
}
// --- end IVisibleLineData
...
...
@@ -151,7 +150,7 @@ export class ViewLine implements IVisibleLineData {
// --- Reading from the DOM methods
protected
_getReadingTarget
():
HTMLElement
{
return
<
HTMLSpanElement
>
this
.
_domNode
.
firstChild
;
return
<
HTMLSpanElement
>
this
.
_domNode
.
domNode
.
firstChild
;
}
/**
...
...
src/vs/editor/common/config/commonEditorConfig.ts
浏览文件 @
bc6d7655
...
...
@@ -62,105 +62,160 @@ export class ConfigurationWithDefaults {
}
}
function
cloneInternalEditorOptions
(
opts
:
editorCommon
.
IInternalEditorOptions
):
editorCommon
.
IInternalEditorOptions
{
return
{
experimentalScreenReader
:
opts
.
experimentalScreenReader
,
rulers
:
opts
.
rulers
.
slice
(
0
),
wordSeparators
:
opts
.
wordSeparators
,
selectionClipboard
:
opts
.
selectionClipboard
,
ariaLabel
:
opts
.
ariaLabel
,
lineNumbers
:
opts
.
lineNumbers
,
selectOnLineNumbers
:
opts
.
selectOnLineNumbers
,
glyphMargin
:
opts
.
glyphMargin
,
revealHorizontalRightPadding
:
opts
.
revealHorizontalRightPadding
,
roundedSelection
:
opts
.
roundedSelection
,
theme
:
opts
.
theme
,
readOnly
:
opts
.
readOnly
,
scrollbar
:
{
arrowSize
:
opts
.
scrollbar
.
arrowSize
,
vertical
:
opts
.
scrollbar
.
vertical
,
horizontal
:
opts
.
scrollbar
.
horizontal
,
useShadows
:
opts
.
scrollbar
.
useShadows
,
verticalHasArrows
:
opts
.
scrollbar
.
verticalHasArrows
,
horizontalHasArrows
:
opts
.
scrollbar
.
horizontalHasArrows
,
handleMouseWheel
:
opts
.
scrollbar
.
handleMouseWheel
,
horizontalScrollbarSize
:
opts
.
scrollbar
.
horizontalScrollbarSize
,
horizontalSliderSize
:
opts
.
scrollbar
.
horizontalSliderSize
,
verticalScrollbarSize
:
opts
.
scrollbar
.
verticalScrollbarSize
,
verticalSliderSize
:
opts
.
scrollbar
.
verticalSliderSize
,
mouseWheelScrollSensitivity
:
opts
.
scrollbar
.
mouseWheelScrollSensitivity
,
},
overviewRulerLanes
:
opts
.
overviewRulerLanes
,
cursorBlinking
:
opts
.
cursorBlinking
,
cursorStyle
:
opts
.
cursorStyle
,
fontLigatures
:
opts
.
fontLigatures
,
hideCursorInOverviewRuler
:
opts
.
hideCursorInOverviewRuler
,
scrollBeyondLastLine
:
opts
.
scrollBeyondLastLine
,
wrappingIndent
:
opts
.
wrappingIndent
,
wordWrapBreakBeforeCharacters
:
opts
.
wordWrapBreakBeforeCharacters
,
wordWrapBreakAfterCharacters
:
opts
.
wordWrapBreakAfterCharacters
,
wordWrapBreakObtrusiveCharacters
:
opts
.
wordWrapBreakObtrusiveCharacters
,
tabFocusMode
:
opts
.
tabFocusMode
,
stopLineTokenizationAfter
:
opts
.
stopLineTokenizationAfter
,
stopRenderingLineAfter
:
opts
.
stopRenderingLineAfter
,
longLineBoundary
:
opts
.
longLineBoundary
,
forcedTokenizationBoundary
:
opts
.
forcedTokenizationBoundary
,
hover
:
opts
.
hover
,
contextmenu
:
opts
.
contextmenu
,
quickSuggestions
:
opts
.
quickSuggestions
,
quickSuggestionsDelay
:
opts
.
quickSuggestionsDelay
,
iconsInSuggestions
:
opts
.
iconsInSuggestions
,
autoClosingBrackets
:
opts
.
autoClosingBrackets
,
formatOnType
:
opts
.
formatOnType
,
suggestOnTriggerCharacters
:
opts
.
suggestOnTriggerCharacters
,
acceptSuggestionOnEnter
:
opts
.
acceptSuggestionOnEnter
,
selectionHighlight
:
opts
.
selectionHighlight
,
outlineMarkers
:
opts
.
outlineMarkers
,
referenceInfos
:
opts
.
referenceInfos
,
folding
:
opts
.
folding
,
renderWhitespace
:
opts
.
renderWhitespace
,
layoutInfo
:
{
width
:
opts
.
layoutInfo
.
width
,
height
:
opts
.
layoutInfo
.
height
,
glyphMarginLeft
:
opts
.
layoutInfo
.
glyphMarginLeft
,
glyphMarginWidth
:
opts
.
layoutInfo
.
glyphMarginWidth
,
glyphMarginHeight
:
opts
.
layoutInfo
.
glyphMarginHeight
,
lineNumbersLeft
:
opts
.
layoutInfo
.
lineNumbersLeft
,
lineNumbersWidth
:
opts
.
layoutInfo
.
lineNumbersWidth
,
lineNumbersHeight
:
opts
.
layoutInfo
.
lineNumbersHeight
,
decorationsLeft
:
opts
.
layoutInfo
.
decorationsLeft
,
decorationsWidth
:
opts
.
layoutInfo
.
decorationsWidth
,
decorationsHeight
:
opts
.
layoutInfo
.
decorationsHeight
,
contentLeft
:
opts
.
layoutInfo
.
contentLeft
,
contentWidth
:
opts
.
layoutInfo
.
contentWidth
,
contentHeight
:
opts
.
layoutInfo
.
contentHeight
,
verticalScrollbarWidth
:
opts
.
layoutInfo
.
verticalScrollbarWidth
,
horizontalScrollbarHeight
:
opts
.
layoutInfo
.
horizontalScrollbarHeight
,
export
class
InternalEditorOptions
implements
editorCommon
.
IInternalEditorOptions
{
public
_internalEditorOptionsTrait
:
void
;
experimentalScreenReader
:
boolean
;
rulers
:
number
[];
wordSeparators
:
string
;
selectionClipboard
:
boolean
;
ariaLabel
:
string
;
lineNumbers
:
any
;
selectOnLineNumbers
:
boolean
;
glyphMargin
:
boolean
;
revealHorizontalRightPadding
:
number
;
roundedSelection
:
boolean
;
theme
:
string
;
readOnly
:
boolean
;
scrollbar
:
editorCommon
.
IInternalEditorScrollbarOptions
;
overviewRulerLanes
:
number
;
cursorBlinking
:
string
;
cursorStyle
:
editorCommon
.
TextEditorCursorStyle
;
fontLigatures
:
boolean
;
hideCursorInOverviewRuler
:
boolean
;
scrollBeyondLastLine
:
boolean
;
wrappingIndent
:
string
;
wordWrapBreakBeforeCharacters
:
string
;
wordWrapBreakAfterCharacters
:
string
;
wordWrapBreakObtrusiveCharacters
:
string
;
tabFocusMode
:
boolean
;
stopLineTokenizationAfter
:
number
;
stopRenderingLineAfter
:
number
;
longLineBoundary
:
number
;
forcedTokenizationBoundary
:
number
;
hover
:
boolean
;
contextmenu
:
boolean
;
quickSuggestions
:
boolean
;
quickSuggestionsDelay
:
number
;
iconsInSuggestions
:
boolean
;
autoClosingBrackets
:
boolean
;
formatOnType
:
boolean
;
suggestOnTriggerCharacters
:
boolean
;
acceptSuggestionOnEnter
:
boolean
;
selectionHighlight
:
boolean
;
outlineMarkers
:
boolean
;
referenceInfos
:
boolean
;
folding
:
boolean
;
renderWhitespace
:
boolean
;
layoutInfo
:
editorCommon
.
IEditorLayoutInfo
;
stylingInfo
:
editorCommon
.
IEditorStyling
;
wrappingInfo
:
editorCommon
.
IEditorWrappingInfo
;
observedOuterWidth
:
number
;
observedOuterHeight
:
number
;
lineHeight
:
number
;
pageSize
:
number
;
typicalHalfwidthCharacterWidth
:
number
;
typicalFullwidthCharacterWidth
:
number
;
fontSize
:
number
;
constructor
(
input
:
editorCommon
.
IInternalEditorOptions
)
{
this
.
experimentalScreenReader
=
Boolean
(
input
.
experimentalScreenReader
);
this
.
rulers
=
Array
.
prototype
.
slice
.
call
(
input
.
rulers
,
0
);
this
.
wordSeparators
=
String
(
input
.
wordSeparators
);
this
.
selectionClipboard
=
Boolean
(
input
.
selectionClipboard
);
this
.
ariaLabel
=
String
(
input
.
ariaLabel
);
this
.
lineNumbers
=
input
.
lineNumbers
||
false
;
this
.
selectOnLineNumbers
=
Boolean
(
input
.
selectOnLineNumbers
);
this
.
glyphMargin
=
Boolean
(
input
.
glyphMargin
);
this
.
revealHorizontalRightPadding
=
Number
(
input
.
revealHorizontalRightPadding
);
this
.
roundedSelection
=
Boolean
(
input
.
roundedSelection
);
this
.
theme
=
String
(
input
.
theme
);
this
.
readOnly
=
Boolean
(
input
.
readOnly
);
this
.
scrollbar
=
{
arrowSize
:
Number
(
input
.
scrollbar
.
arrowSize
),
vertical
:
String
(
input
.
scrollbar
.
vertical
),
horizontal
:
String
(
input
.
scrollbar
.
horizontal
),
useShadows
:
Boolean
(
input
.
scrollbar
.
useShadows
),
verticalHasArrows
:
Boolean
(
input
.
scrollbar
.
verticalHasArrows
),
horizontalHasArrows
:
Boolean
(
input
.
scrollbar
.
horizontalHasArrows
),
handleMouseWheel
:
Boolean
(
input
.
scrollbar
.
handleMouseWheel
),
horizontalScrollbarSize
:
Number
(
input
.
scrollbar
.
horizontalScrollbarSize
),
horizontalSliderSize
:
Number
(
input
.
scrollbar
.
horizontalSliderSize
),
verticalScrollbarSize
:
Number
(
input
.
scrollbar
.
verticalScrollbarSize
),
verticalSliderSize
:
Number
(
input
.
scrollbar
.
verticalSliderSize
),
mouseWheelScrollSensitivity
:
Number
(
input
.
scrollbar
.
mouseWheelScrollSensitivity
),
};
this
.
overviewRulerLanes
=
Number
(
input
.
overviewRulerLanes
);
this
.
cursorBlinking
=
String
(
input
.
cursorBlinking
);
this
.
cursorStyle
=
Number
(
input
.
cursorStyle
);
this
.
fontLigatures
=
Boolean
(
input
.
fontLigatures
);
this
.
hideCursorInOverviewRuler
=
Boolean
(
input
.
hideCursorInOverviewRuler
);
this
.
scrollBeyondLastLine
=
Boolean
(
input
.
scrollBeyondLastLine
);
this
.
wrappingIndent
=
String
(
input
.
wrappingIndent
);
this
.
wordWrapBreakBeforeCharacters
=
String
(
input
.
wordWrapBreakBeforeCharacters
);
this
.
wordWrapBreakAfterCharacters
=
String
(
input
.
wordWrapBreakAfterCharacters
);
this
.
wordWrapBreakObtrusiveCharacters
=
String
(
input
.
wordWrapBreakObtrusiveCharacters
);
this
.
tabFocusMode
=
Boolean
(
input
.
tabFocusMode
);
this
.
stopLineTokenizationAfter
=
Number
(
input
.
stopLineTokenizationAfter
);
this
.
stopRenderingLineAfter
=
Number
(
input
.
stopRenderingLineAfter
);
this
.
longLineBoundary
=
Number
(
input
.
longLineBoundary
);
this
.
forcedTokenizationBoundary
=
Number
(
input
.
forcedTokenizationBoundary
);
this
.
hover
=
Boolean
(
input
.
hover
);
this
.
contextmenu
=
Boolean
(
input
.
contextmenu
);
this
.
quickSuggestions
=
Boolean
(
input
.
quickSuggestions
);
this
.
quickSuggestionsDelay
=
Number
(
input
.
quickSuggestionsDelay
);
this
.
iconsInSuggestions
=
Boolean
(
input
.
iconsInSuggestions
);
this
.
autoClosingBrackets
=
Boolean
(
input
.
autoClosingBrackets
);
this
.
formatOnType
=
Boolean
(
input
.
formatOnType
);
this
.
suggestOnTriggerCharacters
=
Boolean
(
input
.
suggestOnTriggerCharacters
);
this
.
acceptSuggestionOnEnter
=
Boolean
(
input
.
acceptSuggestionOnEnter
);
this
.
selectionHighlight
=
Boolean
(
input
.
selectionHighlight
);
this
.
outlineMarkers
=
Boolean
(
input
.
outlineMarkers
);
this
.
referenceInfos
=
Boolean
(
input
.
referenceInfos
);
this
.
folding
=
Boolean
(
input
.
folding
);
this
.
renderWhitespace
=
Boolean
(
input
.
renderWhitespace
);
this
.
layoutInfo
=
{
width
:
Number
(
input
.
layoutInfo
.
width
),
height
:
Number
(
input
.
layoutInfo
.
height
),
glyphMarginLeft
:
Number
(
input
.
layoutInfo
.
glyphMarginLeft
),
glyphMarginWidth
:
Number
(
input
.
layoutInfo
.
glyphMarginWidth
),
glyphMarginHeight
:
Number
(
input
.
layoutInfo
.
glyphMarginHeight
),
lineNumbersLeft
:
Number
(
input
.
layoutInfo
.
lineNumbersLeft
),
lineNumbersWidth
:
Number
(
input
.
layoutInfo
.
lineNumbersWidth
),
lineNumbersHeight
:
Number
(
input
.
layoutInfo
.
lineNumbersHeight
),
decorationsLeft
:
Number
(
input
.
layoutInfo
.
decorationsLeft
),
decorationsWidth
:
Number
(
input
.
layoutInfo
.
decorationsWidth
),
decorationsHeight
:
Number
(
input
.
layoutInfo
.
decorationsHeight
),
contentLeft
:
Number
(
input
.
layoutInfo
.
contentLeft
),
contentWidth
:
Number
(
input
.
layoutInfo
.
contentWidth
),
contentHeight
:
Number
(
input
.
layoutInfo
.
contentHeight
),
verticalScrollbarWidth
:
Number
(
input
.
layoutInfo
.
verticalScrollbarWidth
),
horizontalScrollbarHeight
:
Number
(
input
.
layoutInfo
.
horizontalScrollbarHeight
),
overviewRuler
:{
width
:
opts
.
layoutInfo
.
overviewRuler
.
width
,
height
:
opts
.
layoutInfo
.
overviewRuler
.
height
,
top
:
opts
.
layoutInfo
.
overviewRuler
.
top
,
right
:
opts
.
layoutInfo
.
overviewRuler
.
right
,
width
:
Number
(
input
.
layoutInfo
.
overviewRuler
.
width
)
,
height
:
Number
(
input
.
layoutInfo
.
overviewRuler
.
height
)
,
top
:
Number
(
input
.
layoutInfo
.
overviewRuler
.
top
)
,
right
:
Number
(
input
.
layoutInfo
.
overviewRuler
.
right
)
,
}
}
,
stylingInfo
:
{
editorClassName
:
opts
.
stylingInfo
.
editorClassName
,
fontFamily
:
opts
.
stylingInfo
.
fontFamily
,
fontSize
:
opts
.
stylingInfo
.
fontSize
,
lineHeight
:
opts
.
stylingInfo
.
lineHeight
,
}
,
wrappingInfo
:
{
isViewportWrapping
:
opts
.
wrappingInfo
.
isViewportWrapping
,
wrappingColumn
:
opts
.
wrappingInfo
.
wrappingColumn
,
}
,
observedOuterWidth
:
opts
.
observedOuterWidth
,
observedOuterHeight
:
opts
.
observedOuterHeight
,
lineHeight
:
opts
.
lineHeight
,
pageSize
:
opts
.
pageSize
,
t
ypicalHalfwidthCharacterWidth
:
opts
.
typicalHalfwidthCharacterWidth
,
t
ypicalFullwidthCharacterWidth
:
opts
.
typicalFullwidthCharacterWidth
,
fontSize
:
opts
.
fontSize
,
}
;
}
;
this
.
stylingInfo
=
{
editorClassName
:
String
(
input
.
stylingInfo
.
editorClassName
)
,
fontFamily
:
String
(
input
.
stylingInfo
.
fontFamily
)
,
fontSize
:
Number
(
input
.
stylingInfo
.
fontSize
)
,
lineHeight
:
Number
(
input
.
stylingInfo
.
lineHeight
)
,
}
;
this
.
wrappingInfo
=
{
isViewportWrapping
:
Boolean
(
input
.
wrappingInfo
.
isViewportWrapping
)
,
wrappingColumn
:
Number
(
input
.
wrappingInfo
.
wrappingColumn
)
,
}
;
this
.
observedOuterWidth
=
Number
(
input
.
observedOuterWidth
);
this
.
observedOuterHeight
=
Number
(
input
.
observedOuterHeight
);
this
.
lineHeight
=
Number
(
input
.
lineHeight
);
this
.
pageSize
=
Number
(
input
.
pageSize
);
t
his
.
typicalHalfwidthCharacterWidth
=
Number
(
input
.
typicalHalfwidthCharacterWidth
);
t
his
.
typicalFullwidthCharacterWidth
=
Number
(
input
.
typicalFullwidthCharacterWidth
);
this
.
fontSize
=
Number
(
input
.
fontSize
);
}
}
class
InternalEditorOptionsHelper
{
...
...
@@ -548,8 +603,8 @@ export interface IElementSizeObserver {
export
abstract
class
CommonEditorConfiguration
extends
Disposable
implements
editorCommon
.
IConfiguration
{
public
handlerDispatcher
:
editorCommon
.
IHandlerDispatcher
;
public
editor
:
editorCommon
.
I
InternalEditorOptions
;
public
editorClone
:
editorCommon
.
I
InternalEditorOptions
;
public
editor
:
InternalEditorOptions
;
public
editorClone
:
InternalEditorOptions
;
protected
_configWithDefaults
:
ConfigurationWithDefaults
;
protected
_elementSizeObserver
:
IElementSizeObserver
;
...
...
@@ -569,7 +624,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
this
.
handlerDispatcher
=
new
HandlerDispatcher
();
this
.
editor
=
this
.
_computeInternalOptions
();
this
.
editorClone
=
clone
InternalEditorOptions
(
this
.
editor
);
this
.
editorClone
=
new
InternalEditorOptions
(
this
.
editor
);
}
public
dispose
():
void
{
...
...
@@ -579,7 +634,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
protected
_recomputeOptions
():
void
{
let
oldOpts
=
this
.
editor
;
this
.
editor
=
this
.
_computeInternalOptions
();
this
.
editorClone
=
clone
InternalEditorOptions
(
this
.
editor
);
this
.
editorClone
=
new
InternalEditorOptions
(
this
.
editor
);
let
changeEvent
=
InternalEditorOptionsHelper
.
createConfigurationChangedEvent
(
oldOpts
,
this
.
editor
);
...
...
@@ -602,7 +657,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
return
this
.
_configWithDefaults
.
getEditorOptions
();
}
private
_computeInternalOptions
():
editorCommon
.
I
InternalEditorOptions
{
private
_computeInternalOptions
():
InternalEditorOptions
{
let
opts
=
this
.
_configWithDefaults
.
getEditorOptions
();
let
editorClassName
=
this
.
_getEditorClassName
(
opts
.
theme
,
toBoolean
(
opts
.
fontLigatures
));
...
...
@@ -615,7 +670,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
adjustedLineHeight
=
Math
.
round
(
1.3
*
requestedFontSize
);
}
return
InternalEditorOptionsHelper
.
createInternalEditorOptions
(
let
result
=
InternalEditorOptionsHelper
.
createInternalEditorOptions
(
this
.
getOuterWidth
(),
this
.
getOuterHeight
(),
opts
,
...
...
@@ -628,6 +683,8 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
this
.
_isDominatedByLongLines
,
this
.
_lineCount
);
return
new
InternalEditorOptions
(
result
);
}
public
updateOptions
(
newOptions
:
editorCommon
.
IEditorOptions
):
void
{
...
...
src/vs/editor/common/model/modelLine.ts
浏览文件 @
bc6d7655
...
...
@@ -104,14 +104,6 @@ export class ModelLine {
private
_setModeTransitions
(
topLevelMode
:
IMode
,
modeTransitions
:
IModeTransition
[]):
void
{
let
desired
=
toModeTransitions
(
topLevelMode
,
modeTransitions
);
if
(
desired
===
null
)
{
// saving memory
if
(
typeof
this
.
_modeTransitions
===
'
undefined
'
)
{
return
;
}
this
.
_modeTransitions
=
null
;
return
;
}
this
.
_modeTransitions
=
desired
;
}
...
...
@@ -135,14 +127,6 @@ export class ModelLine {
private
_setLineTokensFromInflated
(
map
:
ITokensInflatorMap
,
tokens
:
IToken
[]):
void
{
let
desired
=
toLineTokensFromInflated
(
map
,
tokens
,
this
.
text
.
length
);
if
(
desired
===
null
)
{
// saving memory
if
(
typeof
this
.
_lineTokens
===
'
undefined
'
)
{
return
;
}
this
.
_lineTokens
=
null
;
return
;
}
this
.
_lineTokens
=
desired
;
}
...
...
@@ -150,14 +134,6 @@ export class ModelLine {
private
_setLineTokensFromDeflated
(
map
:
ITokensInflatorMap
,
tokens
:
number
[]):
void
{
let
desired
=
toLineTokensFromDeflated
(
map
,
tokens
,
this
.
text
.
length
);
if
(
desired
===
null
)
{
// saving memory
if
(
typeof
this
.
_lineTokens
===
'
undefined
'
)
{
return
;
}
this
.
_lineTokens
=
null
;
return
;
}
this
.
_lineTokens
=
desired
;
}
...
...
src/vs/editor/common/model/textModelWithTokens.ts
浏览文件 @
bc6d7655
...
...
@@ -213,13 +213,24 @@ export class TextModelWithTokens extends TextModel implements editorCommon.IToke
super
(
allowedEventTypes
,
rawText
);
this
.
_shouldAutoTokenize
=
shouldAutoTokenize
;
this
.
_shouldSimplifyMode
=
(
rawText
.
length
>
TextModelWithTokens
.
MODEL_SYNC_LIMIT
);
this
.
_shouldDenyMode
=
(
rawText
.
length
>
TextModelWithTokens
.
MODEL_TOKENIZATION_LIMIT
);
this
.
_stopLineTokenizationAfter
=
DefaultConfig
.
editor
.
stopLineTokenizationAfter
;
this
.
_mode
=
null
;
this
.
_modeListener
=
null
;
this
.
_modeToModelBinder
=
null
;
this
.
_tokensInflatorMap
=
null
;
this
.
_stopLineTokenizationAfter
=
DefaultConfig
.
editor
.
stopLineTokenizationAfter
;
this
.
_invalidLineStartIndex
=
0
;
this
.
_lastState
=
null
;
this
.
_revalidateTokensTimeout
=
-
1
;
this
.
_scheduleRetokenizeNow
=
null
;
this
.
_retokenizers
=
null
;
this
.
_tokenizationElapsedTime
=
0
;
this
.
_tokenizationTotalCharacters
=
0
;
this
.
_shouldSimplifyMode
=
(
rawText
.
length
>
TextModelWithTokens
.
MODEL_SYNC_LIMIT
);
this
.
_shouldDenyMode
=
(
rawText
.
length
>
TextModelWithTokens
.
MODEL_TOKENIZATION_LIMIT
);
if
(
!
modeOrPromise
)
{
this
.
_mode
=
new
NullMode
();
...
...
src/vs/editor/common/viewLayout/viewLineRenderer.ts
浏览文件 @
bc6d7655
...
...
@@ -66,7 +66,7 @@ export function renderLine(input:RenderLineInput): IRenderLineOutput {
throw
new
Error
(
'
Cannot render non empty line without line parts!
'
);
}
return
renderLineActual
(
lineText
,
lineTextLength
,
tabSize
,
actualLineParts
,
renderWhitespace
,
charBreakIndex
);
return
renderLineActual
(
lineText
,
lineTextLength
,
tabSize
,
actualLineParts
.
slice
(
0
)
,
renderWhitespace
,
charBreakIndex
);
}
const
WHITESPACE_TOKEN_TEST
=
/
\b
whitespace
\b
/
;
...
...
src/vs/editor/common/viewModel/characterHardWrappingLineMapper.ts
浏览文件 @
bc6d7655
...
...
@@ -72,6 +72,11 @@ export class CharacterHardWrappingLineMapperFactory implements ILineMapperFactor
return
null
;
}
tabSize
=
+
tabSize
;
//@perf
breakingColumn
=
+
breakingColumn
;
//@perf
columnsForFullWidthChar
=
+
columnsForFullWidthChar
;
//@perf
hardWrappingIndent
=
+
hardWrappingIndent
;
//@perf
var
wrappedTextIndentVisibleColumn
=
0
,
wrappedTextIndent
=
''
,
TAB_CHAR_CODE
=
'
\t
'
.
charCodeAt
(
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录