Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
0362fc49
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,发现更多精彩内容 >>
提交
0362fc49
编写于
1月 04, 2019
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Strict null check editorControl
上级
899fb82c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
9 deletion
+13
-9
src/tsconfig.strictNullChecks.json
src/tsconfig.strictNullChecks.json
+1
-0
src/vs/workbench/browser/parts/editor/baseEditor.ts
src/vs/workbench/browser/parts/editor/baseEditor.ts
+2
-2
src/vs/workbench/browser/parts/editor/editorControl.ts
src/vs/workbench/browser/parts/editor/editorControl.ts
+10
-7
未找到文件。
src/tsconfig.strictNullChecks.json
浏览文件 @
0362fc49
...
...
@@ -527,6 +527,7 @@
"./vs/workbench/browser/parts/editor/baseEditor.ts"
,
"./vs/workbench/browser/parts/editor/binaryEditor.ts"
,
"./vs/workbench/browser/parts/editor/editor.ts"
,
"./vs/workbench/browser/parts/editor/editorControl.ts"
,
"./vs/workbench/browser/parts/editor/editorWidgets.ts"
,
"./vs/workbench/browser/parts/editor/rangeDecorations.ts"
,
"./vs/workbench/browser/parts/editor/resourceViewer.ts"
,
...
...
src/vs/workbench/browser/parts/editor/baseEditor.ts
浏览文件 @
0362fc49
...
...
@@ -77,7 +77,7 @@ export abstract class BaseEditor extends Panel implements IEditor {
* The provided cancellation token should be used to test if the operation
* was cancelled.
*/
setInput
(
input
:
EditorInput
,
options
:
EditorOptions
,
token
:
CancellationToken
):
Promise
<
void
>
{
setInput
(
input
:
EditorInput
,
options
:
EditorOptions
|
null
,
token
:
CancellationToken
):
Promise
<
void
>
{
this
.
_input
=
input
;
this
.
_options
=
options
;
...
...
@@ -100,7 +100,7 @@ export abstract class BaseEditor extends Panel implements IEditor {
* Sets the given options to the editor. Clients should apply the options
* to the current input.
*/
setOptions
(
options
:
EditorOptions
):
void
{
setOptions
(
options
:
EditorOptions
|
null
):
void
{
this
.
_options
=
options
;
}
...
...
src/vs/workbench/browser/parts/editor/editorControl.ts
浏览文件 @
0362fc49
...
...
@@ -30,10 +30,10 @@ export class EditorControl extends Disposable {
private
_onDidFocus
:
Emitter
<
void
>
=
this
.
_register
(
new
Emitter
<
void
>
());
get
onDidFocus
():
Event
<
void
>
{
return
this
.
_onDidFocus
.
event
;
}
private
_onDidSizeConstraintsChange
=
this
.
_register
(
new
Emitter
<
{
width
:
number
;
height
:
number
;
}
>
());
get
onDidSizeConstraintsChange
():
Event
<
{
width
:
number
;
height
:
number
;
}
>
{
return
this
.
_onDidSizeConstraintsChange
.
event
;
}
private
_onDidSizeConstraintsChange
=
this
.
_register
(
new
Emitter
<
{
width
:
number
;
height
:
number
;
}
|
undefined
>
());
get
onDidSizeConstraintsChange
():
Event
<
{
width
:
number
;
height
:
number
;
}
|
undefined
>
{
return
this
.
_onDidSizeConstraintsChange
.
event
;
}
private
_activeControl
:
BaseEditor
;
private
_activeControl
:
BaseEditor
|
null
;
private
controls
:
BaseEditor
[]
=
[];
private
activeControlDisposeables
:
IDisposable
[]
=
[];
...
...
@@ -52,7 +52,7 @@ export class EditorControl extends Disposable {
this
.
editorOperation
=
this
.
_register
(
new
LongRunningOperation
(
progressService
));
}
get
activeControl
()
:
BaseEditor
{
get
activeControl
()
{
return
this
.
_activeControl
;
}
...
...
@@ -60,10 +60,13 @@ export class EditorControl extends Disposable {
// Editor control
const
descriptor
=
Registry
.
as
<
IEditorRegistry
>
(
EditorExtensions
.
Editors
).
getEditor
(
editor
);
if
(
!
descriptor
)
{
throw
new
Error
(
'
No editor descriptor found
'
);
}
const
control
=
this
.
doShowEditorControl
(
descriptor
);
// Set input
return
this
.
doSetInput
(
control
,
editor
,
options
).
then
((
editorChanged
=>
(({
control
,
editorChanged
}
as
IOpenEditorResult
))));
return
this
.
doSetInput
(
control
,
editor
,
options
||
null
).
then
((
editorChanged
=>
(({
control
,
editorChanged
}
as
IOpenEditorResult
))));
}
private
doShowEditorControl
(
descriptor
:
IEditorDescriptor
):
BaseEditor
{
...
...
@@ -129,7 +132,7 @@ export class EditorControl extends Disposable {
return
control
;
}
private
doSetActiveControl
(
control
:
BaseEditor
)
{
private
doSetActiveControl
(
control
:
BaseEditor
|
null
)
{
this
.
_activeControl
=
control
;
// Clear out previous active control listeners
...
...
@@ -145,7 +148,7 @@ export class EditorControl extends Disposable {
this
.
_onDidSizeConstraintsChange
.
fire
(
undefined
);
}
private
doSetInput
(
control
:
BaseEditor
,
editor
:
EditorInput
,
options
:
EditorOptions
):
Promise
<
boolean
>
{
private
doSetInput
(
control
:
BaseEditor
,
editor
:
EditorInput
,
options
:
EditorOptions
|
null
):
Promise
<
boolean
>
{
// If the input did not change, return early and only apply the options
// unless the options instruct us to force open it even if it is the same
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录