Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
82863aac
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,发现更多精彩内容 >>
未验证
提交
82863aac
编写于
11月 30, 2018
作者:
M
Matt Bierner
提交者:
GitHub
11月 30, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Strict null checking snippetsService.ts (#63456)
上级
2f3fc3f6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
33 addition
and
20 deletion
+33
-20
src/tsconfig.strictNullChecks.json
src/tsconfig.strictNullChecks.json
+1
-0
src/vs/workbench/parts/snippets/electron-browser/snippetsFile.ts
...workbench/parts/snippets/electron-browser/snippetsFile.ts
+2
-2
src/vs/workbench/parts/snippets/electron-browser/snippetsService.ts
...kbench/parts/snippets/electron-browser/snippetsService.ts
+30
-18
未找到文件。
src/tsconfig.strictNullChecks.json
浏览文件 @
82863aac
...
@@ -618,6 +618,7 @@
...
@@ -618,6 +618,7 @@
"./vs/workbench/parts/snippets/electron-browser/snippetCompletionProvider.ts"
,
"./vs/workbench/parts/snippets/electron-browser/snippetCompletionProvider.ts"
,
"./vs/workbench/parts/snippets/electron-browser/snippets.contribution.ts"
,
"./vs/workbench/parts/snippets/electron-browser/snippets.contribution.ts"
,
"./vs/workbench/parts/snippets/electron-browser/snippetsFile.ts"
,
"./vs/workbench/parts/snippets/electron-browser/snippetsFile.ts"
,
"./vs/workbench/parts/snippets/electron-browser/snippetsService.ts"
,
"./vs/workbench/parts/surveys/electron-browser/nps.contribution.ts"
,
"./vs/workbench/parts/surveys/electron-browser/nps.contribution.ts"
,
"./vs/workbench/parts/tasks/common/problemCollectors.ts"
,
"./vs/workbench/parts/tasks/common/problemCollectors.ts"
,
"./vs/workbench/parts/tasks/common/problemMatcher.ts"
,
"./vs/workbench/parts/tasks/common/problemMatcher.ts"
,
...
...
src/vs/workbench/parts/snippets/electron-browser/snippetsFile.ts
浏览文件 @
82863aac
...
@@ -148,8 +148,8 @@ export class SnippetFile {
...
@@ -148,8 +148,8 @@ export class SnippetFile {
constructor
(
constructor
(
readonly
source
:
SnippetSource
,
readonly
source
:
SnippetSource
,
readonly
location
:
URI
,
readonly
location
:
URI
,
readonly
defaultScopes
:
string
[]
,
public
defaultScopes
:
string
[]
|
undefined
,
private
readonly
_extension
:
IExtensionDescription
,
private
readonly
_extension
:
IExtensionDescription
|
undefined
,
private
readonly
_fileService
:
IFileService
private
readonly
_fileService
:
IFileService
)
{
)
{
this
.
isGlobalSnippets
=
extname
(
location
.
path
)
===
'
.code-snippets
'
;
this
.
isGlobalSnippets
=
extname
(
location
.
path
)
===
'
.code-snippets
'
;
...
...
src/vs/workbench/parts/snippets/electron-browser/snippetsService.ts
浏览文件 @
82863aac
...
@@ -39,7 +39,7 @@ namespace snippetExt {
...
@@ -39,7 +39,7 @@ namespace snippetExt {
location
:
URI
;
location
:
URI
;
}
}
export
function
toValidSnippet
(
extension
:
IExtensionPointUser
<
ISnippetsExtensionPoint
[]
>
,
snippet
:
ISnippetsExtensionPoint
,
modeService
:
IModeService
):
IValidSnippetsExtensionPoint
{
export
function
toValidSnippet
(
extension
:
IExtensionPointUser
<
ISnippetsExtensionPoint
[]
>
,
snippet
:
ISnippetsExtensionPoint
,
modeService
:
IModeService
):
IValidSnippetsExtensionPoint
|
null
{
if
(
isFalsyOrWhitespace
(
snippet
.
path
))
{
if
(
isFalsyOrWhitespace
(
snippet
.
path
))
{
extension
.
collector
.
error
(
localize
(
extension
.
collector
.
error
(
localize
(
...
@@ -167,28 +167,35 @@ class SnippetsService implements ISnippetsService {
...
@@ -167,28 +167,35 @@ class SnippetsService implements ISnippetsService {
getSnippets
(
languageId
:
LanguageId
):
Promise
<
Snippet
[]
>
{
getSnippets
(
languageId
:
LanguageId
):
Promise
<
Snippet
[]
>
{
return
this
.
_joinSnippets
().
then
(()
=>
{
return
this
.
_joinSnippets
().
then
(()
=>
{
const
langName
=
this
.
_modeService
.
getLanguageIdentifier
(
languageId
).
language
;
const
result
:
Snippet
[]
=
[];
const
result
:
Snippet
[]
=
[];
const
promises
:
Promise
<
any
>
[]
=
[];
const
promises
:
Promise
<
any
>
[]
=
[];
this
.
_files
.
forEach
(
file
=>
{
promises
.
push
(
file
.
load
()
const
languageIdentifier
=
this
.
_modeService
.
getLanguageIdentifier
(
languageId
);
.
then
(
file
=>
file
.
select
(
langName
,
result
))
if
(
languageIdentifier
)
{
.
catch
(
err
=>
this
.
_logService
.
error
(
err
,
file
.
location
.
toString
()))
const
langName
=
languageIdentifier
.
language
;
);
this
.
_files
.
forEach
(
file
=>
{
});
promises
.
push
(
file
.
load
()
.
then
(
file
=>
file
.
select
(
langName
,
result
))
.
catch
(
err
=>
this
.
_logService
.
error
(
err
,
file
.
location
.
toString
()))
);
});
}
return
Promise
.
all
(
promises
).
then
(()
=>
result
);
return
Promise
.
all
(
promises
).
then
(()
=>
result
);
});
});
}
}
getSnippetsSync
(
languageId
:
LanguageId
):
Snippet
[]
{
getSnippetsSync
(
languageId
:
LanguageId
):
Snippet
[]
{
const
langName
=
this
.
_modeService
.
getLanguageIdentifier
(
languageId
).
language
;
const
result
:
Snippet
[]
=
[];
const
result
:
Snippet
[]
=
[];
this
.
_files
.
forEach
(
file
=>
{
const
languageIdentifier
=
this
.
_modeService
.
getLanguageIdentifier
(
languageId
);
// kick off loading (which is a noop in case it's already loaded)
if
(
languageIdentifier
)
{
// and optimistically collect snippets
const
langName
=
languageIdentifier
.
language
;
file
.
load
().
catch
(
err
=>
{
/*ignore*/
});
this
.
_files
.
forEach
(
file
=>
{
file
.
select
(
langName
,
result
);
// kick off loading (which is a noop in case it's already loaded)
});
// and optimistically collect snippets
file
.
load
().
catch
(
err
=>
{
/*ignore*/
});
file
.
select
(
langName
,
result
);
});
}
return
result
;
return
result
;
}
}
...
@@ -203,9 +210,14 @@ class SnippetsService implements ISnippetsService {
...
@@ -203,9 +210,14 @@ class SnippetsService implements ISnippetsService {
continue
;
continue
;
}
}
if
(
this
.
_files
.
has
(
validContribution
.
location
.
toString
()))
{
const
resource
=
validContribution
.
location
.
toString
();
this
.
_files
.
get
(
validContribution
.
location
.
toString
()).
defaultScopes
.
push
(
validContribution
.
language
);
if
(
this
.
_files
.
has
(
resource
))
{
const
file
=
this
.
_files
.
get
(
resource
);
if
(
file
.
defaultScopes
)
{
file
.
defaultScopes
.
push
(
validContribution
.
language
);
}
else
{
file
.
defaultScopes
=
[];
}
}
else
{
}
else
{
const
file
=
new
SnippetFile
(
SnippetSource
.
Extension
,
validContribution
.
location
,
validContribution
.
language
?
[
validContribution
.
language
]
:
undefined
,
extension
.
description
,
this
.
_fileService
);
const
file
=
new
SnippetFile
(
SnippetSource
.
Extension
,
validContribution
.
location
,
validContribution
.
language
?
[
validContribution
.
language
]
:
undefined
,
extension
.
description
,
this
.
_fileService
);
this
.
_files
.
set
(
file
.
location
.
toString
(),
file
);
this
.
_files
.
set
(
file
.
location
.
toString
(),
file
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录