Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
99f6d9b8
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,发现更多精彩内容 >>
提交
99f6d9b8
编写于
2月 11, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Small perf tweaks
上级
2b6b07f8
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
144 addition
and
11 deletion
+144
-11
src/vs/editor/common/commonCodeEditor.ts
src/vs/editor/common/commonCodeEditor.ts
+7
-2
src/vs/editor/common/config/commonEditorConfig.ts
src/vs/editor/common/config/commonEditorConfig.ts
+104
-0
src/vs/editor/common/model/model.ts
src/vs/editor/common/model/model.ts
+1
-0
src/vs/workbench/browser/parts/editor/editorStatus.ts
src/vs/workbench/browser/parts/editor/editorStatus.ts
+32
-9
未找到文件。
src/vs/editor/common/commonCodeEditor.ts
浏览文件 @
99f6d9b8
...
...
@@ -198,7 +198,7 @@ export abstract class CommonCodeEditor extends EventEmitter.EventEmitter impleme
}
public
getConfiguration
():
EditorCommon
.
IInternalEditorOptions
{
return
Objects
.
clone
(
this
.
_configuration
.
editor
)
;
return
this
.
_configuration
.
editorClone
;
}
public
getRawConfiguration
():
EditorCommon
.
IEditorOptions
{
...
...
@@ -206,7 +206,11 @@ export abstract class CommonCodeEditor extends EventEmitter.EventEmitter impleme
}
public
getIndentationOptions
():
EditorCommon
.
IInternalIndentationOptions
{
return
Objects
.
clone
(
this
.
_configuration
.
getIndentationOptions
());
let
r
=
this
.
_configuration
.
getIndentationOptions
();
return
{
tabSize
:
r
.
tabSize
,
insertSpaces
:
r
.
insertSpaces
};
}
public
normalizeIndentation
(
str
:
string
):
string
{
...
...
@@ -643,6 +647,7 @@ export abstract class CommonCodeEditor extends EventEmitter.EventEmitter impleme
this
.
_decorationTypeKeysToIds
[
decorationTypeKey
]
=
this
.
deltaDecorations
(
oldDecorationIds
,
ranges
.
map
((
r
)
:
EditorCommon
.
IModelDeltaDecoration
=>
{
let
decOpts
:
EditorCommon
.
IModelDecorationOptions
;
if
(
r
.
hoverMessage
)
{
// TODO@Alex: avoid Objects.clone
decOpts
=
Objects
.
clone
(
opts
);
decOpts
.
htmlMessage
=
r
.
hoverMessage
;
}
else
{
...
...
src/vs/editor/common/config/commonEditorConfig.ts
浏览文件 @
99f6d9b8
...
...
@@ -62,6 +62,107 @@ export class ConfigurationWithDefaults {
}
}
function
cloneInternalEditorOptions
(
opts
:
EditorCommon
.
IInternalEditorOptions
):
EditorCommon
.
IInternalEditorOptions
{
return
{
experimentalScreenReader
:
opts
.
experimentalScreenReader
,
rulers
:
opts
.
rulers
.
slice
(
0
),
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
,
selectionHighlight
:
opts
.
selectionHighlight
,
outlineMarkers
:
opts
.
outlineMarkers
,
referenceInfos
:
opts
.
referenceInfos
,
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
,
overviewRuler
:{
width
:
opts
.
layoutInfo
.
overviewRuler
.
width
,
height
:
opts
.
layoutInfo
.
overviewRuler
.
height
,
top
:
opts
.
layoutInfo
.
overviewRuler
.
top
,
right
:
opts
.
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
,
},
indentInfo
:
{
tabSize
:
opts
.
indentInfo
.
tabSize
,
insertSpaces
:
opts
.
indentInfo
.
insertSpaces
,
},
observedOuterWidth
:
opts
.
observedOuterWidth
,
observedOuterHeight
:
opts
.
observedOuterHeight
,
lineHeight
:
opts
.
lineHeight
,
pageSize
:
opts
.
pageSize
,
typicalHalfwidthCharacterWidth
:
opts
.
typicalHalfwidthCharacterWidth
,
typicalFullwidthCharacterWidth
:
opts
.
typicalFullwidthCharacterWidth
,
fontSize
:
opts
.
fontSize
,
};
}
class
InternalEditorOptionsHelper
{
constructor
()
{
...
...
@@ -444,6 +545,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements Ed
public
handlerDispatcher
:
EditorCommon
.
IHandlerDispatcher
;
public
editor
:
EditorCommon
.
IInternalEditorOptions
;
public
editorClone
:
EditorCommon
.
IInternalEditorOptions
;
protected
_configWithDefaults
:
ConfigurationWithDefaults
;
private
_indentationGuesser
:
IIndentationGuesser
;
...
...
@@ -467,6 +569,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements Ed
this
.
handlerDispatcher
=
new
HandlerDispatcher
();
this
.
editor
=
this
.
_computeInternalOptions
();
this
.
editorClone
=
cloneInternalEditorOptions
(
this
.
editor
);
}
public
dispose
():
void
{
...
...
@@ -476,6 +579,7 @@ export abstract class CommonEditorConfiguration extends Disposable implements Ed
protected
_recomputeOptions
():
void
{
let
oldOpts
=
this
.
editor
;
this
.
editor
=
this
.
_computeInternalOptions
();
this
.
editorClone
=
cloneInternalEditorOptions
(
this
.
editor
);
let
changeEvent
=
InternalEditorOptionsHelper
.
createConfigurationChangedEvent
(
oldOpts
,
this
.
editor
);
...
...
src/vs/editor/common/model/model.ts
浏览文件 @
99f6d9b8
...
...
@@ -155,6 +155,7 @@ export class Model extends EditableTextModel implements EditorCommon.IModel {
throw
new
Error
(
'
Model.getProperties: Model is disposed
'
);
}
// TODO@Alex: avoid Objects.clone
return
Objects
.
clone
(
this
.
_extraProperties
);
}
...
...
src/vs/workbench/browser/parts/editor/editorStatus.ts
浏览文件 @
99f6d9b8
...
...
@@ -8,7 +8,7 @@
import
'
vs/css!./media/editorstatus
'
;
import
nls
=
require
(
'
vs/nls
'
);
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
emmet
as
$
,
append
,
show
,
hide
}
from
'
vs/base/browser/dom
'
;
import
{
emmet
as
$
,
append
}
from
'
vs/base/browser/dom
'
;
import
encoding
=
require
(
'
vs/base/common/bits/encoding
'
);
import
strings
=
require
(
'
vs/base/common/strings
'
);
import
types
=
require
(
'
vs/base/common/types
'
);
...
...
@@ -21,6 +21,7 @@ import {Registry} from 'vs/platform/platform';
import
{
UntitledEditorInput
}
from
'
vs/workbench/common/editor/untitledEditorInput
'
;
import
{
IFileEditorInput
,
EncodingMode
,
IEncodingSupport
,
asFileEditorInput
,
getUntitledOrFileResource
}
from
'
vs/workbench/common/editor
'
;
import
{
IDisposable
,
combinedDispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICodeEditor
,
IDiffEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
EndOfLineSequence
,
ITokenizedModel
,
EditorType
,
IEditorSelection
,
ITextModel
,
IDiffEditorModel
,
IEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
EventType
,
ResourceEvent
,
EditorEvent
,
TextEditorSelectionEvent
}
from
'
vs/workbench/common/events
'
;
...
...
@@ -33,6 +34,21 @@ import {IEventService} from 'vs/platform/event/common/event';
import
{
IFilesConfiguration
}
from
'
vs/platform/files/common/files
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
StyleMutator
}
from
'
vs/base/browser/styleMutator
'
;
function
getCodeEditor
(
e
:
IBaseEditor
):
ICommonCodeEditor
{
if
(
e
instanceof
BaseTextEditor
)
{
let
editorWidget
=
e
.
getControl
();
if
(
editorWidget
.
getEditorType
()
===
EditorType
.
IDiffEditor
)
{
return
(
<
IDiffEditor
>
editorWidget
).
getModifiedEditor
();
}
if
(
editorWidget
.
getEditorType
()
===
EditorType
.
ICodeEditor
)
{
return
(
<
ICodeEditor
>
editorWidget
);
}
return
null
;
}
return
null
;
}
function
getTextModel
(
editorWidget
:
IEditor
):
ITextModel
{
let
textModel
:
ITextModel
;
...
...
@@ -165,6 +181,13 @@ const nlsEOLLF = nls.localize('endOfLineLineFeed', "LF");
const
nlsEOLCRLF
=
nls
.
localize
(
'
endOfLineCarriageReturnLineFeed
'
,
"
CRLF
"
);
const
nlsTabFocusMode
=
nls
.
localize
(
'
tabFocusModeEnabled
'
,
"
Tab moves focus
"
);
function
show
(
el
:
HTMLElement
):
void
{
StyleMutator
.
setDisplay
(
el
,
''
);
}
function
hide
(
el
:
HTMLElement
):
void
{
StyleMutator
.
setDisplay
(
el
,
'
none
'
);
}
export
class
EditorStatus
implements
IStatusbarItem
{
private
state
:
State
;
...
...
@@ -408,15 +431,15 @@ export class EditorStatus implements IStatusbarItem {
return
;
}
let
info
:
StateDelta
=
{
EOL
:
null
};
let
codeEditor
=
getCodeEditor
(
e
);
if
(
!
codeEditor
)
{
return
;
}
// We only support writable text based code editors
if
(
e
instanceof
BaseTextEditor
&&
isWritableCodeEditor
(
e
))
{
let
editorWidget
=
e
.
getControl
();
let
textModel
=
getTextModel
(
editorWidget
);
if
(
textModel
)
{
info
=
{
EOL
:
textModel
.
getEOL
()
};
}
let
info
:
StateDelta
=
{
EOL
:
null
};
if
(
!
codeEditor
.
getConfiguration
().
readOnly
)
{
let
codeEditorModel
=
codeEditor
.
getModel
();
info
.
EOL
=
codeEditorModel
.
getEOL
();
}
this
.
updateState
(
info
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录