Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
5c12fe3e
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,发现更多精彩内容 >>
提交
5c12fe3e
编写于
3月 24, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use Object.keys
上级
c249c6f4
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
251 addition
and
278 deletion
+251
-278
src/vs/editor/browser/standalone/standaloneCodeEditor.ts
src/vs/editor/browser/standalone/standaloneCodeEditor.ts
+5
-5
src/vs/editor/browser/standalone/standaloneServices.ts
src/vs/editor/browser/standalone/standaloneServices.ts
+10
-10
src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts
...editor/browser/viewParts/contentWidgets/contentWidgets.ts
+35
-42
src/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.ts
...editor/browser/viewParts/overlayWidgets/overlayWidgets.ts
+5
-7
src/vs/editor/browser/viewParts/viewZones/viewZones.ts
src/vs/editor/browser/viewParts/viewZones/viewZones.ts
+39
-45
src/vs/editor/browser/widget/codeEditorWidget.ts
src/vs/editor/browser/widget/codeEditorWidget.ts
+8
-9
src/vs/editor/common/commonCodeEditor.ts
src/vs/editor/common/commonCodeEditor.ts
+15
-14
src/vs/editor/common/config/commonEditorConfig.ts
src/vs/editor/common/config/commonEditorConfig.ts
+6
-6
src/vs/editor/common/controller/cursor.ts
src/vs/editor/common/controller/cursor.ts
+7
-8
src/vs/editor/common/model/textModelWithDecorations.ts
src/vs/editor/common/model/textModelWithDecorations.ts
+51
-55
src/vs/editor/common/model/textModelWithMarkers.ts
src/vs/editor/common/model/textModelWithMarkers.ts
+5
-5
src/vs/editor/common/model/textModelWithTrackedRanges.ts
src/vs/editor/common/model/textModelWithTrackedRanges.ts
+17
-21
src/vs/editor/common/services/languagesRegistry.ts
src/vs/editor/common/services/languagesRegistry.ts
+6
-6
src/vs/editor/common/services/modelServiceImpl.ts
src/vs/editor/common/services/modelServiceImpl.ts
+17
-15
src/vs/editor/common/viewLayout/whitespaceComputer.ts
src/vs/editor/common/viewLayout/whitespaceComputer.ts
+12
-18
src/vs/editor/common/viewModel/viewModelDecorations.ts
src/vs/editor/common/viewModel/viewModelDecorations.ts
+4
-3
src/vs/editor/contrib/links/browser/links.ts
src/vs/editor/contrib/links/browser/links.ts
+5
-5
src/vs/editor/contrib/quickOpen/common/quickOpen.ts
src/vs/editor/contrib/quickOpen/common/quickOpen.ts
+4
-4
未找到文件。
src/vs/editor/browser/standalone/standaloneCodeEditor.ts
浏览文件 @
5c12fe3e
...
...
@@ -293,12 +293,12 @@ var startup = (function() {
})();
function
shallowClone
<
T
>
(
obj
:
T
):
T
{
var
r
:
T
=
<
any
>
{};
let
r
:
T
=
<
any
>
{};
if
(
obj
)
{
for
(
var
key
in
obj
)
{
if
(
obj
.
hasOwnProperty
(
key
)
)
{
r
[
key
]
=
obj
[
key
];
}
let
keys
=
Object
.
keys
(
obj
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
key
=
keys
[
i
];
r
[
key
]
=
obj
[
key
];
}
}
return
r
;
...
...
src/vs/editor/browser/standalone/standaloneServices.ts
浏览文件 @
5c12fe3e
...
...
@@ -90,12 +90,12 @@ export interface IStaticServices {
}
function
shallowClone
<
T
>
(
obj
:
T
):
T
{
var
r
:
T
=
<
any
>
{};
let
r
:
T
=
<
any
>
{};
if
(
obj
)
{
for
(
var
key
in
obj
)
{
if
(
obj
.
hasOwnProperty
(
key
)
)
{
r
[
key
]
=
obj
[
key
];
}
let
keys
=
Object
.
keys
(
obj
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
key
=
keys
[
i
];
r
[
key
]
=
obj
[
key
];
}
}
return
r
;
...
...
@@ -106,11 +106,11 @@ export function ensureStaticPlatformServices(services: IEditorOverrideServices):
var
statics
=
getOrCreateStaticServices
(
services
);
for
(
var
serviceId
in
statics
)
{
if
(
statics
.
hasOwnProperty
(
serviceId
)
)
{
if
(
!
services
.
hasOwnProperty
(
serviceId
))
{
services
[
serviceId
]
=
statics
[
serviceId
];
}
let
keys
=
Object
.
keys
(
statics
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
serviceId
=
keys
[
i
];
if
(
!
services
.
hasOwnProperty
(
serviceId
))
{
services
[
serviceId
]
=
statics
[
serviceId
];
}
}
...
...
src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts
浏览文件 @
5c12fe3e
...
...
@@ -114,11 +114,10 @@ export class ViewContentWidgets extends ViewPart {
this
.
_requestModificationFrameBeforeRendering
(()
=>
{
// update the maxWidth on widgets nodes, such that `onReadAfterForcedLayout`
// below can read out the adjusted width/height of widgets
let
widgetId
:
string
;
for
(
widgetId
in
this
.
_widgets
)
{
if
(
this
.
_widgets
.
hasOwnProperty
(
widgetId
))
{
StyleMutator
.
setMaxWidth
(
this
.
_widgets
[
widgetId
].
widget
.
getDomNode
(),
this
.
_contentWidth
);
}
let
keys
=
Object
.
keys
(
this
.
_widgets
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
widgetId
=
keys
[
i
];
StyleMutator
.
setMaxWidth
(
this
.
_widgets
[
widgetId
].
widget
.
getDomNode
(),
this
.
_contentWidth
);
}
});
...
...
@@ -363,48 +362,42 @@ export class ViewContentWidgets extends ViewPart {
}
_render
(
ctx
:
IRenderingContext
):
void
{
let
data
:
IMyRenderData
=
{},
renderData
:
IMyWidgetRenderData
,
widgetId
:
string
;
for
(
widgetId
in
this
.
_widgets
)
{
if
(
this
.
_widgets
.
hasOwnProperty
(
widgetId
))
{
renderData
=
this
.
_prepareRenderWidget
(
this
.
_widgets
[
widgetId
],
ctx
);
if
(
renderData
)
{
data
[
widgetId
]
=
renderData
;
}
let
data
:
IMyRenderData
=
{};
let
keys
=
Object
.
keys
(
this
.
_widgets
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
widgetId
=
keys
[
i
];
let
renderData
=
this
.
_prepareRenderWidget
(
this
.
_widgets
[
widgetId
],
ctx
);
if
(
renderData
)
{
data
[
widgetId
]
=
renderData
;
}
}
this
.
_requestModificationFrame
(()
=>
{
let
widgetId
:
string
,
widget
:
IWidgetData
,
domNode
:
HTMLElement
;
for
(
widgetId
in
this
.
_widgets
)
{
if
(
this
.
_widgets
.
hasOwnProperty
(
widgetId
))
{
widget
=
this
.
_widgets
[
widgetId
];
domNode
=
this
.
_widgets
[
widgetId
].
widget
.
getDomNode
();
if
(
data
.
hasOwnProperty
(
widgetId
))
{
if
(
widget
.
allowEditorOverflow
)
{
StyleMutator
.
setTop
(
domNode
,
data
[
widgetId
].
top
);
StyleMutator
.
setLeft
(
domNode
,
data
[
widgetId
].
left
);
}
else
{
StyleMutator
.
setTop
(
domNode
,
data
[
widgetId
].
top
+
ctx
.
viewportTop
-
ctx
.
bigNumbersDelta
);
StyleMutator
.
setLeft
(
domNode
,
data
[
widgetId
].
left
);
}
if
(
!
widget
.
isVisible
)
{
StyleMutator
.
setVisibility
(
domNode
,
'
inherit
'
);
domNode
.
setAttribute
(
'
monaco-visible-content-widget
'
,
'
true
'
);
widget
.
isVisible
=
true
;
}
let
keys
=
Object
.
keys
(
this
.
_widgets
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
widgetId
=
keys
[
i
];
let
widget
=
this
.
_widgets
[
widgetId
];
let
domNode
=
this
.
_widgets
[
widgetId
].
widget
.
getDomNode
();
if
(
data
.
hasOwnProperty
(
widgetId
))
{
if
(
widget
.
allowEditorOverflow
)
{
StyleMutator
.
setTop
(
domNode
,
data
[
widgetId
].
top
);
StyleMutator
.
setLeft
(
domNode
,
data
[
widgetId
].
left
);
}
else
{
if
(
widget
.
isVisible
)
{
domNode
.
removeAttribute
(
'
monaco-visible-content-widget
'
);
widget
.
isVisible
=
false
;
StyleMutator
.
setVisibility
(
domNode
,
'
hidden
'
);
}
StyleMutator
.
setTop
(
domNode
,
data
[
widgetId
].
top
+
ctx
.
viewportTop
-
ctx
.
bigNumbersDelta
);
StyleMutator
.
setLeft
(
domNode
,
data
[
widgetId
].
left
);
}
if
(
!
widget
.
isVisible
)
{
StyleMutator
.
setVisibility
(
domNode
,
'
inherit
'
);
domNode
.
setAttribute
(
'
monaco-visible-content-widget
'
,
'
true
'
);
widget
.
isVisible
=
true
;
}
}
else
{
if
(
widget
.
isVisible
)
{
domNode
.
removeAttribute
(
'
monaco-visible-content-widget
'
);
widget
.
isVisible
=
false
;
StyleMutator
.
setVisibility
(
domNode
,
'
hidden
'
);
}
}
}
...
...
src/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.ts
浏览文件 @
5c12fe3e
...
...
@@ -82,7 +82,7 @@ export class ViewOverlayWidgets extends ViewPart {
widgetData
.
preference
=
preference
;
this
.
_requestModificationFrame
(()
=>
{
if
(
this
.
_widgets
.
hasOwnProperty
(
widget
.
getId
()))
{
if
(
this
.
_widgets
.
hasOwnProperty
(
widget
.
getId
()))
{
this
.
_renderWidget
(
widgetData
);
}
});
...
...
@@ -136,13 +136,11 @@ export class ViewOverlayWidgets extends ViewPart {
}
_render
(
ctx
:
IRenderingContext
):
void
{
var
widgetId
:
string
;
this
.
_requestModificationFrame
(()
=>
{
for
(
widgetId
in
this
.
_widgets
)
{
if
(
this
.
_widgets
.
hasOwnProperty
(
widgetId
)
)
{
this
.
_renderWidget
(
this
.
_widgets
[
widgetId
])
;
}
let
keys
=
Object
.
keys
(
this
.
_widgets
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
widgetId
=
keys
[
i
]
;
this
.
_renderWidget
(
this
.
_widgets
[
widgetId
]);
}
});
}
...
...
src/vs/editor/browser/viewParts/viewZones/viewZones.ts
浏览文件 @
5c12fe3e
...
...
@@ -54,30 +54,29 @@ export class ViewZones extends ViewPart {
// ---- begin view event handlers
private
_recomputeWhitespacesProps
():
boolean
{
let
id
:
string
;
let
zone2Height
:{[
id
:
string
]:
number
;}
=
{};
let
hadAChange
=
false
;
for
(
id
in
this
.
_zones
)
{
if
(
this
.
_zones
.
hasOwnProperty
(
id
)
)
{
let
zone
=
this
.
_zones
[
id
];
let
props
=
this
.
_computeWhitespaceProps
(
zone
.
delegate
)
;
if
(
this
.
_whitespaceManager
.
changeWhitespace
(
parseInt
(
id
,
10
),
props
.
afterViewLineNumber
,
props
.
heightInPx
))
{
this
.
_safeCallOnComputedHeight
(
zone
.
delegate
,
props
.
heightInPx
);
zone2Height
[
id
]
=
props
.
heightInPx
;
hadAChange
=
true
;
}
let
keys
=
Object
.
keys
(
this
.
_zones
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
id
=
keys
[
i
];
let
zone
=
this
.
_zones
[
id
]
;
let
props
=
this
.
_computeWhitespaceProps
(
zone
.
delegate
);
if
(
this
.
_whitespaceManager
.
changeWhitespace
(
parseInt
(
id
,
10
),
props
.
afterViewLineNumber
,
props
.
heightInPx
))
{
this
.
_safeCallOnComputedHeight
(
zone
.
delegate
,
props
.
heightInPx
)
;
zone2Height
[
id
]
=
props
.
heightInPx
;
hadAChange
=
true
;
}
}
if
(
hadAChange
)
{
this
.
_requestModificationFrame
(()
=>
{
for
(
id
in
this
.
_zones
)
{
if
(
this
.
_zones
.
hasOwnProperty
(
id
)
)
{
if
(
zone2Height
.
hasOwnProperty
(
id
))
{
// TODO@Alex - edit dom node properties only in render()
StyleMutator
.
setHeight
(
this
.
_zones
[
id
].
delegate
.
domNode
,
zone2Height
[
id
]);
}
let
keys
=
Object
.
keys
(
this
.
_zones
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
id
=
keys
[
i
];
if
(
zone2Height
.
hasOwnProperty
(
id
))
{
// TODO@Alex - edit dom node properties only in render()
StyleMutator
.
setHeight
(
this
.
_zones
[
id
].
delegate
.
domNode
,
zone2Height
[
id
]);
}
}
});
...
...
@@ -291,41 +290,36 @@ export class ViewZones extends ViewPart {
var
visibleWhitespaces
=
this
.
_whitespaceManager
.
getWhitespaceViewportData
();
this
.
_requestModificationFrame
(()
=>
{
var
visibleZones
:{[
id
:
string
]:
editorCommon
.
IViewWhitespaceViewportData
;}
=
{},
i
:
number
,
len
:
number
,
hasVisibleZone
=
false
;
let
visibleZones
:{[
id
:
string
]:
editorCommon
.
IViewWhitespaceViewportData
;}
=
{};
for
(
i
=
0
,
len
=
visibleWhitespaces
.
length
;
i
<
len
;
i
++
)
{
let
hasVisibleZone
=
false
;
for
(
let
i
=
0
,
len
=
visibleWhitespaces
.
length
;
i
<
len
;
i
++
)
{
visibleZones
[
visibleWhitespaces
[
i
].
id
.
toString
()]
=
visibleWhitespaces
[
i
];
hasVisibleZone
=
true
;
}
var
id
:
string
,
zone
:
IMyViewZone
;
for
(
id
in
this
.
_zones
)
{
if
(
this
.
_zones
.
hasOwnProperty
(
id
))
{
zone
=
this
.
_zones
[
id
];
if
(
visibleZones
.
hasOwnProperty
(
id
))
{
// zone is visible
StyleMutator
.
setTop
(
zone
.
delegate
.
domNode
,
(
visibleZones
[
id
].
verticalOffset
-
ctx
.
bigNumbersDelta
));
StyleMutator
.
setHeight
(
zone
.
delegate
.
domNode
,
visibleZones
[
id
].
height
);
if
(
!
zone
.
isVisible
)
{
StyleMutator
.
setDisplay
(
zone
.
delegate
.
domNode
,
'
block
'
);
zone
.
delegate
.
domNode
.
setAttribute
(
'
monaco-visible-view-zone
'
,
'
true
'
);
zone
.
isVisible
=
true
;
}
this
.
_safeCallOnDomNodeTop
(
zone
.
delegate
,
ctx
.
getScrolledTopFromAbsoluteTop
(
visibleZones
[
id
].
verticalOffset
));
}
else
{
if
(
zone
.
isVisible
)
{
StyleMutator
.
setDisplay
(
zone
.
delegate
.
domNode
,
'
none
'
);
zone
.
delegate
.
domNode
.
removeAttribute
(
'
monaco-visible-view-zone
'
);
zone
.
isVisible
=
false
;
}
this
.
_safeCallOnDomNodeTop
(
zone
.
delegate
,
ctx
.
getScrolledTopFromAbsoluteTop
(
-
1000000
));
let
keys
=
Object
.
keys
(
this
.
_zones
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
id
=
keys
[
i
];
let
zone
=
this
.
_zones
[
id
];
if
(
visibleZones
.
hasOwnProperty
(
id
))
{
// zone is visible
StyleMutator
.
setTop
(
zone
.
delegate
.
domNode
,
(
visibleZones
[
id
].
verticalOffset
-
ctx
.
bigNumbersDelta
));
StyleMutator
.
setHeight
(
zone
.
delegate
.
domNode
,
visibleZones
[
id
].
height
);
if
(
!
zone
.
isVisible
)
{
StyleMutator
.
setDisplay
(
zone
.
delegate
.
domNode
,
'
block
'
);
zone
.
delegate
.
domNode
.
setAttribute
(
'
monaco-visible-view-zone
'
,
'
true
'
);
zone
.
isVisible
=
true
;
}
this
.
_safeCallOnDomNodeTop
(
zone
.
delegate
,
ctx
.
getScrolledTopFromAbsoluteTop
(
visibleZones
[
id
].
verticalOffset
));
}
else
{
if
(
zone
.
isVisible
)
{
StyleMutator
.
setDisplay
(
zone
.
delegate
.
domNode
,
'
none
'
);
zone
.
delegate
.
domNode
.
removeAttribute
(
'
monaco-visible-view-zone
'
);
zone
.
isVisible
=
false
;
}
this
.
_safeCallOnDomNodeTop
(
zone
.
delegate
,
ctx
.
getScrolledTopFromAbsoluteTop
(
-
1000000
));
}
}
...
...
src/vs/editor/browser/widget/codeEditorWidget.ts
浏览文件 @
5c12fe3e
...
...
@@ -404,17 +404,16 @@ export class CodeEditorWidget extends CommonCodeEditor implements editorBrowser.
this
.
_view
.
renderOnce
(()
=>
{
var
widgetId
:
string
;
for
(
widgetId
in
this
.
contentWidgets
)
{
if
(
this
.
contentWidgets
.
hasOwnProperty
(
widgetId
))
{
this
.
_view
.
addContentWidget
(
this
.
contentWidgets
[
widgetId
]);
}
let
keys
=
Object
.
keys
(
this
.
contentWidgets
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
widgetId
=
keys
[
i
];
this
.
_view
.
addContentWidget
(
this
.
contentWidgets
[
widgetId
]);
}
for
(
widgetId
in
this
.
overlayWidgets
)
{
if
(
this
.
overlayWidgets
.
hasOwnProperty
(
widgetId
)
)
{
this
.
_view
.
addOverlayWidget
(
this
.
overlayWidgets
[
widgetId
])
;
}
keys
=
Object
.
keys
(
this
.
overlayWidgets
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
widgetId
=
keys
[
i
]
;
this
.
_view
.
addOverlayWidget
(
this
.
overlayWidgets
[
widgetId
]);
}
this
.
_view
.
render
(
false
,
true
);
...
...
src/vs/editor/common/commonCodeEditor.ts
浏览文件 @
5c12fe3e
...
...
@@ -147,12 +147,12 @@ export abstract class CommonCodeEditor extends EventEmitter implements IActionPr
this
.
_codeEditorService
.
removeCodeEditor
(
this
);
this
.
_lifetimeDispose
=
disposeAll
(
this
.
_lifetimeDispose
);
var
contributionId
:
string
;
for
(
contributionId
in
this
.
contributions
)
{
if
(
this
.
contributions
.
hasOwnProperty
(
contributionId
))
{
this
.
contributions
[
contributionId
].
dispose
();
}
let
keys
=
Object
.
keys
(
this
.
contributions
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
contributionId
=
keys
[
i
];
this
.
contributions
[
contributionId
].
dispose
();
}
this
.
contributions
=
{};
this
.
_postDetachModelCleanup
(
this
.
_detachModel
());
...
...
@@ -524,17 +524,18 @@ export abstract class CommonCodeEditor extends EventEmitter implements IActionPr
}
public
getActions
():
IAction
[]
{
var
result
:
IAction
[]
=
[];
var
id
:
string
;
for
(
id
in
this
.
contributions
)
{
if
(
this
.
contributions
.
hasOwnProperty
(
id
)
)
{
var
contribution
=
<
any
>
this
.
contributions
[
id
];
// contribution instanceof IAction
if
(
isAction
(
contribution
))
{
result
.
push
(
<
IAction
>
contribution
);
}
let
result
:
IAction
[]
=
[];
let
keys
=
Object
.
keys
(
this
.
contributions
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
id
=
keys
[
i
];
let
contribution
=
<
any
>
this
.
contributions
[
id
];
// contribution instanceof IAction
if
(
isAction
(
contribution
))
{
result
.
push
(
<
IAction
>
contribution
);
}
}
return
result
;
}
...
...
src/vs/editor/common/config/commonEditorConfig.ts
浏览文件 @
5c12fe3e
...
...
@@ -639,12 +639,12 @@ export abstract class CommonEditorConfiguration extends Disposable implements ed
let
changeEvent
=
InternalEditorOptionsHelper
.
createConfigurationChangedEvent
(
oldOpts
,
this
.
editor
);
let
hasChanged
=
false
;
for
(
let
key
in
changeEvent
)
{
if
(
changeEvent
.
hasOwnProperty
(
key
)
)
{
if
(
changeEvent
[
key
])
{
hasChanged
=
true
;
break
;
}
let
keys
=
Object
.
keys
(
changeEvent
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
key
=
keys
[
i
];
if
(
changeEvent
[
key
])
{
hasChanged
=
true
;
break
;
}
}
...
...
src/vs/editor/common/controller/cursor.ts
浏览文件 @
5c12fe3e
...
...
@@ -921,8 +921,8 @@ export class Cursor extends EventEmitter {
// ----- handlers beyond this point
private
_registerHandlers
():
void
{
var
H
=
editorCommon
.
Handler
;
var
handlersMap
:{
let
H
=
editorCommon
.
Handler
;
let
handlersMap
:{
[
key
:
string
]:(
ctx
:
IMultipleCursorOperationContext
)
=>
boolean
;
}
=
{};
...
...
@@ -1041,15 +1041,14 @@ export class Cursor extends EventEmitter {
handlersMap
[
H
.
ExecuteCommand
]
=
(
ctx
:
IMultipleCursorOperationContext
)
=>
this
.
_externalExecuteCommand
(
ctx
);
handlersMap
[
H
.
ExecuteCommands
]
=
(
ctx
:
IMultipleCursorOperationContext
)
=>
this
.
_externalExecuteCommands
(
ctx
);
var
createHandler
=
(
handlerId
:
string
,
handlerExec
:(
ctx
:
IMultipleCursorOperationContext
)
=>
boolean
)
=>
{
let
createHandler
=
(
handlerId
:
string
,
handlerExec
:(
ctx
:
IMultipleCursorOperationContext
)
=>
boolean
)
=>
{
return
(
e
:
editorCommon
.
IDispatcherEvent
)
=>
this
.
_onHandler
(
handlerId
,
handlerExec
,
e
);
};
var
handler
:
string
;
for
(
handler
in
handlersMap
)
{
if
(
handlersMap
.
hasOwnProperty
(
handler
))
{
this
.
configuration
.
handlerDispatcher
.
setHandler
(
handler
,
createHandler
(
handler
,
handlersMap
[
handler
]));
}
let
keys
=
Object
.
keys
(
handlersMap
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
handler
=
keys
[
i
];
this
.
configuration
.
handlerDispatcher
.
setHandler
(
handler
,
createHandler
(
handler
,
handlersMap
[
handler
]));
}
}
...
...
src/vs/editor/common/model/textModelWithDecorations.ts
浏览文件 @
5c12fe3e
...
...
@@ -177,17 +177,15 @@ export class TextModelWithDecorations extends TextModelWithTrackedRanges impleme
throw
new
Error
(
'
TextModelWithDecorations.removeAllDecorationsWithOwnerId: Model is disposed
'
);
}
var
decorationId
:
string
;
var
decoration
:
IInternalDecoration
;
var
toRemove
:
string
[]
=
[];
let
toRemove
:
string
[]
=
[];
for
(
decorationId
in
this
.
decorations
)
{
if
(
this
.
decorations
.
hasOwnProperty
(
decorationId
))
{
decoration
=
this
.
decorations
[
decorationId
];
let
keys
=
Object
.
keys
(
this
.
decorations
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
decorationId
=
keys
[
i
];
let
decoration
=
this
.
decorations
[
decorationId
];
if
(
decoration
.
ownerId
===
ownerId
)
{
toRemove
.
push
(
decoration
.
id
);
}
if
(
decoration
.
ownerId
===
ownerId
)
{
toRemove
.
push
(
decoration
.
id
);
}
}
...
...
@@ -298,32 +296,31 @@ export class TextModelWithDecorations extends TextModelWithTrackedRanges impleme
throw
new
Error
(
'
TextModelWithDecorations.getAllDecorations: Model is disposed
'
);
}
var
result
:
editorCommon
.
IModelDecoration
[]
=
[];
var
decorationId
:
string
;
var
decoration
:
IInternalDecoration
;
let
result
:
editorCommon
.
IModelDecoration
[]
=
[];
for
(
decorationId
in
this
.
decorations
)
{
if
(
this
.
decorations
.
hasOwnProperty
(
decorationId
))
{
decoration
=
this
.
decorations
[
decorationId
];
let
keys
=
Object
.
keys
(
this
.
decorations
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
decorationId
=
keys
[
i
];
let
decoration
=
this
.
decorations
[
decorationId
];
if
(
ownerId
&&
decoration
.
ownerId
&&
decoration
.
ownerId
!==
ownerId
)
{
continue
;
}
if
(
ownerId
&&
decoration
.
ownerId
&&
decoration
.
ownerId
!==
ownerId
)
{
continue
;
}
if
(
filterOutValidation
)
{
if
(
decoration
.
options
.
className
===
editorCommon
.
ClassName
.
EditorErrorDecoration
||
decoration
.
options
.
className
===
editorCommon
.
ClassName
.
EditorWarningDecoration
)
{
continue
;
}
if
(
filterOutValidation
)
{
if
(
decoration
.
options
.
className
===
editorCommon
.
ClassName
.
EditorErrorDecoration
||
decoration
.
options
.
className
===
editorCommon
.
ClassName
.
EditorWarningDecoration
)
{
continue
;
}
result
.
push
({
id
:
decoration
.
id
,
ownerId
:
decoration
.
ownerId
,
range
:
this
.
getTrackedRange
(
decoration
.
rangeId
),
options
:
decoration
.
options
});
}
result
.
push
({
id
:
decoration
.
id
,
ownerId
:
decoration
.
ownerId
,
range
:
this
.
getTrackedRange
(
decoration
.
rangeId
),
options
:
decoration
.
options
});
}
return
result
;
}
...
...
@@ -370,12 +367,11 @@ export class TextModelWithDecorations extends TextModelWithTrackedRanges impleme
}
private
_onChangedRanges
(
eventBuilder
:
DeferredEventsBuilder
,
changedRanges
:
editorCommon
.
IChangedTrackedRanges
):
void
{
var
rangeId
:
string
;
var
decorationId
:
string
;
for
(
rangeId
in
changedRanges
)
{
if
(
changedRanges
.
hasOwnProperty
(
rangeId
)
&&
this
.
rangeIdToDecorationId
.
hasOwnProperty
(
rangeId
))
{
decorationId
=
this
.
rangeIdToDecorationId
[
rangeId
];
let
keys
=
Object
.
keys
(
changedRanges
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
rangeId
=
keys
[
i
];
if
(
this
.
rangeIdToDecorationId
.
hasOwnProperty
(
rangeId
))
{
let
decorationId
=
this
.
rangeIdToDecorationId
[
rangeId
];
eventBuilder
.
addMovedDecoration
(
decorationId
,
changedRanges
[
rangeId
]);
}
...
...
@@ -383,34 +379,34 @@ export class TextModelWithDecorations extends TextModelWithTrackedRanges impleme
}
private
_handleCollectedDecorationsEvents
(
b
:
DeferredEventsBuilder
):
void
{
var
decorationId
:
string
,
addedOrChangedDecorations
:
editorCommon
.
IModelDecorationsChangedEventDecorationData
[]
=
[],
var
addedOrChangedDecorations
:
editorCommon
.
IModelDecorationsChangedEventDecorationData
[]
=
[],
removedDecorations
:
string
[]
=
[],
decorationIds
:
string
[]
=
[],
decorationData
:
editorCommon
.
IModelDecorationsChangedEventDecorationData
,
oldRange
:
editorCommon
.
IRange
;
for
(
decorationId
in
b
.
newOrChangedDecorations
)
{
if
(
b
.
newOrChangedDecorations
.
hasOwnProperty
(
decorationId
))
{
decorationIds
.
push
(
decorationId
);
decorationData
=
this
.
_getDecorationData
(
decorationId
);
decorationData
.
isForValidation
=
(
decorationData
.
options
.
className
===
editorCommon
.
ClassName
.
EditorErrorDecoration
||
decorationData
.
options
.
className
===
editorCommon
.
ClassName
.
EditorWarningDecoration
);
addedOrChangedDecorations
.
push
(
decorationData
);
if
(
b
.
oldDecorationRange
.
hasOwnProperty
(
decorationId
))
{
oldRange
=
b
.
oldDecorationRange
[
decorationId
];
oldRange
.
startLineNumber
=
oldRange
.
startLineNumber
||
decorationData
.
range
.
startLineNumber
;
oldRange
.
startColumn
=
oldRange
.
startColumn
||
decorationData
.
range
.
startColumn
;
oldRange
.
endLineNumber
=
oldRange
.
endLineNumber
||
decorationData
.
range
.
endLineNumber
;
oldRange
.
endColumn
=
oldRange
.
endColumn
||
decorationData
.
range
.
endColumn
;
}
let
keys
=
Object
.
keys
(
b
.
newOrChangedDecorations
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
decorationId
=
keys
[
i
];
decorationIds
.
push
(
decorationId
);
decorationData
=
this
.
_getDecorationData
(
decorationId
);
decorationData
.
isForValidation
=
(
decorationData
.
options
.
className
===
editorCommon
.
ClassName
.
EditorErrorDecoration
||
decorationData
.
options
.
className
===
editorCommon
.
ClassName
.
EditorWarningDecoration
);
addedOrChangedDecorations
.
push
(
decorationData
);
if
(
b
.
oldDecorationRange
.
hasOwnProperty
(
decorationId
))
{
oldRange
=
b
.
oldDecorationRange
[
decorationId
];
oldRange
.
startLineNumber
=
oldRange
.
startLineNumber
||
decorationData
.
range
.
startLineNumber
;
oldRange
.
startColumn
=
oldRange
.
startColumn
||
decorationData
.
range
.
startColumn
;
oldRange
.
endLineNumber
=
oldRange
.
endLineNumber
||
decorationData
.
range
.
endLineNumber
;
oldRange
.
endColumn
=
oldRange
.
endColumn
||
decorationData
.
range
.
endColumn
;
}
}
for
(
decorationId
in
b
.
removedDecorations
)
{
if
(
b
.
removedDecorations
.
hasOwnProperty
(
decorationId
)
)
{
decorationIds
.
push
(
decorationId
)
;
removedDecoration
s
.
push
(
decorationId
);
}
keys
=
Object
.
keys
(
b
.
removedDecorations
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
decorationId
=
keys
[
i
]
;
decorationId
s
.
push
(
decorationId
);
removedDecorations
.
push
(
decorationId
);
}
if
(
decorationIds
.
length
>
0
)
{
...
...
src/vs/editor/common/model/textModelWithMarkers.ts
浏览文件 @
5c12fe3e
...
...
@@ -223,11 +223,11 @@ export class TextModelWithMarkers extends TextModelWithTokens implements ITextMo
throw
new
Error
(
'
TextModelWithMarkers._getMarkersInMap: Model is disposed
'
);
}
var
result
:
ILineMarker
[]
=
[],
markerId
:
string
;
for
(
markerId
in
markersMap
)
{
if
(
markersMap
.
hasOwnProperty
(
markerId
)
&&
this
.
_markerIdToMarker
.
hasOwnProperty
(
markerId
))
{
let
result
:
ILineMarker
[]
=
[];
let
keys
=
Object
.
keys
(
markersMap
)
;
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
markerId
=
keys
[
i
];
if
(
this
.
_markerIdToMarker
.
hasOwnProperty
(
markerId
))
{
result
.
push
(
this
.
_markerIdToMarker
[
markerId
]);
}
}
...
...
src/vs/editor/common/model/textModelWithTrackedRanges.ts
浏览文件 @
5c12fe3e
...
...
@@ -299,31 +299,27 @@ export class TextModelWithTrackedRanges extends TextModelWithMarkers implements
* Fetch only multi-line ranges that intersect with the given line number range
*/
private
_getMultiLineTrackedRanges
(
filterStartLineNumber
:
number
,
filterEndLineNumber
:
number
):
editorCommon
.
IModelTrackedRange
[]
{
var
result
:
editorCommon
.
IModelTrackedRange
[]
=
[],
rangeId
:
string
,
range
:
ITrackedRange
,
startMarker
:
editorCommon
.
IEditorPosition
,
endMarker
:
editorCommon
.
IEditorPosition
;
let
result
:
editorCommon
.
IModelTrackedRange
[]
=
[];
for
(
rangeId
in
this
.
_multiLineTrackedRanges
)
{
if
(
this
.
_multiLineTrackedRanges
.
hasOwnProperty
(
rangeId
))
{
range
=
this
.
_ranges
[
rangeId
];
startMarker
=
this
.
_getMarker
(
range
.
startMarkerId
);
if
(
startMarker
.
lineNumber
>
filterEndLineNumber
)
{
continue
;
}
let
keys
=
Object
.
keys
(
this
.
_multiLineTrackedRanges
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
rangeId
=
keys
[
i
];
let
range
=
this
.
_ranges
[
rangeId
];
endMarker
=
this
.
_getMarker
(
range
.
end
MarkerId
);
if
(
endMarker
.
lineNumber
<
filterStart
LineNumber
)
{
continue
;
}
let
startMarker
=
this
.
_getMarker
(
range
.
start
MarkerId
);
if
(
startMarker
.
lineNumber
>
filterEnd
LineNumber
)
{
continue
;
}
result
.
push
({
id
:
range
.
id
,
range
:
this
.
_newEditorRange
(
startMarker
,
endMarker
)
});
let
endMarker
=
this
.
_getMarker
(
range
.
endMarkerId
);
if
(
endMarker
.
lineNumber
<
filterStartLineNumber
)
{
continue
;
}
result
.
push
({
id
:
range
.
id
,
range
:
this
.
_newEditorRange
(
startMarker
,
endMarker
)
});
}
return
result
;
...
...
src/vs/editor/common/services/languagesRegistry.ts
浏览文件 @
5c12fe3e
...
...
@@ -200,12 +200,12 @@ export class LanguagesRegistry {
}
public
getMimeForMode
(
theModeId
:
string
):
string
{
for
(
var
_mime
in
this
.
mime2LanguageId
)
{
if
(
this
.
mime2LanguageId
.
hasOwnProperty
(
_mime
)
)
{
var
modeId
=
this
.
mime2LanguageId
[
_mime
];
if
(
modeId
===
theModeId
)
{
return
_mime
;
}
let
keys
=
Object
.
keys
(
this
.
mime2LanguageId
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
_mime
=
keys
[
i
];
let
modeId
=
this
.
mime2LanguageId
[
_mime
];
if
(
modeId
===
theModeId
)
{
return
_mime
;
}
}
...
...
src/vs/editor/common/services/modelServiceImpl.ts
浏览文件 @
5c12fe3e
...
...
@@ -309,18 +309,18 @@ export class ModelServiceImpl implements IModelService {
this
.
_modelCreationOptions
=
newOpts
;
// Update options on all models
for
(
let
modelId
in
this
.
_models
)
{
if
(
this
.
_models
.
hasOwnProperty
(
modelId
))
{
let
modelData
=
this
.
_models
[
modelId
];
let
keys
=
Object
.
keys
(
this
.
_models
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
modelId
=
keys
[
i
];
let
modelData
=
this
.
_models
[
modelId
];
if
(
this
.
_modelCreationOptions
.
detectIndentation
)
{
modelData
.
model
.
detectIndentation
(
this
.
_modelCreationOptions
.
insertSpaces
,
this
.
_modelCreationOptions
.
tabSize
);
}
else
{
modelData
.
model
.
updateOptions
({
insertSpaces
:
this
.
_modelCreationOptions
.
insertSpaces
,
tabSize
:
this
.
_modelCreationOptions
.
tabSize
});
}
if
(
this
.
_modelCreationOptions
.
detectIndentation
)
{
modelData
.
model
.
detectIndentation
(
this
.
_modelCreationOptions
.
insertSpaces
,
this
.
_modelCreationOptions
.
tabSize
);
}
else
{
modelData
.
model
.
updateOptions
({
insertSpaces
:
this
.
_modelCreationOptions
.
insertSpaces
,
tabSize
:
this
.
_modelCreationOptions
.
tabSize
});
}
}
}
...
...
@@ -398,11 +398,13 @@ export class ModelServiceImpl implements IModelService {
public
getModels
():
editorCommon
.
IModel
[]
{
let
ret
:
editorCommon
.
IModel
[]
=
[];
for
(
let
modelId
in
this
.
_models
)
{
if
(
this
.
_models
.
hasOwnProperty
(
modelId
))
{
ret
.
push
(
this
.
_models
[
modelId
].
model
);
}
let
keys
=
Object
.
keys
(
this
.
_models
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
modelId
=
keys
[
i
];
ret
.
push
(
this
.
_models
[
modelId
].
model
);
}
return
ret
;
}
...
...
src/vs/editor/common/viewLayout/whitespaceComputer.ts
浏览文件 @
5c12fe3e
...
...
@@ -117,15 +117,12 @@ export class WhitespaceComputer {
this
.
ordinals
.
splice
(
insertIndex
,
0
,
ordinal
);
this
.
prefixSum
.
splice
(
insertIndex
,
0
,
0
);
var
sid
:
string
,
oldIndex
:
number
;
for
(
sid
in
this
.
whitespaceId2Index
)
{
if
(
this
.
whitespaceId2Index
.
hasOwnProperty
(
sid
))
{
oldIndex
=
this
.
whitespaceId2Index
[
sid
];
if
(
oldIndex
>=
insertIndex
)
{
this
.
whitespaceId2Index
[
sid
]
=
oldIndex
+
1
;
}
let
keys
=
Object
.
keys
(
this
.
whitespaceId2Index
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
sid
=
keys
[
i
];
let
oldIndex
=
this
.
whitespaceId2Index
[
sid
];
if
(
oldIndex
>=
insertIndex
)
{
this
.
whitespaceId2Index
[
sid
]
=
oldIndex
+
1
;
}
}
...
...
@@ -220,15 +217,12 @@ export class WhitespaceComputer {
this
.
prefixSum
.
splice
(
removeIndex
,
1
);
this
.
prefixSumValidIndex
=
Math
.
min
(
this
.
prefixSumValidIndex
,
removeIndex
-
1
);
var
sid
:
string
,
oldIndex
:
number
;
for
(
sid
in
this
.
whitespaceId2Index
)
{
if
(
this
.
whitespaceId2Index
.
hasOwnProperty
(
sid
))
{
oldIndex
=
this
.
whitespaceId2Index
[
sid
];
if
(
oldIndex
>=
removeIndex
)
{
this
.
whitespaceId2Index
[
sid
]
=
oldIndex
-
1
;
}
let
keys
=
Object
.
keys
(
this
.
whitespaceId2Index
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
sid
=
keys
[
i
];
let
oldIndex
=
this
.
whitespaceId2Index
[
sid
];
if
(
oldIndex
>=
removeIndex
)
{
this
.
whitespaceId2Index
[
sid
]
=
oldIndex
-
1
;
}
}
}
...
...
src/vs/editor/common/viewModel/viewModelDecorations.ts
浏览文件 @
5c12fe3e
...
...
@@ -156,9 +156,10 @@ export class ViewModelDecorations implements IDisposable {
}
// Interpret new decorations
var
id
:
string
;
for
(
id
in
addedOrChangedMap
)
{
if
(
!
usedMap
.
hasOwnProperty
(
id
)
&&
addedOrChangedMap
.
hasOwnProperty
(
id
))
{
let
keys
=
Object
.
keys
(
addedOrChangedMap
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
id
=
keys
[
i
];
if
(
!
usedMap
.
hasOwnProperty
(
id
))
{
theirDecoration
=
addedOrChangedMap
[
id
];
myDecoration
=
new
ViewModelDecoration
(
theirDecoration
,
this
.
converter
.
convertModelRangeToViewRange
(
theirDecoration
.
range
,
theirDecoration
.
options
.
isWholeLine
));
...
...
src/vs/editor/contrib/links/browser/links.ts
浏览文件 @
5c12fe3e
...
...
@@ -230,11 +230,11 @@ class LinkDetector {
private
updateDecorations
(
links
:
ILink
[]):
void
{
this
.
editor
.
changeDecorations
((
changeAccessor
:
editorCommon
.
IModelDecorationsChangeAccessor
)
=>
{
var
oldDecorations
:
string
[]
=
[];
for
(
var
decorationId
in
this
.
currentOccurences
)
{
if
(
this
.
currentOccurences
.
hasOwnProperty
(
decorationId
)
)
{
var
occurance
=
this
.
currentOccurences
[
decorationId
];
oldDecorations
.
push
(
occurance
.
decorationId
)
;
}
let
keys
=
Object
.
keys
(
this
.
currentOccurences
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
decorationId
=
keys
[
i
];
let
occurance
=
this
.
currentOccurences
[
decorationId
]
;
oldDecorations
.
push
(
occurance
.
decorationId
);
}
var
newDecorations
:
editorCommon
.
IModelDeltaDecoration
[]
=
[];
...
...
src/vs/editor/contrib/quickOpen/common/quickOpen.ts
浏览文件 @
5c12fe3e
...
...
@@ -36,10 +36,10 @@ export function getOutlineEntries(model: IModel): TPromise<IOutline> {
let
promises
=
OutlineRegistry
.
all
(
model
).
map
(
support
=>
{
if
(
support
.
outlineGroupLabel
)
{
for
(
var
key
in
support
.
outlineGroupLabel
)
{
if
(
Object
.
prototype
.
hasOwnProperty
.
call
(
support
.
outlineGroupLabel
,
key
)
)
{
groupLabels
[
key
]
=
support
.
outlineGroupLabel
[
key
];
}
let
keys
=
Object
.
keys
(
support
.
outlineGroupLabel
);
for
(
let
i
=
0
,
len
=
keys
.
length
;
i
<
len
;
i
++
)
{
let
key
=
keys
[
i
];
groupLabels
[
key
]
=
support
.
outlineGroupLabel
[
key
];
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录