Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
c549276d
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,发现更多精彩内容 >>
提交
c549276d
编写于
1月 16, 2019
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Strict null check references widget
上级
82e9561f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
20 addition
and
7 deletion
+20
-7
src/tsconfig.strictNullChecks.json
src/tsconfig.strictNullChecks.json
+2
-0
src/vs/editor/contrib/referenceSearch/referencesWidget.ts
src/vs/editor/contrib/referenceSearch/referencesWidget.ts
+18
-7
未找到文件。
src/tsconfig.strictNullChecks.json
浏览文件 @
c549276d
...
...
@@ -245,6 +245,7 @@
"./vs/editor/contrib/referenceSearch/peekViewWidget.ts"
,
"./vs/editor/contrib/referenceSearch/referencesModel.ts"
,
"./vs/editor/contrib/referenceSearch/referencesTree.ts"
,
"./vs/editor/contrib/referenceSearch/referencesWidget.ts"
,
"./vs/editor/contrib/referenceSearch/test/referencesModel.test.ts"
,
"./vs/editor/contrib/rename/rename.ts"
,
"./vs/editor/contrib/rename/renameInputField.ts"
,
...
...
@@ -872,6 +873,7 @@
"./vs/workbench/services/themes/common/workbenchThemeService.ts"
,
"./vs/workbench/services/themes/electron-browser/fileIconThemeData.ts"
,
"./vs/workbench/services/themes/electron-browser/fileIconThemeStore.ts"
,
"./vs/workbench/services/themes/electron-browser/themeCompatibility.ts"
,
"./vs/workbench/services/timer/electron-browser/timerService.ts"
,
"./vs/workbench/services/title/common/titleService.ts"
,
"./vs/workbench/services/viewlet/browser/viewlet.ts"
,
...
...
src/vs/editor/contrib/referenceSearch/referencesWidget.ts
浏览文件 @
c549276d
...
...
@@ -72,6 +72,9 @@ class DecorationsManager implements IDisposable {
}
private
_addDecorations
(
reference
:
FileReferences
):
void
{
if
(
!
this
.
_editor
.
hasModel
())
{
return
;
}
this
.
_callOnModelChange
.
push
(
this
.
_editor
.
getModel
().
onDidChangeDecorations
((
event
)
=>
this
.
_onDecorationChanged
()));
const
newDecorations
:
IModelDeltaDecoration
[]
=
[];
...
...
@@ -98,8 +101,13 @@ class DecorationsManager implements IDisposable {
private
_onDecorationChanged
():
void
{
const
toRemove
:
string
[]
=
[];
const
model
=
this
.
_editor
.
getModel
();
if
(
!
model
)
{
return
;
}
this
.
_decorations
.
forEach
((
reference
,
decorationId
)
=>
{
const
newRange
=
this
.
_editor
.
getModel
()
.
getDecorationRange
(
decorationId
);
const
newRange
=
model
.
getDecorationRange
(
decorationId
);
if
(
!
newRange
)
{
return
;
...
...
@@ -220,7 +228,7 @@ export interface LayoutData {
export
interface
SelectionEvent
{
kind
:
'
goto
'
|
'
show
'
|
'
side
'
|
'
open
'
;
source
:
'
editor
'
|
'
tree
'
|
'
title
'
;
element
:
Location
;
element
?
:
Location
;
}
export
const
ctxReferenceWidgetSearchTreeFocused
=
new
RawContextKey
<
boolean
>
(
'
referenceSearchTreeFocused
'
,
true
);
...
...
@@ -424,7 +432,7 @@ export class ReferenceWidget extends PeekViewWidget {
// store layout data
this
.
layoutData
=
{
heightInLines
:
this
.
_viewZone
.
heightInLines
,
heightInLines
:
this
.
_viewZone
?
this
.
_viewZone
.
heightInLines
:
0
,
ratio
:
this
.
_sash
.
ratio
};
}
...
...
@@ -446,7 +454,7 @@ export class ReferenceWidget extends PeekViewWidget {
});
}
public
setModel
(
newModel
:
ReferencesModel
|
undefined
):
Promise
<
any
>
{
public
setModel
(
newModel
:
ReferencesModel
|
undefined
):
Promise
<
any
>
|
undefined
{
// clean up
this
.
_disposeOnNewModel
=
dispose
(
this
.
_disposeOnNewModel
);
this
.
_model
=
newModel
;
...
...
@@ -457,6 +465,9 @@ export class ReferenceWidget extends PeekViewWidget {
}
private
_onNewModel
():
Promise
<
any
>
{
if
(
!
this
.
_model
)
{
return
Promise
.
resolve
(
undefined
);
}
if
(
this
.
_model
.
empty
)
{
this
.
setTitle
(
''
);
...
...
@@ -483,7 +494,7 @@ export class ReferenceWidget extends PeekViewWidget {
return
;
}
this
.
_onDidSelectReference
.
fire
({
element
:
{
uri
:
element
.
uri
,
range
:
target
.
range
},
element
:
{
uri
:
element
.
uri
,
range
:
target
.
range
!
},
kind
:
(
event
.
ctrlKey
||
event
.
metaKey
||
event
.
altKey
)
?
'
side
'
:
'
open
'
,
source
:
'
editor
'
});
...
...
@@ -501,7 +512,7 @@ export class ReferenceWidget extends PeekViewWidget {
return
this
.
_tree
.
setInput
(
this
.
_model
.
groups
.
length
===
1
?
this
.
_model
.
groups
[
0
]
:
this
.
_model
);
}
private
_getFocusedReference
():
OneReference
{
private
_getFocusedReference
():
OneReference
|
undefined
{
const
[
element
]
=
this
.
_tree
.
getFocus
();
if
(
element
instanceof
OneReference
)
{
return
element
;
...
...
@@ -525,7 +536,7 @@ export class ReferenceWidget extends PeekViewWidget {
// Update widget header
if
(
reference
.
uri
.
scheme
!==
Schemas
.
inMemory
)
{
this
.
setTitle
(
basenameOrAuthority
(
reference
.
uri
),
this
.
_uriLabel
.
getUriLabel
(
dirname
(
reference
.
uri
)));
this
.
setTitle
(
basenameOrAuthority
(
reference
.
uri
),
this
.
_uriLabel
.
getUriLabel
(
dirname
(
reference
.
uri
)
!
));
}
else
{
this
.
setTitle
(
nls
.
localize
(
'
peekView.alternateTitle
'
,
"
References
"
));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录