Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
7b12aeb4
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,发现更多精彩内容 >>
提交
7b12aeb4
编写于
11月 23, 2016
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
config-editing, api-test use strictNull-checks, #6907
上级
07464cb1
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
40 addition
and
35 deletion
+40
-35
extensions/configuration-editing/src/extension.ts
extensions/configuration-editing/src/extension.ts
+12
-12
extensions/configuration-editing/tsconfig.json
extensions/configuration-editing/tsconfig.json
+3
-2
extensions/extension-editing/src/extension.ts
extensions/extension-editing/src/extension.ts
+1
-1
extensions/vscode-api-tests/src/utils.ts
extensions/vscode-api-tests/src/utils.ts
+2
-2
extensions/vscode-api-tests/src/window.test.ts
extensions/vscode-api-tests/src/window.test.ts
+1
-1
extensions/vscode-api-tests/src/workspace.test.ts
extensions/vscode-api-tests/src/workspace.test.ts
+14
-13
extensions/vscode-api-tests/tsconfig.json
extensions/vscode-api-tests/tsconfig.json
+3
-2
extensions/vscode-api-tests/typings/mocha.d.ts
extensions/vscode-api-tests/typings/mocha.d.ts
+2
-1
src/typings/mocha.d.ts
src/typings/mocha.d.ts
+2
-1
未找到文件。
extensions/configuration-editing/src/extension.ts
浏览文件 @
7b12aeb4
...
...
@@ -44,12 +44,22 @@ function registerKeybindingsCompletions(): vscode.Disposable {
});
}
function
updateLaunchJsonDecorations
(
editor
:
vscode
.
TextEditor
)
{
function
newCompletionItem
(
text
:
string
,
range
:
vscode
.
Range
)
{
const
item
=
new
vscode
.
CompletionItem
(
JSON
.
stringify
(
text
));
item
.
kind
=
vscode
.
CompletionItemKind
.
Value
;
item
.
textEdit
=
{
range
,
newText
:
item
.
label
};
return
item
;
}
function
updateLaunchJsonDecorations
(
editor
:
vscode
.
TextEditor
|
undefined
)
{
if
(
!
editor
||
path
.
basename
(
editor
.
document
.
fileName
)
!==
'
launch.json
'
)
{
return
;
}
const
ranges
=
[];
const
ranges
:
vscode
.
Range
[]
=
[];
let
addPropertyAndValue
=
false
;
visit
(
editor
.
document
.
getText
(),
{
onObjectProperty
:
(
property
,
offset
,
length
)
=>
{
...
...
@@ -68,13 +78,3 @@ function updateLaunchJsonDecorations(editor: vscode.TextEditor) {
editor
.
setDecorations
(
decoration
,
ranges
);
}
function
newCompletionItem
(
text
:
string
,
range
:
vscode
.
Range
,
documentation
?:
string
)
{
const
item
=
new
vscode
.
CompletionItem
(
JSON
.
stringify
(
text
));
item
.
kind
=
vscode
.
CompletionItemKind
.
Value
;
item
.
documentation
=
documentation
;
item
.
textEdit
=
{
range
,
newText
:
item
.
label
};
return
item
;
}
extensions/configuration-editing/tsconfig.json
浏览文件 @
7b12aeb4
...
...
@@ -3,9 +3,10 @@
"noLib"
:
true
,
"target"
:
"es5"
,
"module"
:
"commonjs"
,
"outDir"
:
"./out"
"outDir"
:
"./out"
,
"strictNullChecks"
:
true
},
"exclude"
:
[
"node_modules"
]
}
\ No newline at end of file
}
extensions/extension-editing/src/extension.ts
浏览文件 @
7b12aeb4
...
...
@@ -83,7 +83,7 @@ namespace ast {
let
end
=
Number
.
MAX_VALUE
;
for
(
let
name
of
dottedName
.
split
(
'
.
'
))
{
let
idx
:
number
;
let
idx
:
number
=
-
1
;
while
((
idx
=
identifiers
.
indexOf
(
name
,
idx
+
1
))
>=
0
)
{
let
myStart
=
spans
[
2
*
idx
];
let
myEnd
=
spans
[
2
*
idx
+
1
];
...
...
extensions/vscode-api-tests/src/utils.ts
浏览文件 @
7b12aeb4
...
...
@@ -62,7 +62,7 @@ export function cleanUp(): Thenable<any> {
}
});
vscode
.
commands
.
executeCommand
(
'
workbench.action.closeAllEditors
'
).
then
(
null
,
reject
);
vscode
.
commands
.
executeCommand
(
'
workbench.action.closeAllEditors
'
).
then
(
undefined
,
reject
);
}).
then
(()
=>
{
assert
.
equal
(
vscode
.
window
.
visibleTextEditors
.
length
,
0
);
...
...
@@ -76,4 +76,4 @@ export function cleanUp(): Thenable<any> {
// assert.equal(vscode.workspace.textDocuments.length, 0);
});
}
\ No newline at end of file
}
extensions/vscode-api-tests/src/window.test.ts
浏览文件 @
7b12aeb4
...
...
@@ -19,7 +19,7 @@ suite('window namespace tests', () => {
return
window
.
showTextDocument
(
doc
).
then
((
editor
)
=>
{
const
active
=
window
.
activeTextEditor
;
assert
.
ok
(
active
);
assert
.
ok
(
pathEquals
(
active
.
document
.
uri
.
fsPath
,
doc
.
uri
.
fsPath
));
assert
.
ok
(
pathEquals
(
active
!
.
document
.
uri
.
fsPath
,
doc
.
uri
.
fsPath
));
});
});
});
...
...
extensions/vscode-api-tests/src/workspace.test.ts
浏览文件 @
7b12aeb4
...
...
@@ -6,7 +6,7 @@
'
use strict
'
;
import
*
as
assert
from
'
assert
'
;
import
{
workspace
,
TextDocument
,
window
,
Position
,
Uri
,
EventEmitter
,
WorkspaceEdit
}
from
'
vscode
'
;
import
{
workspace
,
TextDocument
,
window
,
Position
,
Uri
,
EventEmitter
,
WorkspaceEdit
,
Disposable
}
from
'
vscode
'
;
import
{
createRandomFile
,
deleteFile
,
cleanUp
,
pathEquals
}
from
'
./utils
'
;
import
{
join
,
basename
}
from
'
path
'
;
import
*
as
fs
from
'
fs
'
;
...
...
@@ -48,11 +48,13 @@ suite('workspace-namespace', () => {
test
(
'
textDocuments
'
,
()
=>
{
assert
.
ok
(
Array
.
isArray
(
workspace
.
textDocuments
));
assert
.
throws
(()
=>
workspace
.
textDocuments
=
null
);
assert
.
throws
(()
=>
(
<
any
>
workspace
)
.
textDocuments
=
null
);
});
test
(
'
rootPath
'
,
()
=>
{
assert
.
ok
(
pathEquals
(
workspace
.
rootPath
,
join
(
__dirname
,
'
../testWorkspace
'
)));
if
(
workspace
.
rootPath
)
{
assert
.
ok
(
pathEquals
(
workspace
.
rootPath
,
join
(
__dirname
,
'
../testWorkspace
'
)));
}
assert
.
throws
(()
=>
workspace
.
rootPath
=
'
farboo
'
);
});
...
...
@@ -64,23 +66,22 @@ suite('workspace-namespace', () => {
});
});
test
(
'
openTextDocument, illegal path
'
,
done
=>
{
workspace
.
openTextDocument
(
'
funkydonky.txt
'
).
then
(
doc
=>
{
done
(
new
Error
(
'
missing error
'
)
);
test
(
'
openTextDocument, illegal path
'
,
()
=>
{
return
workspace
.
openTextDocument
(
'
funkydonky.txt
'
).
then
(
doc
=>
{
throw
new
Error
(
'
missing error
'
);
},
err
=>
{
done
();
// good!
});
});
test
(
'
openTextDocument, untitled is dirty
'
,
function
(
done
)
{
test
(
'
openTextDocument, untitled is dirty
'
,
function
()
{
if
(
process
.
platform
===
'
win32
'
)
{
return
done
()
;
// TODO@Joh this test fails on windows
return
;
// TODO@Joh this test fails on windows
}
workspace
.
openTextDocument
(
Uri
.
parse
(
'
untitled:
'
+
join
(
workspace
.
rootPath
,
'
./newfile.txt
'
))).
then
(
doc
=>
{
return
workspace
.
openTextDocument
(
Uri
.
parse
(
'
untitled:
'
+
join
(
workspace
.
rootPath
,
'
./newfile.txt
'
))).
then
(
doc
=>
{
assert
.
equal
(
doc
.
uri
.
scheme
,
'
untitled
'
);
assert
.
ok
(
doc
.
isDirty
);
done
();
});
});
...
...
@@ -137,7 +138,7 @@ suite('workspace-namespace', () => {
test
(
'
events: onDidOpenTextDocument, onDidChangeTextDocument, onDidSaveTextDocument
'
,
()
=>
{
return
createRandomFile
().
then
(
file
=>
{
let
disposables
=
[];
let
disposables
:
Disposable
[]
=
[];
let
onDidOpenTextDocument
=
false
;
disposables
.
push
(
workspace
.
onDidOpenTextDocument
(
e
=>
{
...
...
@@ -370,7 +371,7 @@ suite('workspace-namespace', () => {
});
test
(
'
findFiles
'
,
()
=>
{
return
workspace
.
findFiles
(
'
*.js
'
,
null
).
then
((
res
)
=>
{
return
workspace
.
findFiles
(
'
*.js
'
).
then
((
res
)
=>
{
assert
.
equal
(
res
.
length
,
1
);
assert
.
equal
(
basename
(
workspace
.
asRelativePath
(
res
[
0
])),
'
far.js
'
);
});
...
...
extensions/vscode-api-tests/tsconfig.json
浏览文件 @
7b12aeb4
...
...
@@ -4,9 +4,10 @@
"target"
:
"ES5"
,
"outDir"
:
"out"
,
"noLib"
:
true
,
"sourceMap"
:
true
"sourceMap"
:
true
,
"strictNullChecks"
:
true
},
"exclude"
:
[
"node_modules"
]
}
\ No newline at end of file
}
extensions/vscode-api-tests/typings/mocha.d.ts
浏览文件 @
7b12aeb4
...
...
@@ -6,7 +6,8 @@
declare
function
run
():
void
;
declare
function
suite
(
name
:
string
,
fn
:
(
err
?)
=>
void
);
declare
function
test
(
name
:
string
,
fn
:
(
done
?:
(
err
?)
=>
void
)
=>
void
);
declare
function
test
(
name
:
string
,
fn
:
()
=>
void
);
declare
function
test
(
name
:
string
,
fn
:
(
done
:
(
err
?)
=>
void
)
=>
void
);
declare
function
suiteSetup
(
fn
:
(
done
?:
(
err
?)
=>
void
)
=>
void
);
declare
function
suiteTeardown
(
fn
:
(
done
?:
(
err
?)
=>
void
)
=>
void
);
declare
function
setup
(
fn
:
(
done
?:
(
err
?)
=>
void
)
=>
void
);
...
...
src/typings/mocha.d.ts
浏览文件 @
7b12aeb4
...
...
@@ -6,7 +6,8 @@
declare
function
run
():
void
;
declare
function
suite
(
name
:
string
,
fn
:
(
err
?)
=>
void
);
declare
function
test
(
name
:
string
,
fn
:
(
done
?:
(
err
?)
=>
void
)
=>
void
);
declare
function
test
(
name
:
string
,
fn
:
()
=>
void
);
declare
function
test
(
name
:
string
,
fn
:
(
done
:
(
err
?)
=>
void
)
=>
void
);
declare
function
suiteSetup
(
fn
:
(
done
?:
(
err
?)
=>
void
)
=>
void
);
declare
function
suiteTeardown
(
fn
:
(
done
?:
(
err
?)
=>
void
)
=>
void
);
declare
function
setup
(
fn
:
(
done
?:
(
err
?)
=>
void
)
=>
void
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录