Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
86ceb0c8
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,发现更多精彩内容 >>
提交
86ceb0c8
编写于
10月 01, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Enable noUnusedParameters in configurationHelper
上级
02e4aada
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
18 deletion
+19
-18
extensions/configuration-editing/src/extension.ts
extensions/configuration-editing/src/extension.ts
+14
-14
extensions/configuration-editing/src/settingsDocumentHelper.ts
...sions/configuration-editing/src/settingsDocumentHelper.ts
+3
-3
extensions/configuration-editing/tsconfig.json
extensions/configuration-editing/tsconfig.json
+2
-1
未找到文件。
extensions/configuration-editing/src/extension.ts
浏览文件 @
86ceb0c8
...
@@ -70,7 +70,7 @@ function autoFixSettingsJSON(willSaveEvent: vscode.TextDocumentWillSaveEvent): v
...
@@ -70,7 +70,7 @@ function autoFixSettingsJSON(willSaveEvent: vscode.TextDocumentWillSaveEvent): v
lastEndOfSomething
=
offset
+
length
;
lastEndOfSomething
=
offset
+
length
;
},
},
onLiteralValue
(
value
:
any
,
offset
:
number
,
length
:
number
):
void
{
onLiteralValue
(
_
value
:
any
,
offset
:
number
,
length
:
number
):
void
{
lastEndOfSomething
=
offset
+
length
;
lastEndOfSomething
=
offset
+
length
;
},
},
...
@@ -78,7 +78,7 @@ function autoFixSettingsJSON(willSaveEvent: vscode.TextDocumentWillSaveEvent): v
...
@@ -78,7 +78,7 @@ function autoFixSettingsJSON(willSaveEvent: vscode.TextDocumentWillSaveEvent): v
lastEndOfSomething
=
offset
+
length
;
lastEndOfSomething
=
offset
+
length
;
},
},
onError
(
error
:
ParseErrorCode
,
offset
:
number
,
length
:
number
):
void
{
onError
(
error
:
ParseErrorCode
,
_offset
:
number
,
_
length
:
number
):
void
{
if
(
error
===
ParseErrorCode
.
CommaExpected
&&
lastEndOfSomething
>
-
1
)
{
if
(
error
===
ParseErrorCode
.
CommaExpected
&&
lastEndOfSomething
>
-
1
)
{
const
fixPosition
=
document
.
positionAt
(
lastEndOfSomething
);
const
fixPosition
=
document
.
positionAt
(
lastEndOfSomething
);
...
@@ -100,7 +100,7 @@ function registerKeybindingsCompletions(): vscode.Disposable {
...
@@ -100,7 +100,7 @@ function registerKeybindingsCompletions(): vscode.Disposable {
return
vscode
.
languages
.
registerCompletionItemProvider
({
pattern
:
'
**/keybindings.json
'
},
{
return
vscode
.
languages
.
registerCompletionItemProvider
({
pattern
:
'
**/keybindings.json
'
},
{
provideCompletionItems
(
document
,
position
,
token
)
{
provideCompletionItems
(
document
,
position
,
_
token
)
{
const
location
=
getLocation
(
document
.
getText
(),
document
.
offsetAt
(
position
));
const
location
=
getLocation
(
document
.
getText
(),
document
.
offsetAt
(
position
));
if
(
location
.
path
[
1
]
===
'
command
'
)
{
if
(
location
.
path
[
1
]
===
'
command
'
)
{
...
@@ -121,7 +121,7 @@ function registerSettingsCompletions(): vscode.Disposable {
...
@@ -121,7 +121,7 @@ function registerSettingsCompletions(): vscode.Disposable {
function
registerVariableCompletions
(
pattern
:
string
):
vscode
.
Disposable
{
function
registerVariableCompletions
(
pattern
:
string
):
vscode
.
Disposable
{
return
vscode
.
languages
.
registerCompletionItemProvider
({
language
:
'
jsonc
'
,
pattern
},
{
return
vscode
.
languages
.
registerCompletionItemProvider
({
language
:
'
jsonc
'
,
pattern
},
{
provideCompletionItems
(
document
,
position
,
token
)
{
provideCompletionItems
(
document
,
position
,
_
token
)
{
const
location
=
getLocation
(
document
.
getText
(),
document
.
offsetAt
(
position
));
const
location
=
getLocation
(
document
.
getText
(),
document
.
offsetAt
(
position
));
if
(
!
location
.
isAtPropertyKey
&&
location
.
previousNode
&&
location
.
previousNode
.
type
===
'
string
'
)
{
if
(
!
location
.
isAtPropertyKey
&&
location
.
previousNode
&&
location
.
previousNode
.
type
===
'
string
'
)
{
const
indexOf$
=
document
.
lineAt
(
position
.
line
).
text
.
indexOf
(
'
$
'
);
const
indexOf$
=
document
.
lineAt
(
position
.
line
).
text
.
indexOf
(
'
$
'
);
...
@@ -153,7 +153,7 @@ function registerExtensionsCompletions(): vscode.Disposable[] {
...
@@ -153,7 +153,7 @@ function registerExtensionsCompletions(): vscode.Disposable[] {
function
registerExtensionsCompletionsInExtensionsDocument
():
vscode
.
Disposable
{
function
registerExtensionsCompletionsInExtensionsDocument
():
vscode
.
Disposable
{
return
vscode
.
languages
.
registerCompletionItemProvider
({
pattern
:
'
**/extensions.json
'
},
{
return
vscode
.
languages
.
registerCompletionItemProvider
({
pattern
:
'
**/extensions.json
'
},
{
provideCompletionItems
(
document
,
position
,
token
)
{
provideCompletionItems
(
document
,
position
,
_
token
)
{
const
location
=
getLocation
(
document
.
getText
(),
document
.
offsetAt
(
position
));
const
location
=
getLocation
(
document
.
getText
(),
document
.
offsetAt
(
position
));
const
range
=
document
.
getWordRangeAtPosition
(
position
)
||
new
vscode
.
Range
(
position
,
position
);
const
range
=
document
.
getWordRangeAtPosition
(
position
)
||
new
vscode
.
Range
(
position
,
position
);
if
(
location
.
path
[
0
]
===
'
recommendations
'
)
{
if
(
location
.
path
[
0
]
===
'
recommendations
'
)
{
...
@@ -167,7 +167,7 @@ function registerExtensionsCompletionsInExtensionsDocument(): vscode.Disposable
...
@@ -167,7 +167,7 @@ function registerExtensionsCompletionsInExtensionsDocument(): vscode.Disposable
function
registerExtensionsCompletionsInWorkspaceConfigurationDocument
():
vscode
.
Disposable
{
function
registerExtensionsCompletionsInWorkspaceConfigurationDocument
():
vscode
.
Disposable
{
return
vscode
.
languages
.
registerCompletionItemProvider
({
pattern
:
'
**/*.code-workspace
'
},
{
return
vscode
.
languages
.
registerCompletionItemProvider
({
pattern
:
'
**/*.code-workspace
'
},
{
provideCompletionItems
(
document
,
position
,
token
)
{
provideCompletionItems
(
document
,
position
,
_
token
)
{
const
location
=
getLocation
(
document
.
getText
(),
document
.
offsetAt
(
position
));
const
location
=
getLocation
(
document
.
getText
(),
document
.
offsetAt
(
position
));
const
range
=
document
.
getWordRangeAtPosition
(
position
)
||
new
vscode
.
Range
(
position
,
position
);
const
range
=
document
.
getWordRangeAtPosition
(
position
)
||
new
vscode
.
Range
(
position
,
position
);
if
(
location
.
path
[
0
]
===
'
extensions
'
&&
location
.
path
[
1
]
===
'
recommendations
'
)
{
if
(
location
.
path
[
0
]
===
'
extensions
'
&&
location
.
path
[
1
]
===
'
recommendations
'
)
{
...
@@ -233,15 +233,15 @@ function updateLaunchJsonDecorations(editor: vscode.TextEditor | undefined): voi
...
@@ -233,15 +233,15 @@ function updateLaunchJsonDecorations(editor: vscode.TextEditor | undefined): voi
ranges
.
push
(
new
vscode
.
Range
(
editor
.
document
.
positionAt
(
offset
),
editor
.
document
.
positionAt
(
offset
+
length
)));
ranges
.
push
(
new
vscode
.
Range
(
editor
.
document
.
positionAt
(
offset
),
editor
.
document
.
positionAt
(
offset
+
length
)));
}
}
},
},
onLiteralValue
:
(
value
,
offset
,
length
)
=>
{
onLiteralValue
:
(
_
value
,
offset
,
length
)
=>
{
if
(
addPropertyAndValue
)
{
if
(
addPropertyAndValue
)
{
ranges
.
push
(
new
vscode
.
Range
(
editor
.
document
.
positionAt
(
offset
),
editor
.
document
.
positionAt
(
offset
+
length
)));
ranges
.
push
(
new
vscode
.
Range
(
editor
.
document
.
positionAt
(
offset
),
editor
.
document
.
positionAt
(
offset
+
length
)));
}
}
},
},
onArrayBegin
:
(
offset
:
number
,
length
:
number
)
=>
{
onArrayBegin
:
(
_offset
:
number
,
_
length
:
number
)
=>
{
depthInArray
++
;
depthInArray
++
;
},
},
onArrayEnd
:
(
offset
:
number
,
length
:
number
)
=>
{
onArrayEnd
:
(
_offset
:
number
,
_
length
:
number
)
=>
{
depthInArray
--
;
depthInArray
--
;
}
}
});
});
...
@@ -250,7 +250,7 @@ function updateLaunchJsonDecorations(editor: vscode.TextEditor | undefined): voi
...
@@ -250,7 +250,7 @@ function updateLaunchJsonDecorations(editor: vscode.TextEditor | undefined): voi
}
}
vscode
.
languages
.
registerDocumentSymbolProvider
({
pattern
:
'
**/launch.json
'
,
language
:
'
jsonc
'
},
{
vscode
.
languages
.
registerDocumentSymbolProvider
({
pattern
:
'
**/launch.json
'
,
language
:
'
jsonc
'
},
{
provideDocumentSymbols
(
document
:
vscode
.
TextDocument
,
token
:
vscode
.
CancellationToken
):
vscode
.
ProviderResult
<
vscode
.
SymbolInformation
[]
>
{
provideDocumentSymbols
(
document
:
vscode
.
TextDocument
,
_
token
:
vscode
.
CancellationToken
):
vscode
.
ProviderResult
<
vscode
.
SymbolInformation
[]
>
{
const
result
:
vscode
.
SymbolInformation
[]
=
[];
const
result
:
vscode
.
SymbolInformation
[]
=
[];
let
name
:
string
=
''
;
let
name
:
string
=
''
;
let
lastProperty
=
''
;
let
lastProperty
=
''
;
...
@@ -258,21 +258,21 @@ vscode.languages.registerDocumentSymbolProvider({ pattern: '**/launch.json', lan
...
@@ -258,21 +258,21 @@ vscode.languages.registerDocumentSymbolProvider({ pattern: '**/launch.json', lan
let
depthInObjects
=
0
;
let
depthInObjects
=
0
;
visit
(
document
.
getText
(),
{
visit
(
document
.
getText
(),
{
onObjectProperty
:
(
property
,
offset
,
length
)
=>
{
onObjectProperty
:
(
property
,
_offset
,
_
length
)
=>
{
lastProperty
=
property
;
lastProperty
=
property
;
},
},
onLiteralValue
:
(
value
:
any
,
offset
:
number
,
length
:
number
)
=>
{
onLiteralValue
:
(
value
:
any
,
_offset
:
number
,
_
length
:
number
)
=>
{
if
(
lastProperty
===
'
name
'
)
{
if
(
lastProperty
===
'
name
'
)
{
name
=
value
;
name
=
value
;
}
}
},
},
onObjectBegin
:
(
offset
:
number
,
length
:
number
)
=>
{
onObjectBegin
:
(
offset
:
number
,
_
length
:
number
)
=>
{
depthInObjects
++
;
depthInObjects
++
;
if
(
depthInObjects
===
2
)
{
if
(
depthInObjects
===
2
)
{
startOffset
=
offset
;
startOffset
=
offset
;
}
}
},
},
onObjectEnd
:
(
offset
:
number
,
length
:
number
)
=>
{
onObjectEnd
:
(
offset
:
number
,
_
length
:
number
)
=>
{
if
(
name
&&
depthInObjects
===
2
)
{
if
(
name
&&
depthInObjects
===
2
)
{
result
.
push
(
new
vscode
.
SymbolInformation
(
name
,
vscode
.
SymbolKind
.
Object
,
new
vscode
.
Range
(
document
.
positionAt
(
startOffset
),
document
.
positionAt
(
offset
))));
result
.
push
(
new
vscode
.
SymbolInformation
(
name
,
vscode
.
SymbolKind
.
Object
,
new
vscode
.
Range
(
document
.
positionAt
(
startOffset
),
document
.
positionAt
(
offset
))));
}
}
...
...
extensions/configuration-editing/src/settingsDocumentHelper.ts
浏览文件 @
86ceb0c8
...
@@ -13,7 +13,7 @@ export class SettingsDocument {
...
@@ -13,7 +13,7 @@ export class SettingsDocument {
constructor
(
private
document
:
vscode
.
TextDocument
)
{
}
constructor
(
private
document
:
vscode
.
TextDocument
)
{
}
public
provideCompletionItems
(
position
:
vscode
.
Position
,
token
:
vscode
.
CancellationToken
):
vscode
.
ProviderResult
<
vscode
.
CompletionItem
[]
>
{
public
provideCompletionItems
(
position
:
vscode
.
Position
,
_
token
:
vscode
.
CancellationToken
):
vscode
.
ProviderResult
<
vscode
.
CompletionItem
[]
>
{
const
location
=
getLocation
(
this
.
document
.
getText
(),
this
.
document
.
offsetAt
(
position
));
const
location
=
getLocation
(
this
.
document
.
getText
(),
this
.
document
.
offsetAt
(
position
));
const
range
=
this
.
document
.
getWordRangeAtPosition
(
position
)
||
new
vscode
.
Range
(
position
,
position
);
const
range
=
this
.
document
.
getWordRangeAtPosition
(
position
)
||
new
vscode
.
Range
(
position
,
position
);
...
@@ -40,7 +40,7 @@ export class SettingsDocument {
...
@@ -40,7 +40,7 @@ export class SettingsDocument {
return
this
.
provideLanguageOverridesCompletionItems
(
location
,
position
);
return
this
.
provideLanguageOverridesCompletionItems
(
location
,
position
);
}
}
private
provideWindowTitleCompletionItems
(
location
:
Location
,
range
:
vscode
.
Range
):
vscode
.
ProviderResult
<
vscode
.
CompletionItem
[]
>
{
private
provideWindowTitleCompletionItems
(
_
location
:
Location
,
range
:
vscode
.
Range
):
vscode
.
ProviderResult
<
vscode
.
CompletionItem
[]
>
{
const
completions
:
vscode
.
CompletionItem
[]
=
[];
const
completions
:
vscode
.
CompletionItem
[]
=
[];
completions
.
push
(
this
.
newSimpleCompletionItem
(
'
${activeEditorShort}
'
,
range
,
localize
(
'
activeEditorShort
'
,
"
the file name (e.g. myFile.txt)
"
)));
completions
.
push
(
this
.
newSimpleCompletionItem
(
'
${activeEditorShort}
'
,
range
,
localize
(
'
activeEditorShort
'
,
"
the file name (e.g. myFile.txt)
"
)));
...
@@ -149,7 +149,7 @@ export class SettingsDocument {
...
@@ -149,7 +149,7 @@ export class SettingsDocument {
return
Promise
.
resolve
(
completions
);
return
Promise
.
resolve
(
completions
);
}
}
private
provideLanguageCompletionItems
(
location
:
Location
,
range
:
vscode
.
Range
,
formatFunc
:
(
string
:
string
)
=>
string
=
(
l
)
=>
JSON
.
stringify
(
l
)):
vscode
.
ProviderResult
<
vscode
.
CompletionItem
[]
>
{
private
provideLanguageCompletionItems
(
_
location
:
Location
,
range
:
vscode
.
Range
,
formatFunc
:
(
string
:
string
)
=>
string
=
(
l
)
=>
JSON
.
stringify
(
l
)):
vscode
.
ProviderResult
<
vscode
.
CompletionItem
[]
>
{
return
vscode
.
languages
.
getLanguages
().
then
(
languages
=>
{
return
vscode
.
languages
.
getLanguages
().
then
(
languages
=>
{
const
completionItems
=
[];
const
completionItems
=
[];
const
configuration
=
vscode
.
workspace
.
getConfiguration
();
const
configuration
=
vscode
.
workspace
.
getConfiguration
();
...
...
extensions/configuration-editing/tsconfig.json
浏览文件 @
86ceb0c8
...
@@ -7,7 +7,8 @@
...
@@ -7,7 +7,8 @@
"es2015"
"es2015"
],
],
"strict"
:
true
,
"strict"
:
true
,
"noUnusedLocals"
:
true
"noUnusedLocals"
:
true
,
"noUnusedParameters"
:
true
},
},
"include"
:
[
"include"
:
[
"src/**/*"
"src/**/*"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录