Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
9e440ff0
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,发现更多精彩内容 >>
提交
9e440ff0
编写于
2月 15, 2019
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Strict null work
上级
536691a1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
29 addition
and
28 deletion
+29
-28
src/vs/workbench/browser/parts/editor/editorStatus.ts
src/vs/workbench/browser/parts/editor/editorStatus.ts
+19
-18
src/vs/workbench/browser/parts/editor/titleControl.ts
src/vs/workbench/browser/parts/editor/titleControl.ts
+2
-2
src/vs/workbench/contrib/search/browser/searchResultsView.ts
src/vs/workbench/contrib/search/browser/searchResultsView.ts
+2
-2
src/vs/workbench/contrib/search/browser/searchView.ts
src/vs/workbench/contrib/search/browser/searchView.ts
+6
-6
未找到文件。
src/vs/workbench/browser/parts/editor/editorStatus.ts
浏览文件 @
9e440ff0
...
@@ -585,10 +585,12 @@ export class EditorStatus implements IStatusbarItem {
...
@@ -585,10 +585,12 @@ export class EditorStatus implements IStatusbarItem {
this
.
onEOLChange
(
activeCodeEditor
);
this
.
onEOLChange
(
activeCodeEditor
);
const
selections
=
activeCodeEditor
.
getSelections
();
const
selections
=
activeCodeEditor
.
getSelections
();
for
(
const
change
of
e
.
changes
)
{
if
(
selections
)
{
if
(
selections
.
some
(
selection
=>
Range
.
areIntersecting
(
selection
,
change
.
range
)))
{
for
(
const
change
of
e
.
changes
)
{
this
.
onSelectionChange
(
activeCodeEditor
);
if
(
selections
.
some
(
selection
=>
Range
.
areIntersecting
(
selection
,
change
.
range
)))
{
break
;
this
.
onSelectionChange
(
activeCodeEditor
);
break
;
}
}
}
}
}
}));
}));
...
@@ -662,7 +664,7 @@ export class EditorStatus implements IStatusbarItem {
...
@@ -662,7 +664,7 @@ export class EditorStatus implements IStatusbarItem {
this
.
updateState
(
update
);
this
.
updateState
(
update
);
}
}
private
onMetadataChange
(
editor
:
IBaseEditor
):
void
{
private
onMetadataChange
(
editor
:
IBaseEditor
|
undefined
):
void
{
const
update
:
StateDelta
=
{
metadata
:
undefined
};
const
update
:
StateDelta
=
{
metadata
:
undefined
};
if
(
editor
instanceof
BaseBinaryResourceEditor
||
editor
instanceof
BinaryResourceDiffEditor
)
{
if
(
editor
instanceof
BaseBinaryResourceEditor
||
editor
instanceof
BinaryResourceDiffEditor
)
{
...
@@ -762,7 +764,7 @@ export class EditorStatus implements IStatusbarItem {
...
@@ -762,7 +764,7 @@ export class EditorStatus implements IStatusbarItem {
// We only support text based editors
// We only support text based editors
if
(
e
&&
(
isCodeEditor
(
e
.
getControl
())
||
isDiffEditor
(
e
.
getControl
())))
{
if
(
e
&&
(
isCodeEditor
(
e
.
getControl
())
||
isDiffEditor
(
e
.
getControl
())))
{
const
encodingSupport
:
IEncodingSupport
=
toEditorWithEncodingSupport
(
e
.
input
)
;
const
encodingSupport
:
IEncodingSupport
|
null
=
e
.
input
?
toEditorWithEncodingSupport
(
e
.
input
)
:
null
;
if
(
encodingSupport
)
{
if
(
encodingSupport
)
{
const
rawEncoding
=
encodingSupport
.
getEncoding
();
const
rawEncoding
=
encodingSupport
.
getEncoding
();
const
encodingInfo
=
SUPPORTED_ENCODINGS
[
rawEncoding
];
const
encodingInfo
=
SUPPORTED_ENCODINGS
[
rawEncoding
];
...
@@ -858,19 +860,19 @@ export class ChangeModeAction extends Action {
...
@@ -858,19 +860,19 @@ export class ChangeModeAction extends Action {
}
}
const
textModel
=
activeTextEditorWidget
.
getModel
();
const
textModel
=
activeTextEditorWidget
.
getModel
();
const
resource
=
t
oResource
(
this
.
editorService
.
activeEditor
,
{
supportSideBySide
:
true
})
;
const
resource
=
t
his
.
editorService
.
activeEditor
?
toResource
(
this
.
editorService
.
activeEditor
,
{
supportSideBySide
:
true
})
:
null
;
let
hasLanguageSupport
=
!!
resource
;
let
hasLanguageSupport
=
!!
resource
;
if
(
resource
.
scheme
===
Schemas
.
untitled
&&
!
this
.
untitledEditorService
.
hasAssociatedFilePath
(
resource
))
{
if
(
resource
&&
resource
.
scheme
===
Schemas
.
untitled
&&
!
this
.
untitledEditorService
.
hasAssociatedFilePath
(
resource
))
{
hasLanguageSupport
=
false
;
// no configuration for untitled resources (e.g. "Untitled-1")
hasLanguageSupport
=
false
;
// no configuration for untitled resources (e.g. "Untitled-1")
}
}
// Compute mode
// Compute mode
let
currentModeId
:
string
;
let
currentModeId
:
string
|
undefined
;
let
modeId
:
string
;
let
modeId
:
string
;
if
(
textModel
)
{
if
(
textModel
)
{
modeId
=
textModel
.
getLanguageIdentifier
().
language
;
modeId
=
textModel
.
getLanguageIdentifier
().
language
;
currentModeId
=
this
.
modeService
.
getLanguageName
(
modeId
);
currentModeId
=
this
.
modeService
.
getLanguageName
(
modeId
)
||
undefined
;
}
}
// All languages are valid picks
// All languages are valid picks
...
@@ -910,7 +912,7 @@ export class ChangeModeAction extends Action {
...
@@ -910,7 +912,7 @@ export class ChangeModeAction extends Action {
let
configureModeAssociations
:
IQuickPickItem
;
let
configureModeAssociations
:
IQuickPickItem
;
let
configureModeSettings
:
IQuickPickItem
;
let
configureModeSettings
:
IQuickPickItem
;
let
galleryAction
:
Action
;
let
galleryAction
:
Action
;
if
(
hasLanguageSupport
)
{
if
(
hasLanguageSupport
&&
resource
)
{
const
ext
=
extname
(
resource
)
||
basename
(
resource
);
const
ext
=
extname
(
resource
)
||
basename
(
resource
);
galleryAction
=
this
.
instantiationService
.
createInstance
(
ShowLanguageExtensionsAction
,
ext
);
galleryAction
=
this
.
instantiationService
.
createInstance
(
ShowLanguageExtensionsAction
,
ext
);
...
@@ -1026,11 +1028,7 @@ export class ChangeModeAction extends Action {
...
@@ -1026,11 +1028,7 @@ export class ChangeModeAction extends Action {
}
}
// Make sure to write into the value of the target and not the merged value from USER and WORKSPACE config
// Make sure to write into the value of the target and not the merged value from USER and WORKSPACE config
let
currentAssociations
=
deepClone
((
target
===
ConfigurationTarget
.
WORKSPACE
)
?
fileAssociationsConfig
.
workspace
:
fileAssociationsConfig
.
user
);
const
currentAssociations
=
deepClone
((
target
===
ConfigurationTarget
.
WORKSPACE
)
?
fileAssociationsConfig
.
workspace
:
fileAssociationsConfig
.
user
)
||
Object
.
create
(
null
);
if
(
!
currentAssociations
)
{
currentAssociations
=
Object
.
create
(
null
);
}
currentAssociations
[
associationKey
]
=
language
.
id
;
currentAssociations
[
associationKey
]
=
language
.
id
;
this
.
configurationService
.
updateValue
(
FILES_ASSOCIATIONS_CONFIG
,
currentAssociations
,
target
);
this
.
configurationService
.
updateValue
(
FILES_ASSOCIATIONS_CONFIG
,
currentAssociations
,
target
);
...
@@ -1161,7 +1159,10 @@ export class ChangeEncodingAction extends Action {
...
@@ -1161,7 +1159,10 @@ export class ChangeEncodingAction extends Action {
}
}
let
activeControl
=
this
.
editorService
.
activeControl
;
let
activeControl
=
this
.
editorService
.
activeControl
;
let
encodingSupport
:
IEncodingSupport
=
toEditorWithEncodingSupport
(
activeControl
.
input
);
if
(
!
activeControl
)
{
return
this
.
quickInputService
.
pick
([{
label
:
nls
.
localize
(
'
noEditor
'
,
"
No text editor active at this time
"
)
}]);
}
let
encodingSupport
:
IEncodingSupport
|
null
=
toEditorWithEncodingSupport
(
activeControl
.
input
);
if
(
!
encodingSupport
)
{
if
(
!
encodingSupport
)
{
return
this
.
quickInputService
.
pick
([{
label
:
nls
.
localize
(
'
noFileEditor
'
,
"
No file active at this time
"
)
}]);
return
this
.
quickInputService
.
pick
([{
label
:
nls
.
localize
(
'
noFileEditor
'
,
"
No file active at this time
"
)
}]);
}
}
...
@@ -1206,7 +1207,7 @@ export class ChangeEncodingAction extends Action {
...
@@ -1206,7 +1207,7 @@ export class ChangeEncodingAction extends Action {
const
configuredEncoding
=
this
.
textResourceConfigurationService
.
getValue
(
resource
,
'
files.encoding
'
);
const
configuredEncoding
=
this
.
textResourceConfigurationService
.
getValue
(
resource
,
'
files.encoding
'
);
let
directMatchIndex
:
number
|
undefined
;
let
directMatchIndex
:
number
|
undefined
;
let
aliasMatchIndex
:
number
;
let
aliasMatchIndex
:
number
|
undefined
;
// All encodings are valid picks
// All encodings are valid picks
const
picks
:
QuickPickInput
[]
=
Object
.
keys
(
SUPPORTED_ENCODINGS
)
const
picks
:
QuickPickInput
[]
=
Object
.
keys
(
SUPPORTED_ENCODINGS
)
...
...
src/vs/workbench/browser/parts/editor/titleControl.ts
浏览文件 @
9e440ff0
...
@@ -217,7 +217,7 @@ export abstract class TitleControl extends Themable {
...
@@ -217,7 +217,7 @@ export abstract class TitleControl extends Themable {
this
.
editorToolBarMenuDisposables
=
dispose
(
this
.
editorToolBarMenuDisposables
);
this
.
editorToolBarMenuDisposables
=
dispose
(
this
.
editorToolBarMenuDisposables
);
// Update the resource context
// Update the resource context
this
.
resourceContext
.
set
(
t
oResource
(
this
.
group
.
activeEditor
,
{
supportSideBySide
:
true
})
);
this
.
resourceContext
.
set
(
t
his
.
group
.
activeEditor
?
toResource
(
this
.
group
.
activeEditor
,
{
supportSideBySide
:
true
})
:
null
);
// Editor actions require the editor control to be there, so we retrieve it via service
// Editor actions require the editor control to be there, so we retrieve it via service
const
activeControl
=
this
.
group
.
activeControl
;
const
activeControl
=
this
.
group
.
activeControl
;
...
@@ -312,7 +312,7 @@ export abstract class TitleControl extends Themable {
...
@@ -312,7 +312,7 @@ export abstract class TitleControl extends Themable {
});
});
}
}
private
getKeybinding
(
action
:
IAction
):
ResolvedKeybinding
{
private
getKeybinding
(
action
:
IAction
):
ResolvedKeybinding
|
undefined
{
return
this
.
keybindingService
.
lookupKeybinding
(
action
.
id
);
return
this
.
keybindingService
.
lookupKeybinding
(
action
.
id
);
}
}
...
...
src/vs/workbench/contrib/search/browser/searchResultsView.ts
浏览文件 @
9e440ff0
...
@@ -308,7 +308,7 @@ export class SearchAccessibilityProvider implements IAccessibilityProvider<Rende
...
@@ -308,7 +308,7 @@ export class SearchAccessibilityProvider implements IAccessibilityProvider<Rende
)
{
)
{
}
}
getAriaLabel
(
element
:
RenderableMatch
):
string
{
getAriaLabel
(
element
:
RenderableMatch
):
string
|
null
{
if
(
element
instanceof
BaseFolderMatch
)
{
if
(
element
instanceof
BaseFolderMatch
)
{
return
element
.
hasResource
()
?
return
element
.
hasResource
()
?
nls
.
localize
(
'
folderMatchAriaLabel
'
,
"
{0} matches in folder root {1}, Search result
"
,
element
.
count
(),
element
.
name
())
:
nls
.
localize
(
'
folderMatchAriaLabel
'
,
"
{0} matches in folder root {1}, Search result
"
,
element
.
count
(),
element
.
name
())
:
...
@@ -334,7 +334,7 @@ export class SearchAccessibilityProvider implements IAccessibilityProvider<Rende
...
@@ -334,7 +334,7 @@ export class SearchAccessibilityProvider implements IAccessibilityProvider<Rende
return
nls
.
localize
(
'
searchResultAria
'
,
"
Found term {0} at column position {1} in line with text {2}
"
,
matchString
,
range
.
startColumn
+
1
,
matchText
);
return
nls
.
localize
(
'
searchResultAria
'
,
"
Found term {0} at column position {1} in line with text {2}
"
,
matchString
,
range
.
startColumn
+
1
,
matchText
);
}
}
return
undefined
;
return
null
;
}
}
}
}
...
...
src/vs/workbench/contrib/search/browser/searchView.ts
浏览文件 @
9e440ff0
...
@@ -116,7 +116,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
...
@@ -116,7 +116,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
private
currentSelectedFileMatch
:
FileMatch
;
private
currentSelectedFileMatch
:
FileMatch
;
private
readonly
selectCurrentMatchEmitter
:
Emitter
<
string
>
;
private
readonly
selectCurrentMatchEmitter
:
Emitter
<
string
|
undefined
>
;
private
delayedRefresh
:
Delayer
<
void
>
;
private
delayedRefresh
:
Delayer
<
void
>
;
private
changedWhileHidden
:
boolean
;
private
changedWhileHidden
:
boolean
;
...
@@ -704,7 +704,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
...
@@ -704,7 +704,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
}
}
selectNextMatch
():
void
{
selectNextMatch
():
void
{
const
[
selected
]
:
RenderableMatch
[]
=
this
.
tree
.
getSelection
();
const
[
selected
]
=
this
.
tree
.
getSelection
();
// Expand the initial selected node, if needed
// Expand the initial selected node, if needed
if
(
selected
instanceof
FileMatch
)
{
if
(
selected
instanceof
FileMatch
)
{
...
@@ -742,7 +742,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
...
@@ -742,7 +742,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
}
}
selectPreviousMatch
():
void
{
selectPreviousMatch
():
void
{
const
[
selected
]
:
RenderableMatch
[]
=
this
.
tree
.
getSelection
();
const
[
selected
]
=
this
.
tree
.
getSelection
();
let
navigator
=
this
.
tree
.
navigate
(
selected
);
let
navigator
=
this
.
tree
.
navigate
(
selected
);
let
prev
=
navigator
.
previous
();
let
prev
=
navigator
.
previous
();
...
@@ -757,7 +757,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
...
@@ -757,7 +757,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
// This is complicated because .last will set the navigator to the last FileMatch,
// This is complicated because .last will set the navigator to the last FileMatch,
// so expand it and FF to its last child
// so expand it and FF to its last child
this
.
tree
.
expand
(
prev
);
this
.
tree
.
expand
(
prev
);
let
tmp
:
RenderableMatch
;
let
tmp
:
RenderableMatch
|
null
;
while
(
tmp
=
navigator
.
next
())
{
while
(
tmp
=
navigator
.
next
())
{
prev
=
tmp
;
prev
=
tmp
;
}
}
...
@@ -967,7 +967,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
...
@@ -967,7 +967,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
}
}
}
}
private
getSearchTextFromEditor
(
allowUnselectedWord
:
boolean
):
string
{
private
getSearchTextFromEditor
(
allowUnselectedWord
:
boolean
):
string
|
null
{
if
(
!
this
.
editorService
.
activeEditor
)
{
if
(
!
this
.
editorService
.
activeEditor
)
{
return
null
;
return
null
;
}
}
...
@@ -985,7 +985,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
...
@@ -985,7 +985,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
}
}
}
}
if
(
!
isCodeEditor
(
activeTextEditorWidget
))
{
if
(
!
isCodeEditor
(
activeTextEditorWidget
)
||
!
activeTextEditorWidget
.
hasModel
()
)
{
return
null
;
return
null
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录