Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
9d667371
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,发现更多精彩内容 >>
提交
9d667371
编写于
2月 13, 2019
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Strict null fixes related to activeEditor now possibly being undefined
上级
ea755ec3
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
36 addition
and
24 deletion
+36
-24
src/vs/workbench/browser/parts/editor/editorCommands.ts
src/vs/workbench/browser/parts/editor/editorCommands.ts
+1
-1
src/vs/workbench/browser/parts/editor/editorControl.ts
src/vs/workbench/browser/parts/editor/editorControl.ts
+2
-2
src/vs/workbench/browser/parts/editor/tabsTitleControl.ts
src/vs/workbench/browser/parts/editor/tabsTitleControl.ts
+6
-5
src/vs/workbench/contrib/files/browser/files.ts
src/vs/workbench/contrib/files/browser/files.ts
+1
-1
src/vs/workbench/contrib/quickopen/browser/gotoLineHandler.ts
...vs/workbench/contrib/quickopen/browser/gotoLineHandler.ts
+17
-8
src/vs/workbench/contrib/quickopen/browser/gotoSymbolHandler.ts
.../workbench/contrib/quickopen/browser/gotoSymbolHandler.ts
+8
-6
src/vs/workbench/services/history/browser/history.ts
src/vs/workbench/services/history/browser/history.ts
+1
-1
未找到文件。
src/vs/workbench/browser/parts/editor/editorCommands.ts
浏览文件 @
9d667371
...
@@ -422,7 +422,7 @@ export function splitEditor(editorGroupService: IEditorGroupsService, direction:
...
@@ -422,7 +422,7 @@ export function splitEditor(editorGroupService: IEditorGroupsService, direction:
const
newGroup
=
editorGroupService
.
addGroup
(
sourceGroup
,
direction
);
const
newGroup
=
editorGroupService
.
addGroup
(
sourceGroup
,
direction
);
// Split editor (if it can be split)
// Split editor (if it can be split)
let
editorToCopy
:
IEditorInput
;
let
editorToCopy
:
IEditorInput
|
null
;
if
(
context
&&
typeof
context
.
editorIndex
===
'
number
'
)
{
if
(
context
&&
typeof
context
.
editorIndex
===
'
number
'
)
{
editorToCopy
=
sourceGroup
.
getEditor
(
context
.
editorIndex
);
editorToCopy
=
sourceGroup
.
getEditor
(
context
.
editorIndex
);
}
else
{
}
else
{
...
...
src/vs/workbench/browser/parts/editor/editorControl.ts
浏览文件 @
9d667371
...
@@ -53,8 +53,8 @@ export class EditorControl extends Disposable {
...
@@ -53,8 +53,8 @@ export class EditorControl extends Disposable {
this
.
editorOperation
=
this
.
_register
(
new
LongRunningOperation
(
progressService
));
this
.
editorOperation
=
this
.
_register
(
new
LongRunningOperation
(
progressService
));
}
}
get
activeControl
():
IActiveEditor
{
get
activeControl
():
IActiveEditor
|
null
{
return
this
.
_activeControl
;
return
this
.
_activeControl
as
IActiveEditor
|
null
;
}
}
openEditor
(
editor
:
EditorInput
,
options
?:
EditorOptions
):
Promise
<
IOpenEditorResult
>
{
openEditor
(
editor
:
EditorInput
,
options
?:
EditorOptions
):
Promise
<
IOpenEditorResult
>
{
...
...
src/vs/workbench/browser/parts/editor/tabsTitleControl.ts
浏览文件 @
9d667371
...
@@ -562,7 +562,7 @@ export class TabsTitleControl extends TitleControl {
...
@@ -562,7 +562,7 @@ export class TabsTitleControl extends TitleControl {
disposables
.
push
(
addDisposableListener
(
tab
,
EventType
.
DBLCLICK
,
(
e
:
MouseEvent
)
=>
{
disposables
.
push
(
addDisposableListener
(
tab
,
EventType
.
DBLCLICK
,
(
e
:
MouseEvent
)
=>
{
EventHelper
.
stop
(
e
);
EventHelper
.
stop
(
e
);
this
.
group
.
pinEditor
(
this
.
group
.
getEditor
(
index
));
this
.
group
.
pinEditor
(
this
.
group
.
getEditor
(
index
)
||
undefined
);
}));
}));
// Context menu
// Context menu
...
@@ -670,7 +670,8 @@ export class TabsTitleControl extends TitleControl {
...
@@ -670,7 +670,8 @@ export class TabsTitleControl extends TitleControl {
private
updateDropFeedback
(
element
:
HTMLElement
,
isDND
:
boolean
,
index
?:
number
):
void
{
private
updateDropFeedback
(
element
:
HTMLElement
,
isDND
:
boolean
,
index
?:
number
):
void
{
const
isTab
=
(
typeof
index
===
'
number
'
);
const
isTab
=
(
typeof
index
===
'
number
'
);
const
isActiveTab
=
isTab
&&
this
.
group
.
isActive
(
this
.
group
.
getEditor
(
index
));
const
editor
=
typeof
index
===
'
number
'
?
this
.
group
.
getEditor
(
index
)
:
null
;
const
isActiveTab
=
isTab
&&
!!
editor
&&
this
.
group
.
isActive
(
editor
);
// Background
// Background
const
noDNDBackgroundColor
=
isTab
?
this
.
getColor
(
isActiveTab
?
TAB_ACTIVE_BACKGROUND
:
TAB_INACTIVE_BACKGROUND
)
:
null
;
const
noDNDBackgroundColor
=
isTab
?
this
.
getColor
(
isActiveTab
?
TAB_ACTIVE_BACKGROUND
:
TAB_INACTIVE_BACKGROUND
)
:
null
;
...
@@ -1032,7 +1033,7 @@ export class TabsTitleControl extends TitleControl {
...
@@ -1032,7 +1033,7 @@ export class TabsTitleControl extends TitleControl {
}
}
}
}
private
getTab
(
editor
:
IEditorInput
):
HTMLElement
{
private
getTab
(
editor
:
IEditorInput
):
HTMLElement
|
undefined
{
const
editorIndex
=
this
.
group
.
getIndexOfEditor
(
editor
);
const
editorIndex
=
this
.
group
.
getIndexOfEditor
(
editor
);
if
(
editorIndex
>=
0
)
{
if
(
editorIndex
>=
0
)
{
return
this
.
tabsContainer
.
children
[
editorIndex
]
as
HTMLElement
;
return
this
.
tabsContainer
.
children
[
editorIndex
]
as
HTMLElement
;
...
@@ -1193,12 +1194,12 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
...
@@ -1193,12 +1194,12 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
const
editorGroupHeaderTabsBackground
=
theme
.
getColor
(
EDITOR_GROUP_HEADER_TABS_BACKGROUND
);
const
editorGroupHeaderTabsBackground
=
theme
.
getColor
(
EDITOR_GROUP_HEADER_TABS_BACKGROUND
);
const
editorDragAndDropBackground
=
theme
.
getColor
(
EDITOR_DRAG_AND_DROP_BACKGROUND
);
const
editorDragAndDropBackground
=
theme
.
getColor
(
EDITOR_DRAG_AND_DROP_BACKGROUND
);
let
adjustedTabBackground
:
Color
;
let
adjustedTabBackground
:
Color
|
undefined
;
if
(
editorGroupHeaderTabsBackground
&&
editorBackgroundColor
)
{
if
(
editorGroupHeaderTabsBackground
&&
editorBackgroundColor
)
{
adjustedTabBackground
=
editorGroupHeaderTabsBackground
.
flatten
(
editorBackgroundColor
,
editorBackgroundColor
,
workbenchBackground
);
adjustedTabBackground
=
editorGroupHeaderTabsBackground
.
flatten
(
editorBackgroundColor
,
editorBackgroundColor
,
workbenchBackground
);
}
}
let
adjustedTabDragBackground
:
Color
;
let
adjustedTabDragBackground
:
Color
|
undefined
;
if
(
editorGroupHeaderTabsBackground
&&
editorBackgroundColor
&&
editorDragAndDropBackground
&&
editorBackgroundColor
)
{
if
(
editorGroupHeaderTabsBackground
&&
editorBackgroundColor
&&
editorDragAndDropBackground
&&
editorBackgroundColor
)
{
adjustedTabDragBackground
=
editorGroupHeaderTabsBackground
.
flatten
(
editorBackgroundColor
,
editorDragAndDropBackground
,
editorBackgroundColor
,
workbenchBackground
);
adjustedTabDragBackground
=
editorGroupHeaderTabsBackground
.
flatten
(
editorBackgroundColor
,
editorDragAndDropBackground
,
editorBackgroundColor
,
workbenchBackground
);
}
}
...
...
src/vs/workbench/contrib/files/browser/files.ts
浏览文件 @
9d667371
...
@@ -41,7 +41,7 @@ export function getResourceForCommand(resource: URI | object, listService: IList
...
@@ -41,7 +41,7 @@ export function getResourceForCommand(resource: URI | object, listService: IList
}
}
}
}
return
toResource
(
editorService
.
activeEditor
,
{
supportSideBySide
:
true
})
;
return
editorService
.
activeEditor
?
toResource
(
editorService
.
activeEditor
,
{
supportSideBySide
:
true
})
:
null
;
}
}
export
function
getMultiSelectedResources
(
resource
:
URI
|
object
,
listService
:
IListService
,
editorService
:
IEditorService
):
Array
<
URI
>
{
export
function
getMultiSelectedResources
(
resource
:
URI
|
object
,
listService
:
IListService
,
editorService
:
IEditorService
):
Array
<
URI
>
{
...
...
src/vs/workbench/contrib/quickopen/browser/gotoLineHandler.ts
浏览文件 @
9d667371
...
@@ -40,6 +40,10 @@ export class GotoLineAction extends QuickOpenAction {
...
@@ -40,6 +40,10 @@ export class GotoLineAction extends QuickOpenAction {
run
():
Promise
<
void
>
{
run
():
Promise
<
void
>
{
let
activeTextEditorWidget
=
this
.
editorService
.
activeTextEditorWidget
;
let
activeTextEditorWidget
=
this
.
editorService
.
activeTextEditorWidget
;
if
(
!
activeTextEditorWidget
)
{
return
Promise
.
resolve
();
}
if
(
isDiffEditor
(
activeTextEditorWidget
))
{
if
(
isDiffEditor
(
activeTextEditorWidget
))
{
activeTextEditorWidget
=
activeTextEditorWidget
.
getModifiedEditor
();
activeTextEditorWidget
=
activeTextEditorWidget
.
getModifiedEditor
();
}
}
...
@@ -61,7 +65,7 @@ export class GotoLineAction extends QuickOpenAction {
...
@@ -61,7 +65,7 @@ export class GotoLineAction extends QuickOpenAction {
if
(
restoreOptions
)
{
if
(
restoreOptions
)
{
Event
.
once
(
this
.
_quickOpenService
.
onHide
)(()
=>
{
Event
.
once
(
this
.
_quickOpenService
.
onHide
)(()
=>
{
activeTextEditorWidget
.
updateOptions
(
restoreOptions
!
);
activeTextEditorWidget
!
.
updateOptions
(
restoreOptions
!
);
});
});
}
}
...
@@ -92,7 +96,7 @@ class GotoLineEntry extends EditorQuickOpenEntry {
...
@@ -92,7 +96,7 @@ class GotoLineEntry extends EditorQuickOpenEntry {
// Inform user about valid range if input is invalid
// Inform user about valid range if input is invalid
const
maxLineNumber
=
this
.
getMaxLineNumber
();
const
maxLineNumber
=
this
.
getMaxLineNumber
();
if
(
this
.
invalidRange
(
maxLineNumber
))
{
if
(
this
.
editorService
.
activeTextEditorWidget
&&
this
.
invalidRange
(
maxLineNumber
))
{
const
position
=
this
.
editorService
.
activeTextEditorWidget
.
getPosition
();
const
position
=
this
.
editorService
.
activeTextEditorWidget
.
getPosition
();
if
(
position
)
{
if
(
position
)
{
const
currentLine
=
position
.
lineNumber
;
const
currentLine
=
position
.
lineNumber
;
...
@@ -115,6 +119,9 @@ class GotoLineEntry extends EditorQuickOpenEntry {
...
@@ -115,6 +119,9 @@ class GotoLineEntry extends EditorQuickOpenEntry {
private
getMaxLineNumber
():
number
{
private
getMaxLineNumber
():
number
{
const
activeTextEditorWidget
=
this
.
editorService
.
activeTextEditorWidget
;
const
activeTextEditorWidget
=
this
.
editorService
.
activeTextEditorWidget
;
if
(
!
activeTextEditorWidget
)
{
return
-
1
;
}
let
model
=
activeTextEditorWidget
.
getModel
();
let
model
=
activeTextEditorWidget
.
getModel
();
if
(
model
&&
(
<
IDiffEditorModel
>
model
).
modified
&&
(
<
IDiffEditorModel
>
model
).
original
)
{
if
(
model
&&
(
<
IDiffEditorModel
>
model
).
modified
&&
(
<
IDiffEditorModel
>
model
).
original
)
{
...
@@ -132,8 +139,8 @@ class GotoLineEntry extends EditorQuickOpenEntry {
...
@@ -132,8 +139,8 @@ class GotoLineEntry extends EditorQuickOpenEntry {
return
this
.
runPreview
();
return
this
.
runPreview
();
}
}
getInput
():
IEditorInput
{
getInput
():
IEditorInput
|
null
{
return
this
.
editorService
.
activeEditor
;
return
this
.
editorService
.
activeEditor
||
null
;
}
}
getOptions
(
pinned
?:
boolean
):
ITextEditorOptions
{
getOptions
(
pinned
?:
boolean
):
ITextEditorOptions
{
...
@@ -153,7 +160,7 @@ class GotoLineEntry extends EditorQuickOpenEntry {
...
@@ -153,7 +160,7 @@ class GotoLineEntry extends EditorQuickOpenEntry {
// Check for sideBySide use
// Check for sideBySide use
const
sideBySide
=
context
.
keymods
.
ctrlCmd
;
const
sideBySide
=
context
.
keymods
.
ctrlCmd
;
if
(
sideBySide
)
{
if
(
sideBySide
)
{
this
.
editorService
.
openEditor
(
this
.
getInput
(),
this
.
getOptions
(
context
.
keymods
.
alt
),
SIDE_GROUP
);
this
.
editorService
.
openEditor
(
this
.
getInput
()
!
,
this
.
getOptions
(
context
.
keymods
.
alt
),
SIDE_GROUP
);
}
}
// Apply selection and focus
// Apply selection and focus
...
@@ -183,8 +190,8 @@ class GotoLineEntry extends EditorQuickOpenEntry {
...
@@ -183,8 +190,8 @@ class GotoLineEntry extends EditorQuickOpenEntry {
activeTextEditorWidget
.
revealRangeInCenter
(
range
,
ScrollType
.
Smooth
);
activeTextEditorWidget
.
revealRangeInCenter
(
range
,
ScrollType
.
Smooth
);
// Decorate if possible
// Decorate if possible
if
(
types
.
isFunction
(
activeTextEditorWidget
.
changeDecorations
))
{
if
(
t
his
.
editorService
.
activeControl
&&
t
ypes
.
isFunction
(
activeTextEditorWidget
.
changeDecorations
))
{
this
.
handler
.
decorateOutline
(
range
,
activeTextEditorWidget
,
this
.
editorService
.
activeControl
.
group
!
);
this
.
handler
.
decorateOutline
(
range
,
activeTextEditorWidget
,
this
.
editorService
.
activeControl
.
group
);
}
}
}
}
...
@@ -236,8 +243,10 @@ export class GotoLineHandler extends QuickOpenHandler {
...
@@ -236,8 +243,10 @@ export class GotoLineHandler extends QuickOpenHandler {
// Remember view state to be able to restore on cancel
// Remember view state to be able to restore on cancel
if
(
!
this
.
lastKnownEditorViewState
)
{
if
(
!
this
.
lastKnownEditorViewState
)
{
const
activeTextEditorWidget
=
this
.
editorService
.
activeTextEditorWidget
;
const
activeTextEditorWidget
=
this
.
editorService
.
activeTextEditorWidget
;
if
(
activeTextEditorWidget
)
{
this
.
lastKnownEditorViewState
=
activeTextEditorWidget
.
saveViewState
();
this
.
lastKnownEditorViewState
=
activeTextEditorWidget
.
saveViewState
();
}
}
}
return
Promise
.
resolve
(
new
QuickOpenModel
([
new
GotoLineEntry
(
searchValue
,
this
.
editorService
,
this
)]));
return
Promise
.
resolve
(
new
QuickOpenModel
([
new
GotoLineEntry
(
searchValue
,
this
.
editorService
,
this
)]));
}
}
...
...
src/vs/workbench/contrib/quickopen/browser/gotoSymbolHandler.ts
浏览文件 @
9d667371
...
@@ -288,8 +288,8 @@ class SymbolEntry extends EditorQuickOpenEntryGroup {
...
@@ -288,8 +288,8 @@ class SymbolEntry extends EditorQuickOpenEntryGroup {
return
this
.
range
;
return
this
.
range
;
}
}
getInput
():
IEditorInput
{
getInput
():
IEditorInput
|
null
{
return
this
.
editorService
.
activeEditor
;
return
this
.
editorService
.
activeEditor
||
null
;
}
}
getOptions
(
pinned
?:
boolean
):
ITextEditorOptions
{
getOptions
(
pinned
?:
boolean
):
ITextEditorOptions
{
...
@@ -312,7 +312,7 @@ class SymbolEntry extends EditorQuickOpenEntryGroup {
...
@@ -312,7 +312,7 @@ class SymbolEntry extends EditorQuickOpenEntryGroup {
// Check for sideBySide use
// Check for sideBySide use
const
sideBySide
=
context
.
keymods
.
ctrlCmd
;
const
sideBySide
=
context
.
keymods
.
ctrlCmd
;
if
(
sideBySide
)
{
if
(
sideBySide
)
{
this
.
editorService
.
openEditor
(
this
.
getInput
(),
this
.
getOptions
(
context
.
keymods
.
alt
),
SIDE_GROUP
);
this
.
editorService
.
openEditor
(
this
.
getInput
()
!
,
this
.
getOptions
(
context
.
keymods
.
alt
),
SIDE_GROUP
);
}
}
// Apply selection and focus
// Apply selection and focus
...
@@ -337,8 +337,8 @@ class SymbolEntry extends EditorQuickOpenEntryGroup {
...
@@ -337,8 +337,8 @@ class SymbolEntry extends EditorQuickOpenEntryGroup {
activeTextEditorWidget
.
revealRangeInCenter
(
range
,
ScrollType
.
Smooth
);
activeTextEditorWidget
.
revealRangeInCenter
(
range
,
ScrollType
.
Smooth
);
// Decorate if possible
// Decorate if possible
if
(
types
.
isFunction
(
activeTextEditorWidget
.
changeDecorations
))
{
if
(
t
his
.
editorService
.
activeControl
&&
t
ypes
.
isFunction
(
activeTextEditorWidget
.
changeDecorations
))
{
this
.
handler
.
decorateOutline
(
this
.
range
,
range
,
activeTextEditorWidget
,
this
.
editorService
.
activeControl
.
group
!
);
this
.
handler
.
decorateOutline
(
this
.
range
,
range
,
activeTextEditorWidget
,
this
.
editorService
.
activeControl
.
group
);
}
}
}
}
...
@@ -401,8 +401,10 @@ export class GotoSymbolHandler extends QuickOpenHandler {
...
@@ -401,8 +401,10 @@ export class GotoSymbolHandler extends QuickOpenHandler {
// Remember view state to be able to restore on cancel
// Remember view state to be able to restore on cancel
if
(
!
this
.
lastKnownEditorViewState
)
{
if
(
!
this
.
lastKnownEditorViewState
)
{
const
activeTextEditorWidget
=
this
.
editorService
.
activeTextEditorWidget
;
const
activeTextEditorWidget
=
this
.
editorService
.
activeTextEditorWidget
;
if
(
activeTextEditorWidget
)
{
this
.
lastKnownEditorViewState
=
activeTextEditorWidget
.
saveViewState
();
this
.
lastKnownEditorViewState
=
activeTextEditorWidget
.
saveViewState
();
}
}
}
// Resolve Outline Model
// Resolve Outline Model
return
this
.
getOutline
().
then
(
outline
=>
{
return
this
.
getOutline
().
then
(
outline
=>
{
...
...
src/vs/workbench/services/history/browser/history.ts
浏览文件 @
9d667371
...
@@ -217,7 +217,7 @@ export class HistoryService extends Disposable implements IHistoryService {
...
@@ -217,7 +217,7 @@ export class HistoryService extends Disposable implements IHistoryService {
// Track the last edit location by tracking model content change events
// Track the last edit location by tracking model content change events
// Use a debouncer to make sure to capture the correct cursor position
// Use a debouncer to make sure to capture the correct cursor position
// after the model content has changed.
// after the model content has changed.
this
.
activeEditorListeners
.
push
(
Event
.
debounce
(
activeTextEditorWidget
.
onDidChangeModelContent
,
(
last
,
event
)
=>
event
,
0
)((
event
=>
this
.
rememberLastEditLocation
(
activeEditor
,
activeTextEditorWidget
))));
this
.
activeEditorListeners
.
push
(
Event
.
debounce
(
activeTextEditorWidget
.
onDidChangeModelContent
,
(
last
,
event
)
=>
event
,
0
)((
event
=>
this
.
rememberLastEditLocation
(
activeEditor
!
,
activeTextEditorWidget
))));
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录