Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
e7a72480
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,发现更多精彩内容 >>
提交
e7a72480
编写于
3月 20, 2019
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Work on implicit any errors
#70352
上级
8a8a5023
变更
17
显示空白变更内容
内联
并排
Showing
17 changed file
with
109 addition
and
104 deletion
+109
-104
src/vs/base/common/path.ts
src/vs/base/common/path.ts
+9
-9
src/vs/base/parts/tree/test/browser/treeModel.test.ts
src/vs/base/parts/tree/test/browser/treeModel.test.ts
+16
-16
src/vs/base/test/common/types.test.ts
src/vs/base/test/common/types.test.ts
+7
-7
src/vs/code/electron-browser/processExplorer/processExplorerMain.ts
...e/electron-browser/processExplorer/processExplorerMain.ts
+5
-5
src/vs/editor/contrib/linesOperations/test/linesOperations.test.ts
...itor/contrib/linesOperations/test/linesOperations.test.ts
+2
-3
src/vs/platform/configuration/test/node/configurationService.test.ts
...form/configuration/test/node/configurationService.test.ts
+1
-1
src/vs/workbench/api/browser/mainThreadQuickOpen.ts
src/vs/workbench/api/browser/mainThreadQuickOpen.ts
+3
-3
src/vs/workbench/api/electron-browser/mainThreadComments.ts
src/vs/workbench/api/electron-browser/mainThreadComments.ts
+15
-14
src/vs/workbench/contrib/experiments/test/electron-browser/experimentalPrompts.test.ts
...riments/test/electron-browser/experimentalPrompts.test.ts
+9
-9
src/vs/workbench/contrib/extensions/electron-browser/extensionsViews.ts
...ch/contrib/extensions/electron-browser/extensionsViews.ts
+5
-3
src/vs/workbench/contrib/stats/node/workspaceStats.ts
src/vs/workbench/contrib/stats/node/workspaceStats.ts
+2
-2
src/vs/workbench/contrib/tasks/common/tasks.ts
src/vs/workbench/contrib/tasks/common/tasks.ts
+7
-7
src/vs/workbench/services/preferences/common/preferencesModels.ts
...orkbench/services/preferences/common/preferencesModels.ts
+10
-10
src/vs/workbench/services/preferences/test/common/preferencesModel.test.ts
...services/preferences/test/common/preferencesModel.test.ts
+3
-3
src/vs/workbench/test/electron-browser/api/extHostMessagerService.test.ts
.../test/electron-browser/api/extHostMessagerService.test.ts
+3
-3
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
...kbench/test/electron-browser/api/extHostTreeViews.test.ts
+5
-3
src/vs/workbench/test/electron-browser/textsearch.perf.integrationTest.ts
.../test/electron-browser/textsearch.perf.integrationTest.ts
+7
-6
未找到文件。
src/vs/base/common/path.ts
浏览文件 @
e7a72480
...
...
@@ -62,27 +62,27 @@ class ErrorInvalidArgType extends Error {
}
}
function
validateString
(
value
:
string
,
name
)
{
function
validateString
(
value
:
string
,
name
:
string
)
{
if
(
typeof
value
!==
'
string
'
)
{
throw
new
ErrorInvalidArgType
(
name
,
'
string
'
,
value
);
}
}
function
isPathSeparator
(
code
)
{
function
isPathSeparator
(
code
:
number
)
{
return
code
===
CHAR_FORWARD_SLASH
||
code
===
CHAR_BACKWARD_SLASH
;
}
function
isPosixPathSeparator
(
code
)
{
function
isPosixPathSeparator
(
code
:
number
)
{
return
code
===
CHAR_FORWARD_SLASH
;
}
function
isWindowsDeviceRoot
(
code
)
{
function
isWindowsDeviceRoot
(
code
:
number
)
{
return
code
>=
CHAR_UPPERCASE_A
&&
code
<=
CHAR_UPPERCASE_Z
||
code
>=
CHAR_LOWERCASE_A
&&
code
<=
CHAR_LOWERCASE_Z
;
}
// Resolves . and .. elements in a path with directory names
function
normalizeString
(
path
,
allowAboveRoot
,
separator
,
isPathSeparator
)
{
function
normalizeString
(
path
:
string
,
allowAboveRoot
:
boolean
,
separator
:
string
,
isPathSeparator
:
(
code
?:
number
)
=>
boolean
)
{
let
res
=
''
;
let
lastSegmentLength
=
0
;
let
lastSlash
=
-
1
;
...
...
@@ -155,7 +155,7 @@ function normalizeString(path, allowAboveRoot, separator, isPathSeparator) {
return
res
;
}
function
_format
(
sep
,
pathObject
)
{
function
_format
(
sep
:
string
,
pathObject
:
ParsedPath
)
{
const
dir
=
pathObject
.
dir
||
pathObject
.
root
;
const
base
=
pathObject
.
base
||
((
pathObject
.
name
||
''
)
+
(
pathObject
.
ext
||
''
));
...
...
@@ -185,7 +185,7 @@ interface IPath {
dirname
(
path
:
string
):
string
;
basename
(
path
:
string
,
ext
?:
string
):
string
;
extname
(
path
:
string
):
string
;
format
(
pathObject
):
string
;
format
(
pathObject
:
ParsedPath
):
string
;
parse
(
path
:
string
):
ParsedPath
;
toNamespacedPath
(
path
:
string
):
string
;
sep
:
'
\\
'
|
'
/
'
;
...
...
@@ -501,7 +501,7 @@ export const win32: IPath = {
}
let
joined
;
let
firstPart
;
let
firstPart
:
string
|
undefined
;
for
(
let
i
=
0
;
i
<
paths
.
length
;
++
i
)
{
const
arg
=
paths
[
i
];
validateString
(
arg
,
'
path
'
);
...
...
@@ -534,7 +534,7 @@ export const win32: IPath = {
// path.join('//server', 'share') -> '\\\\server\\share\\')
let
needsReplace
=
true
;
let
slashCount
=
0
;
if
(
isPathSeparator
(
firstPart
.
charCodeAt
(
0
)))
{
if
(
typeof
firstPart
===
'
string
'
&&
isPathSeparator
(
firstPart
.
charCodeAt
(
0
)))
{
++
slashCount
;
const
firstLen
=
firstPart
.
length
;
if
(
firstLen
>
1
)
{
...
...
src/vs/base/parts/tree/test/browser/treeModel.test.ts
浏览文件 @
e7a72480
...
...
@@ -161,19 +161,19 @@ const SAMPLE: any = {
};
class
TestDataSource
implements
_
.
IDataSource
{
public
getId
(
tree
,
element
):
string
{
public
getId
(
tree
:
_
.
ITree
,
element
:
any
):
string
{
return
element
.
id
;
}
public
hasChildren
(
tree
,
element
):
boolean
{
public
hasChildren
(
tree
:
_
.
ITree
,
element
:
any
):
boolean
{
return
!!
element
.
children
;
}
public
getChildren
(
tree
,
element
):
Promise
<
any
>
{
public
getChildren
(
tree
:
_
.
ITree
,
element
:
any
):
Promise
<
any
>
{
return
Promise
.
resolve
(
element
.
children
);
}
public
getParent
(
tree
,
element
):
Promise
<
any
>
{
public
getParent
(
tree
:
_
.
ITree
,
element
:
any
):
Promise
<
any
>
{
throw
new
Error
(
'
Not implemented
'
);
}
}
...
...
@@ -700,13 +700,13 @@ suite('TreeModel - Expansion', () => {
class
TestFilter
implements
_
.
IFilter
{
public
fn
:
(
any
)
=>
boolean
;
public
fn
:
(
element
:
any
)
=>
boolean
;
constructor
()
{
this
.
fn
=
()
=>
true
;
}
public
isVisible
(
tree
,
element
):
boolean
{
public
isVisible
(
tree
:
_
.
ITree
,
element
:
any
):
boolean
{
return
this
.
fn
(
element
);
}
}
...
...
@@ -1092,39 +1092,39 @@ class DynamicModel implements _.IDataSource {
this
.
promiseFactory
=
null
;
}
public
addChild
(
parent
,
child
):
void
{
public
addChild
(
parent
:
string
,
child
:
string
):
void
{
if
(
!
this
.
data
[
parent
])
{
this
.
data
[
parent
]
=
[];
}
this
.
data
[
parent
].
push
(
child
);
}
public
removeChild
(
parent
,
child
):
void
{
public
removeChild
(
parent
:
string
,
child
:
string
):
void
{
this
.
data
[
parent
].
splice
(
this
.
data
[
parent
].
indexOf
(
child
),
1
);
if
(
this
.
data
[
parent
].
length
===
0
)
{
delete
this
.
data
[
parent
];
}
}
public
move
(
element
,
oldParent
,
newParent
):
void
{
public
move
(
element
:
string
,
oldParent
:
string
,
newParent
:
string
):
void
{
this
.
removeChild
(
oldParent
,
element
);
this
.
addChild
(
newParent
,
element
);
}
public
rename
(
parent
,
oldName
,
newName
):
void
{
public
rename
(
parent
:
string
,
oldName
:
string
,
newName
:
string
):
void
{
this
.
removeChild
(
parent
,
oldName
);
this
.
addChild
(
parent
,
newName
);
}
public
getId
(
tree
,
element
):
string
{
public
getId
(
tree
:
_
.
ITree
,
element
:
any
):
string
{
return
element
;
}
public
hasChildren
(
tree
,
element
):
boolean
{
public
hasChildren
(
tree
:
_
.
ITree
,
element
:
any
):
boolean
{
return
!!
this
.
data
[
element
];
}
public
getChildren
(
tree
,
element
):
Promise
<
any
>
{
public
getChildren
(
tree
:
_
.
ITree
,
element
:
any
):
Promise
<
any
>
{
this
.
_onGetChildren
.
fire
(
element
);
const
result
=
this
.
promiseFactory
?
this
.
promiseFactory
()
:
Promise
.
resolve
(
null
);
return
result
.
then
(()
=>
{
...
...
@@ -1133,7 +1133,7 @@ class DynamicModel implements _.IDataSource {
});
}
public
getParent
(
tree
,
element
):
Promise
<
any
>
{
public
getParent
(
tree
:
_
.
ITree
,
element
:
any
):
Promise
<
any
>
{
throw
new
Error
(
'
Not implemented
'
);
}
}
...
...
@@ -1395,7 +1395,7 @@ suite('TreeModel - Dynamic data model', () => {
assert
.
equal
(
getTimes
,
2
);
assert
.
equal
(
gotTimes
,
1
);
let
p2Complete
;
let
p2Complete
:
()
=>
void
;
dataModel
.
promiseFactory
=
()
=>
{
return
new
Promise
((
c
)
=>
{
p2Complete
=
c
;
});
};
const
p2
=
model
.
refresh
(
'
father
'
);
...
...
@@ -1412,7 +1412,7 @@ suite('TreeModel - Dynamic data model', () => {
assert
.
equal
(
getTimes
,
3
);
assert
.
equal
(
gotTimes
,
2
);
p2Complete
();
p2Complete
!
();
// all good
assert
.
equal
(
refreshTimes
,
5
);
// (+1) second son request
...
...
src/vs/base/test/common/types.test.ts
浏览文件 @
e7a72480
...
...
@@ -176,14 +176,14 @@ suite('Types', () => {
types
.
validateConstraints
([
undefined
],
[
types
.
isUndefined
]);
types
.
validateConstraints
([
1
],
[
types
.
isNumber
]);
function
foo
()
{
}
types
.
validateConstraints
([
new
foo
()],
[
f
oo
]);
class
Foo
{
}
types
.
validateConstraints
([
new
Foo
()],
[
F
oo
]);
function
isFoo
(
f
)
{
}
assert
.
throws
(()
=>
types
.
validateConstraints
([
new
f
oo
()],
[
isFoo
]));
function
isFoo
(
f
:
any
)
{
}
assert
.
throws
(()
=>
types
.
validateConstraints
([
new
F
oo
()],
[
isFoo
]));
function
isFoo2
(
f
)
{
return
true
;
}
types
.
validateConstraints
([
new
f
oo
()],
[
isFoo2
]);
function
isFoo2
(
f
:
any
)
{
return
true
;
}
types
.
validateConstraints
([
new
F
oo
()],
[
isFoo2
]);
assert
.
throws
(()
=>
types
.
validateConstraints
([
1
,
true
],
[
types
.
isNumber
,
types
.
isString
]));
assert
.
throws
(()
=>
types
.
validateConstraints
([
'
2
'
],
[
types
.
isNumber
]));
...
...
@@ -196,7 +196,7 @@ suite('Types', () => {
assert
(
types
.
create
(
zeroConstructor
)
instanceof
zeroConstructor
);
assert
(
types
.
isObject
(
types
.
create
(
zeroConstructor
)));
let
manyArgConstructor
=
function
(
this
:
any
,
foo
,
bar
)
{
let
manyArgConstructor
=
function
(
this
:
any
,
foo
:
any
,
bar
:
any
)
{
this
.
foo
=
foo
;
this
.
bar
=
bar
;
};
...
...
src/vs/code/electron-browser/processExplorer/processExplorerMain.ts
浏览文件 @
e7a72480
...
...
@@ -99,7 +99,7 @@ function attachTo(item: ProcessItem) {
ipcRenderer
.
send
(
'
vscode:workbenchCommand
'
,
{
id
:
'
debug.startFromConfig
'
,
from
:
'
processExplorer
'
,
args
:
[
config
]
});
}
function
getProcessIdWithHighestProperty
(
processList
,
propertyName
:
string
)
{
function
getProcessIdWithHighestProperty
(
processList
:
any
[]
,
propertyName
:
string
)
{
let
max
=
0
;
let
maxProcessId
;
processList
.
forEach
(
process
=>
{
...
...
@@ -112,7 +112,7 @@ function getProcessIdWithHighestProperty(processList, propertyName: string) {
return
maxProcessId
;
}
function
updateProcessInfo
(
processList
):
void
{
function
updateProcessInfo
(
processList
:
any
[]
):
void
{
const
container
=
document
.
getElementById
(
'
process-list
'
);
if
(
!
container
)
{
return
;
...
...
@@ -199,12 +199,12 @@ function applyZoom(zoomLevel: number): void {
browser
.
setZoomLevel
(
webFrame
.
getZoomLevel
(),
/*isTrusted*/
false
);
}
function
showContextMenu
(
e
)
{
function
showContextMenu
(
e
:
MouseEvent
)
{
e
.
preventDefault
();
const
items
:
IContextMenuItem
[]
=
[];
const
pid
=
parseInt
(
e
.
currentTarget
.
id
);
const
pid
=
parseInt
(
(
e
.
currentTarget
as
HTMLElement
)
.
id
);
if
(
pid
&&
typeof
pid
===
'
number
'
)
{
items
.
push
({
label
:
localize
(
'
killProcess
'
,
"
Kill Process
"
),
...
...
@@ -277,7 +277,7 @@ export function startup(data: ProcessExplorerData): void {
applyZoom
(
data
.
zoomLevel
);
// Map window process pids to titles, annotate process names with this when rendering to distinguish between them
ipcRenderer
.
on
(
'
vscode:windowsInfoResponse
'
,
(
event
,
windows
)
=>
{
ipcRenderer
.
on
(
'
vscode:windowsInfoResponse
'
,
(
_event
:
unknown
,
windows
:
any
[]
)
=>
{
mapPidToWindowTitle
=
new
Map
<
number
,
string
>
();
windows
.
forEach
(
window
=>
mapPidToWindowTitle
.
set
(
window
.
pid
,
window
.
title
));
});
...
...
src/vs/editor/contrib/linesOperations/test/linesOperations.test.ts
浏览文件 @
e7a72480
...
...
@@ -196,10 +196,9 @@ suite('Editor Contrib - Line Operations', () => {
const
endOfNonono
=
new
Selection
(
5
,
11
,
5
,
11
);
editor
.
setSelections
([
beforeSecondWasoSelection
,
endOfBCCSelection
,
endOfNonono
]);
let
selections
;
deleteAllLeftAction
.
run
(
null
!
,
editor
);
selections
=
editor
.
getSelections
()
;
let
selections
=
editor
.
getSelections
()
!
;
assert
.
equal
(
model
.
getLineContent
(
2
),
''
);
assert
.
equal
(
model
.
getLineContent
(
3
),
'
waso waso
'
);
...
...
@@ -227,7 +226,7 @@ suite('Editor Contrib - Line Operations', () => {
],
[
5
,
1
,
5
,
1
]);
deleteAllLeftAction
.
run
(
null
!
,
editor
);
selections
=
editor
.
getSelections
();
selections
=
editor
.
getSelections
()
!
;
assert
.
equal
(
model
.
getLineContent
(
1
),
'
hi my name is Carlos Matos waso waso
'
);
assert
.
equal
(
selections
.
length
,
2
);
...
...
src/vs/platform/configuration/test/node/configurationService.test.ts
浏览文件 @
e7a72480
...
...
@@ -19,7 +19,7 @@ import { testFile } from 'vs/base/test/node/utils';
class
SettingsTestEnvironmentService
extends
EnvironmentService
{
constructor
(
args
:
ParsedArgs
,
_execPath
:
string
,
private
customAppSettingsHome
)
{
constructor
(
args
:
ParsedArgs
,
_execPath
:
string
,
private
customAppSettingsHome
:
string
)
{
super
(
args
,
_execPath
);
}
...
...
src/vs/workbench/api/browser/mainThreadQuickOpen.ts
浏览文件 @
e7a72480
...
...
@@ -171,14 +171,14 @@ export class MainThreadQuickOpen implements MainThreadQuickOpenShape {
}
}
else
if
(
param
===
'
items
'
)
{
handlesToItems
.
clear
();
params
[
param
].
forEach
(
item
=>
{
params
[
param
].
forEach
(
(
item
:
TransferQuickPickItems
)
=>
{
handlesToItems
.
set
(
item
.
handle
,
item
);
});
input
[
param
]
=
params
[
param
];
}
else
if
(
param
===
'
activeItems
'
||
param
===
'
selectedItems
'
)
{
input
[
param
]
=
params
[
param
]
.
filter
(
handle
=>
handlesToItems
.
has
(
handle
))
.
map
(
handle
=>
handlesToItems
.
get
(
handle
));
.
filter
(
(
handle
:
number
)
=>
handlesToItems
.
has
(
handle
))
.
map
(
(
handle
:
number
)
=>
handlesToItems
.
get
(
handle
));
}
else
if
(
param
===
'
buttons
'
)
{
input
[
param
]
=
params
.
buttons
!
.
map
(
button
=>
{
if
(
button
.
handle
===
-
1
)
{
...
...
src/vs/workbench/api/electron-browser/mainThreadComments.ts
浏览文件 @
e7a72480
...
...
@@ -22,8 +22,9 @@ import { ICommentsConfiguration } from 'vs/workbench/contrib/comments/electron-b
import
{
ExtensionIdentifier
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
PanelRegistry
,
Extensions
as
PanelExtensions
,
PanelDescriptor
}
from
'
vs/workbench/browser/panel
'
;
import
{
IRange
}
from
'
vs/editor/common/core/range
'
;
import
{
IRange
,
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
export
class
MainThreadDocumentCommentProvider
implements
modes
.
DocumentCommentProvider
{
private
readonly
_proxy
:
ExtHostCommentsShape
;
...
...
@@ -40,39 +41,39 @@ export class MainThreadDocumentCommentProvider implements modes.DocumentCommentP
this
.
_features
=
features
;
}
async
provideDocumentComments
(
uri
,
t
oken
)
{
async
provideDocumentComments
(
uri
:
URI
,
token
:
CancellationT
oken
)
{
return
this
.
_proxy
.
$provideDocumentComments
(
this
.
_handle
,
uri
);
}
async
createNewCommentThread
(
uri
,
range
,
text
,
t
oken
)
{
async
createNewCommentThread
(
uri
:
URI
,
range
:
Range
,
text
:
string
,
token
:
CancellationT
oken
)
{
return
this
.
_proxy
.
$createNewCommentThread
(
this
.
_handle
,
uri
,
range
,
text
);
}
async
replyToCommentThread
(
uri
,
range
,
thread
,
text
,
t
oken
)
{
async
replyToCommentThread
(
uri
:
URI
,
range
:
Range
,
thread
:
modes
.
CommentThread
,
text
:
string
,
token
:
CancellationT
oken
)
{
return
this
.
_proxy
.
$replyToCommentThread
(
this
.
_handle
,
uri
,
range
,
thread
,
text
);
}
async
editComment
(
uri
,
comment
,
text
,
t
oken
)
{
async
editComment
(
uri
:
URI
,
comment
:
modes
.
Comment
,
text
:
string
,
token
:
CancellationT
oken
)
{
return
this
.
_proxy
.
$editComment
(
this
.
_handle
,
uri
,
comment
,
text
);
}
async
deleteComment
(
uri
,
comment
,
t
oken
)
{
async
deleteComment
(
uri
:
URI
,
comment
:
modes
.
Comment
,
token
:
CancellationT
oken
)
{
return
this
.
_proxy
.
$deleteComment
(
this
.
_handle
,
uri
,
comment
);
}
async
startDraft
(
uri
,
t
oken
):
Promise
<
void
>
{
async
startDraft
(
uri
:
URI
,
token
:
CancellationT
oken
):
Promise
<
void
>
{
return
this
.
_proxy
.
$startDraft
(
this
.
_handle
,
uri
);
}
async
deleteDraft
(
uri
,
t
oken
):
Promise
<
void
>
{
async
deleteDraft
(
uri
:
URI
,
token
:
CancellationT
oken
):
Promise
<
void
>
{
return
this
.
_proxy
.
$deleteDraft
(
this
.
_handle
,
uri
);
}
async
finishDraft
(
uri
,
t
oken
):
Promise
<
void
>
{
async
finishDraft
(
uri
:
URI
,
token
:
CancellationT
oken
):
Promise
<
void
>
{
return
this
.
_proxy
.
$finishDraft
(
this
.
_handle
,
uri
);
}
async
addReaction
(
uri
,
comment
:
modes
.
Comment
,
reaction
:
modes
.
CommentReaction
,
t
oken
):
Promise
<
void
>
{
async
addReaction
(
uri
:
URI
,
comment
:
modes
.
Comment
,
reaction
:
modes
.
CommentReaction
,
token
:
CancellationT
oken
):
Promise
<
void
>
{
return
this
.
_proxy
.
$addReaction
(
this
.
_handle
,
uri
,
comment
,
reaction
);
}
async
deleteReaction
(
uri
,
comment
:
modes
.
Comment
,
reaction
:
modes
.
CommentReaction
,
t
oken
):
Promise
<
void
>
{
async
deleteReaction
(
uri
:
URI
,
comment
:
modes
.
Comment
,
reaction
:
modes
.
CommentReaction
,
token
:
CancellationT
oken
):
Promise
<
void
>
{
return
this
.
_proxy
.
$deleteReaction
(
this
.
_handle
,
uri
,
comment
,
reaction
);
}
...
...
@@ -358,7 +359,7 @@ export class MainThreadCommentController {
}
async
getDocumentComments
(
resource
:
URI
,
token
)
{
async
getDocumentComments
(
resource
:
URI
,
token
:
CancellationToken
)
{
let
ret
:
modes
.
CommentThread2
[]
=
[];
for
(
let
thread
of
keys
(
this
.
_threads
))
{
const
commentThread
=
this
.
_threads
.
get
(
thread
)
!
;
...
...
@@ -382,7 +383,7 @@ export class MainThreadCommentController {
};
}
async
getCommentingRanges
(
resource
:
URI
,
token
):
Promise
<
IRange
[]
>
{
async
getCommentingRanges
(
resource
:
URI
,
token
:
CancellationToken
):
Promise
<
IRange
[]
>
{
let
commentingRanges
=
await
this
.
_proxy
.
$provideCommentingRanges
(
this
.
handle
,
resource
,
token
);
return
commentingRanges
||
[];
}
...
...
@@ -391,7 +392,7 @@ export class MainThreadCommentController {
return
this
.
_features
.
reactionGroup
;
}
async
toggleReaction
(
uri
,
thread
:
modes
.
CommentThread2
,
comment
:
modes
.
Comment
,
reaction
:
modes
.
CommentReaction
,
t
oken
):
Promise
<
void
>
{
async
toggleReaction
(
uri
:
URI
,
thread
:
modes
.
CommentThread2
,
comment
:
modes
.
Comment
,
reaction
:
modes
.
CommentReaction
,
token
:
CancellationT
oken
):
Promise
<
void
>
{
return
this
.
_proxy
.
$toggleReaction
(
this
.
_handle
,
thread
.
commentThreadHandle
,
uri
,
comment
,
reaction
);
}
...
...
src/vs/workbench/contrib/experiments/test/electron-browser/experimentalPrompts.test.ts
浏览文件 @
e7a72480
...
...
@@ -7,9 +7,9 @@ import * as assert from 'assert';
import
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
TestInstantiationService
}
from
'
vs/platform/instantiation/test/common/instantiationServiceMock
'
;
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
INotificationService
,
IPromptChoice
,
Severity
}
from
'
vs/platform/notification/common/notification
'
;
import
{
INotificationService
,
IPromptChoice
,
Severity
,
IPromptOptions
}
from
'
vs/platform/notification/common/notification
'
;
import
{
TestNotificationService
}
from
'
vs/platform/notification/test/common/testNotificationService
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
NullTelemetryService
}
from
'
vs/platform/telemetry/common/telemetryUtils
'
;
import
{
ExperimentalPrompts
}
from
'
vs/workbench/contrib/experiments/electron-browser/experimentalPrompt
'
;
...
...
@@ -59,11 +59,11 @@ suite('Experimental Prompts', () => {
setup
(()
=>
{
storageData
=
{};
instantiationService
.
stub
(
IStorageService
,
{
get
:
(
a
,
b
,
c
)
=>
a
===
'
experiments.experiment1
'
?
JSON
.
stringify
(
storageData
)
:
c
,
instantiationService
.
stub
(
IStorageService
,
<
Partial
<
IStorageService
>>
{
get
:
(
a
:
string
,
b
:
StorageScope
,
c
?:
string
)
=>
a
===
'
experiments.experiment1
'
?
JSON
.
stringify
(
storageData
)
:
c
,
store
:
(
a
,
b
,
c
)
=>
{
if
(
a
===
'
experiments.experiment1
'
)
{
storageData
=
JSON
.
parse
(
b
);
storageData
=
JSON
.
parse
(
b
+
''
);
}
}
});
...
...
@@ -91,7 +91,7 @@ suite('Experimental Prompts', () => {
};
instantiationService
.
stub
(
INotificationService
,
{
prompt
:
(
a
:
Severity
,
b
:
string
,
c
:
IPromptChoice
[],
options
)
=>
{
prompt
:
(
a
:
Severity
,
b
:
string
,
c
:
IPromptChoice
[],
options
:
IPromptOptions
)
=>
{
assert
.
equal
(
b
,
promptText
);
assert
.
equal
(
c
.
length
,
2
);
c
[
0
].
run
();
...
...
@@ -116,7 +116,7 @@ suite('Experimental Prompts', () => {
};
instantiationService
.
stub
(
INotificationService
,
{
prompt
:
(
a
:
Severity
,
b
:
string
,
c
:
IPromptChoice
[]
,
options
)
=>
{
prompt
:
(
a
:
Severity
,
b
:
string
,
c
:
IPromptChoice
[])
=>
{
assert
.
equal
(
b
,
promptText
);
assert
.
equal
(
c
.
length
,
2
);
c
[
1
].
run
();
...
...
@@ -141,10 +141,10 @@ suite('Experimental Prompts', () => {
};
instantiationService
.
stub
(
INotificationService
,
{
prompt
:
(
a
:
Severity
,
b
:
string
,
c
:
IPromptChoice
[],
options
)
=>
{
prompt
:
(
a
:
Severity
,
b
:
string
,
c
:
IPromptChoice
[],
options
:
IPromptOptions
)
=>
{
assert
.
equal
(
b
,
promptText
);
assert
.
equal
(
c
.
length
,
2
);
options
.
onCancel
();
options
.
onCancel
!
();
return
undefined
!
;
}
});
...
...
src/vs/workbench/contrib/extensions/electron-browser/extensionsViews.ts
浏览文件 @
e7a72480
...
...
@@ -161,12 +161,14 @@ export class ExtensionsListView extends ViewletPanel {
case
'
name
'
:
options
=
assign
(
options
,
{
sortBy
:
SortBy
.
Title
});
break
;
}
const
successCallback
=
model
=>
{
const
successCallback
=
(
model
:
IPagedModel
<
IExtension
>
)
=>
{
this
.
queryRequest
=
null
;
this
.
setModel
(
model
);
return
model
;
};
const
errorCallback
=
e
=>
{
const
errorCallback
=
(
e
:
Error
)
=>
{
const
model
=
new
PagedModel
([]);
if
(
!
isPromiseCanceledError
(
e
))
{
this
.
queryRequest
=
null
;
...
...
@@ -531,7 +533,7 @@ export class ExtensionsListView extends ViewletPanel {
return
Promise
.
all
([
othersPromise
,
workspacePromise
])
.
then
(([
others
,
workspaceRecommendations
])
=>
{
fileBasedRecommendations
=
fileBasedRecommendations
.
filter
(
x
=>
workspaceRecommendations
.
every
(({
extensionId
})
=>
x
.
extensionId
!==
extensionId
));
others
=
others
.
filter
(
x
=>
x
=>
workspaceRecommendations
.
every
(({
extensionId
})
=>
x
.
extensionId
!==
extensionId
));
others
=
others
.
filter
(
x
=>
workspaceRecommendations
.
every
(({
extensionId
})
=>
x
.
extensionId
!==
extensionId
));
const
names
=
this
.
getTrimmedRecommendations
(
local
,
value
,
fileBasedRecommendations
,
others
,
[]);
const
recommendationsWithReason
=
this
.
tipsService
.
getAllRecommendationsWithReason
();
...
...
src/vs/workbench/contrib/stats/node/workspaceStats.ts
浏览文件 @
e7a72480
...
...
@@ -7,7 +7,7 @@ import { localize } from 'vs/nls';
import
*
as
crypto
from
'
crypto
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
IFileService
,
IFileStat
,
IResolveFileResult
}
from
'
vs/platform/files/common/files
'
;
import
{
IFileService
,
IFileStat
,
IResolveFileResult
,
IContent
}
from
'
vs/platform/files/common/files
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IWorkspaceContextService
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
...
...
@@ -431,7 +431,7 @@ export class WorkspaceStats implements IWorkbenchContribution {
tags
[
'
workspace.android.cpp
'
]
=
true
;
}
function
getFilePromises
(
filename
,
fileService
,
contentHandler
):
Promise
<
void
>
[]
{
function
getFilePromises
(
filename
:
string
,
fileService
:
IFileService
,
contentHandler
:
(
content
:
IContent
)
=>
void
):
Promise
<
void
>
[]
{
return
!
nameSet
.
has
(
filename
)
?
[]
:
(
folders
as
URI
[]).
map
(
workspaceUri
=>
{
const
uri
=
workspaceUri
.
with
({
path
:
`
${
workspaceUri
.
path
!==
'
/
'
?
workspaceUri
.
path
:
''
}
/
${
filename
}
`
});
return
fileService
.
resolveFile
(
uri
).
then
(()
=>
{
...
...
src/vs/workbench/contrib/tasks/common/tasks.ts
浏览文件 @
e7a72480
...
...
@@ -341,7 +341,7 @@ export interface TaskSourceConfigElement {
}
interface
BaseTaskSource
{
readonly
kind
;
readonly
kind
:
string
;
readonly
label
:
string
;
}
...
...
@@ -467,7 +467,7 @@ export abstract class CommonTask {
*/
_label
:
string
;
type
;
type
?:
string
;
runOptions
:
RunOptions
;
...
...
@@ -477,7 +477,7 @@ export abstract class CommonTask {
private
_taskLoadMessages
:
string
[]
|
undefined
;
protected
constructor
(
id
:
string
,
label
:
string
|
undefined
,
type
,
runOptions
:
RunOptions
,
protected
constructor
(
id
:
string
,
label
:
string
|
undefined
,
type
:
string
|
undefined
,
runOptions
:
RunOptions
,
configurationProperties
:
ConfigurationProperties
,
source
:
BaseTaskSource
)
{
this
.
_id
=
id
;
if
(
label
)
{
...
...
@@ -575,7 +575,7 @@ export class CustomTask extends CommonTask {
*/
command
:
CommandConfiguration
;
public
constructor
(
id
:
string
,
source
:
WorkspaceTaskSource
,
label
:
string
,
type
,
command
:
CommandConfiguration
|
undefined
,
public
constructor
(
id
:
string
,
source
:
WorkspaceTaskSource
,
label
:
string
,
type
:
string
,
command
:
CommandConfiguration
|
undefined
,
hasDefinedMatchers
:
boolean
,
runOptions
:
RunOptions
,
configurationProperties
:
ConfigurationProperties
)
{
super
(
id
,
label
,
undefined
,
runOptions
,
configurationProperties
,
source
);
this
.
_source
=
source
;
...
...
@@ -677,7 +677,7 @@ export class ConfiguringTask extends CommonTask {
configures
:
KeyedTaskIdentifier
;
public
constructor
(
id
:
string
,
source
:
WorkspaceTaskSource
,
label
:
string
|
undefined
,
type
,
public
constructor
(
id
:
string
,
source
:
WorkspaceTaskSource
,
label
:
string
|
undefined
,
type
:
string
|
undefined
,
configures
:
KeyedTaskIdentifier
,
runOptions
:
RunOptions
,
configurationProperties
:
ConfigurationProperties
)
{
super
(
id
,
label
,
type
,
runOptions
,
configurationProperties
,
source
);
this
.
_source
=
source
;
...
...
@@ -710,7 +710,7 @@ export class ContributedTask extends CommonTask {
*/
command
:
CommandConfiguration
;
public
constructor
(
id
:
string
,
source
:
ExtensionTaskSource
,
label
:
string
,
type
,
defines
:
KeyedTaskIdentifier
,
public
constructor
(
id
:
string
,
source
:
ExtensionTaskSource
,
label
:
string
,
type
:
string
|
undefined
,
defines
:
KeyedTaskIdentifier
,
command
:
CommandConfiguration
,
hasDefinedMatchers
:
boolean
,
runOptions
:
RunOptions
,
configurationProperties
:
ConfigurationProperties
)
{
super
(
id
,
label
,
type
,
runOptions
,
configurationProperties
,
source
);
...
...
@@ -770,7 +770,7 @@ export class InMemoryTask extends CommonTask {
type
:
'
inMemory
'
;
public
constructor
(
id
:
string
,
source
:
InMemoryTaskSource
,
label
:
string
,
type
,
public
constructor
(
id
:
string
,
source
:
InMemoryTaskSource
,
label
:
string
,
type
:
string
,
runOptions
:
RunOptions
,
configurationProperties
:
ConfigurationProperties
)
{
super
(
id
,
label
,
type
,
runOptions
,
configurationProperties
,
source
);
this
.
_source
=
source
;
...
...
src/vs/workbench/services/preferences/common/preferencesModels.ts
浏览文件 @
e7a72480
...
...
@@ -959,7 +959,7 @@ class SettingsContentBuilder {
}
private
pushSettingDescription
(
setting
:
ISetting
,
indent
:
string
):
void
{
const
fixSettingLink
=
line
=>
line
.
replace
(
/`#
(
.*
)
#`/g
,
(
match
,
settingName
)
=>
`
\`
${
settingName
}
\`
`
);
const
fixSettingLink
=
(
line
:
string
)
=>
line
.
replace
(
/`#
(
.*
)
#`/g
,
(
match
,
settingName
)
=>
`
\`
${
settingName
}
\`
`
);
setting
.
descriptionRanges
=
[];
const
descriptionPreValue
=
indent
+
'
//
'
;
...
...
@@ -1050,33 +1050,33 @@ export function createValidator(prop: IConfigurationPropertySchema): (value: any
const
numericValidations
:
Validator
<
number
>
[]
=
isNumeric
?
[
{
enabled
:
exclusiveMax
!==
undefined
&&
(
prop
.
maximum
===
undefined
||
exclusiveMax
<=
prop
.
maximum
),
isValid
:
(
value
=>
value
<
exclusiveMax
!
),
isValid
:
(
(
value
:
number
)
=>
value
<
exclusiveMax
!
),
message
:
nls
.
localize
(
'
validations.exclusiveMax
'
,
"
Value must be strictly less than {0}.
"
,
exclusiveMax
)
},
{
enabled
:
exclusiveMin
!==
undefined
&&
(
prop
.
minimum
===
undefined
||
exclusiveMin
>=
prop
.
minimum
),
isValid
:
(
value
=>
value
>
exclusiveMin
!
),
isValid
:
(
(
value
:
number
)
=>
value
>
exclusiveMin
!
),
message
:
nls
.
localize
(
'
validations.exclusiveMin
'
,
"
Value must be strictly greater than {0}.
"
,
exclusiveMin
)
},
{
enabled
:
prop
.
maximum
!==
undefined
&&
(
exclusiveMax
===
undefined
||
exclusiveMax
>
prop
.
maximum
),
isValid
:
(
value
=>
value
<=
prop
.
maximum
!
),
isValid
:
(
(
value
:
number
)
=>
value
<=
prop
.
maximum
!
),
message
:
nls
.
localize
(
'
validations.max
'
,
"
Value must be less than or equal to {0}.
"
,
prop
.
maximum
)
},
{
enabled
:
prop
.
minimum
!==
undefined
&&
(
exclusiveMin
===
undefined
||
exclusiveMin
<
prop
.
minimum
),
isValid
:
(
value
=>
value
>=
prop
.
minimum
!
),
isValid
:
(
(
value
:
number
)
=>
value
>=
prop
.
minimum
!
),
message
:
nls
.
localize
(
'
validations.min
'
,
"
Value must be greater than or equal to {0}.
"
,
prop
.
minimum
)
},
{
enabled
:
prop
.
multipleOf
!==
undefined
,
isValid
:
(
value
=>
value
%
prop
.
multipleOf
!
===
0
),
isValid
:
(
(
value
:
number
)
=>
value
%
prop
.
multipleOf
!
===
0
),
message
:
nls
.
localize
(
'
validations.multipleOf
'
,
"
Value must be a multiple of {0}.
"
,
prop
.
multipleOf
)
},
{
enabled
:
isIntegral
,
isValid
:
(
value
=>
value
%
1
===
0
),
isValid
:
(
(
value
:
number
)
=>
value
%
1
===
0
),
message
:
nls
.
localize
(
'
validations.expectedInteger
'
,
"
Value must be an integer.
"
)
},
].
filter
(
validation
=>
validation
.
enabled
)
:
[];
...
...
@@ -1084,17 +1084,17 @@ export function createValidator(prop: IConfigurationPropertySchema): (value: any
const
stringValidations
:
Validator
<
string
>
[]
=
[
{
enabled
:
prop
.
maxLength
!==
undefined
,
isValid
:
(
value
=>
value
.
length
<=
prop
.
maxLength
!
),
isValid
:
(
(
value
:
{
length
:
number
;
})
=>
value
.
length
<=
prop
.
maxLength
!
),
message
:
nls
.
localize
(
'
validations.maxLength
'
,
"
Value must be {0} or fewer characters long.
"
,
prop
.
maxLength
)
},
{
enabled
:
prop
.
minLength
!==
undefined
,
isValid
:
(
value
=>
value
.
length
>=
prop
.
minLength
!
),
isValid
:
(
(
value
:
{
length
:
number
;
})
=>
value
.
length
>=
prop
.
minLength
!
),
message
:
nls
.
localize
(
'
validations.minLength
'
,
"
Value must be {0} or more characters long.
"
,
prop
.
minLength
)
},
{
enabled
:
patternRegex
!==
undefined
,
isValid
:
(
value
=>
patternRegex
!
.
test
(
value
)),
isValid
:
(
(
value
:
string
)
=>
patternRegex
!
.
test
(
value
)),
message
:
prop
.
patternErrorMessage
||
nls
.
localize
(
'
validations.regex
'
,
"
Value must match regex `{0}`.
"
,
prop
.
pattern
)
},
].
filter
(
validation
=>
validation
.
enabled
);
...
...
src/vs/workbench/services/preferences/test/common/preferencesModel.test.ts
浏览文件 @
e7a72480
...
...
@@ -16,15 +16,15 @@ suite('Preferences Model test', () => {
this
.
validator
=
createValidator
(
settings
)
!
;
}
public
accepts
(
input
)
{
public
accepts
(
input
:
string
)
{
assert
.
equal
(
this
.
validator
(
input
),
''
,
`Expected
${
JSON
.
stringify
(
this
.
settings
)}
to accept
\`
${
input
}
\`
. Got
${
this
.
validator
(
input
)}
.`
);
}
public
rejects
(
input
)
{
public
rejects
(
input
:
string
)
{
assert
.
notEqual
(
this
.
validator
(
input
),
''
,
`Expected
${
JSON
.
stringify
(
this
.
settings
)}
to reject
\`
${
input
}
\`
.`
);
return
{
withMessage
:
(
message
)
=>
{
(
message
:
string
)
=>
{
const
actual
=
this
.
validator
(
input
);
assert
.
ok
(
actual
);
assert
(
actual
!
.
indexOf
(
message
)
>
-
1
,
...
...
src/vs/workbench/test/electron-browser/api/extHostMessagerService.test.ts
浏览文件 @
e7a72480
...
...
@@ -90,7 +90,7 @@ suite('ExtHostMessageService', function () {
suite
(
'
modal
'
,
()
=>
{
test
(
'
calls dialog service
'
,
async
()
=>
{
const
service
=
new
MainThreadMessageService
(
null
!
,
emptyNotificationService
,
emptyCommandService
,
new
class
extends
mock
<
IDialogService
>
()
{
show
(
severity
,
message
,
buttons
)
{
show
(
severity
:
Severity
,
message
:
string
,
buttons
:
string
[]
)
{
assert
.
equal
(
severity
,
1
);
assert
.
equal
(
message
,
'
h
'
);
assert
.
equal
(
buttons
.
length
,
2
);
...
...
@@ -105,7 +105,7 @@ suite('ExtHostMessageService', function () {
test
(
'
returns undefined when cancelled
'
,
async
()
=>
{
const
service
=
new
MainThreadMessageService
(
null
!
,
emptyNotificationService
,
emptyCommandService
,
new
class
extends
mock
<
IDialogService
>
()
{
show
(
severity
,
message
,
buttons
)
{
show
()
{
return
Promise
.
resolve
(
1
);
}
}
as
IDialogService
);
...
...
@@ -116,7 +116,7 @@ suite('ExtHostMessageService', function () {
test
(
'
hides Cancel button when not needed
'
,
async
()
=>
{
const
service
=
new
MainThreadMessageService
(
null
!
,
emptyNotificationService
,
emptyCommandService
,
new
class
extends
mock
<
IDialogService
>
()
{
show
(
severity
,
message
,
buttons
)
{
show
(
severity
:
Severity
,
message
:
string
,
buttons
:
string
[]
)
{
assert
.
equal
(
buttons
.
length
,
1
);
return
Promise
.
resolve
(
0
);
}
...
...
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
浏览文件 @
e7a72480
...
...
@@ -43,7 +43,9 @@ suite('ExtHostTreeView', function () {
let
target
:
RecordingShape
;
let
onDidChangeTreeNode
:
Emitter
<
{
key
:
string
}
|
undefined
>
;
let
onDidChangeTreeNodeWithId
:
Emitter
<
{
key
:
string
}
>
;
let
tree
,
labels
,
nodes
;
let
tree
:
object
;
let
labels
:
object
;
let
nodes
:
object
;
setup
(()
=>
{
tree
=
{
...
...
@@ -582,7 +584,7 @@ suite('ExtHostTreeView', function () {
});
});
function
loadCompleteTree
(
treeId
,
element
?:
string
)
{
function
loadCompleteTree
(
treeId
:
string
,
element
?:
string
):
Promise
<
null
>
{
return
testObject
.
$getChildren
(
treeId
,
element
)
.
then
(
elements
=>
elements
.
map
(
e
=>
loadCompleteTree
(
treeId
,
e
.
handle
)))
.
then
(()
=>
null
);
...
...
@@ -661,7 +663,7 @@ suite('ExtHostTreeView', function () {
};
}
function
getTreeElement
(
element
):
any
{
function
getTreeElement
(
element
:
string
):
any
{
let
parent
=
tree
;
for
(
let
i
=
0
;
i
<
element
.
length
;
i
++
)
{
parent
=
parent
[
element
.
substring
(
0
,
i
+
1
)];
...
...
src/vs/workbench/test/electron-browser/textsearch.perf.integrationTest.ts
浏览文件 @
e7a72480
...
...
@@ -97,15 +97,15 @@ suite.skip('TextSearch performance (integration)', () => {
telemetryService
.
events
=
[];
resolve
(
resultsFinishedEvent
);
resolve
!
(
resultsFinishedEvent
);
}
catch
(
e
)
{
// Fail the runSearch() promise
error
(
e
);
error
!
(
e
);
}
}
let
resolve
;
let
error
;
let
resolve
:
(
result
:
any
)
=>
void
;
let
error
:
(
error
:
Error
)
=>
void
;
return
new
Promise
((
_resolve
,
_error
)
=>
{
resolve
=
_resolve
;
error
=
_error
;
...
...
@@ -122,7 +122,7 @@ suite.skip('TextSearch performance (integration)', () => {
.
then
(()
=>
{
if
(
testWorkspaceArg
)
{
// Don't measure by default
let
i
=
n
;
return
(
function
iterate
()
{
return
(
function
iterate
()
:
Promise
<
undefined
>
|
undefined
{
if
(
!
i
--
)
{
return
;
}
...
...
@@ -133,11 +133,12 @@ suite.skip('TextSearch performance (integration)', () => {
finishedEvents
.
push
(
resultsFinishedEvent
);
return
iterate
();
});
})().
then
(()
=>
{
})()
!
.
then
(()
=>
{
const
totalTime
=
finishedEvents
.
reduce
((
sum
,
e
)
=>
sum
+
e
.
data
.
duration
,
0
);
console
.
log
(
`Avg duration:
${
totalTime
/
n
/
1000
}
s`
);
});
}
return
undefined
;
});
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录