Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
ff13b502
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,体验更适合开发者的 AI 搜索 >>
提交
ff13b502
编写于
10月 17, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Strict null checking some more files in base/node
#60565
上级
0338b5b8
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
54 addition
and
40 deletion
+54
-40
src/tsconfig.strictNullChecks.json
src/tsconfig.strictNullChecks.json
+14
-0
src/vs/base/node/console.ts
src/vs/base/node/console.ts
+8
-8
src/vs/base/node/crypto.ts
src/vs/base/node/crypto.ts
+3
-3
src/vs/base/node/encoding.ts
src/vs/base/node/encoding.ts
+1
-1
src/vs/base/node/flow.ts
src/vs/base/node/flow.ts
+5
-5
src/vs/base/node/proxy.ts
src/vs/base/node/proxy.ts
+3
-3
src/vs/base/node/stats.ts
src/vs/base/node/stats.ts
+1
-1
src/vs/base/node/storage.ts
src/vs/base/node/storage.ts
+14
-14
src/vs/base/node/stream.ts
src/vs/base/node/stream.ts
+5
-5
未找到文件。
src/tsconfig.strictNullChecks.json
浏览文件 @
ff13b502
...
...
@@ -43,11 +43,18 @@
"./vs/base/browser/ui/splitview/splitview.ts"
,
"./vs/base/browser/ui/tree/tree.ts"
,
"./vs/base/browser/ui/widget.ts"
,
"./vs/base/node/console.ts"
,
"./vs/base/node/crypto.ts"
,
"./vs/base/node/decoder.ts"
,
"./vs/base/node/flow.ts"
,
"./vs/base/node/id.ts"
,
"./vs/base/node/paths.ts"
,
"./vs/base/node/ports.ts"
,
"./vs/base/node/proxy.ts"
,
"./vs/base/node/request.ts"
,
"./vs/base/node/stats.ts"
,
"./vs/base/node/storage.ts"
,
"./vs/base/node/stream.ts"
,
"./vs/base/parts/contextmenu/common/contextmenu.ts"
,
"./vs/base/parts/contextmenu/electron-browser/contextmenu.ts"
,
"./vs/base/parts/contextmenu/electron-main/contextmenu.ts"
,
...
...
@@ -398,6 +405,7 @@
"./vs/vscode.d.ts"
,
"./vs/vscode.proposed.d.ts"
,
"./vs/workbench/api/shared/tasks.ts"
,
"./vs/workbench/browser/actions/toggleTabsVisibility.ts"
,
"./vs/workbench/browser/part.ts"
,
"./vs/workbench/browser/parts/quickinput/quickInputUtils.ts"
,
"./vs/workbench/browser/parts/quickopen/quickopen.ts"
,
...
...
@@ -419,6 +427,10 @@
"./vs/workbench/parts/codeEditor/electron-browser/accessibility.ts"
,
"./vs/workbench/parts/codeEditor/electron-browser/largeFileOptimizations.ts"
,
"./vs/workbench/parts/codeEditor/electron-browser/selectionClipboard.ts"
,
"./vs/workbench/parts/codeEditor/electron-browser/toggleMinimap.ts"
,
"./vs/workbench/parts/codeEditor/electron-browser/toggleMultiCursorModifier.ts"
,
"./vs/workbench/parts/codeEditor/electron-browser/toggleRenderControlCharacter.ts"
,
"./vs/workbench/parts/codeEditor/electron-browser/toggleRenderWhitespace.ts"
,
"./vs/workbench/parts/codeEditor/electron-browser/toggleWordWrap.ts"
,
"./vs/workbench/parts/comments/common/commentModel.ts"
,
"./vs/workbench/parts/comments/electron-browser/commentGlyphWidget.ts"
,
...
...
@@ -428,6 +440,7 @@
"./vs/workbench/parts/extensions/common/extensionQuery.ts"
,
"./vs/workbench/parts/extensions/common/extensions.ts"
,
"./vs/workbench/parts/extensions/common/extensionsFileTemplate.ts"
,
"./vs/workbench/parts/extensions/electron-browser/extensionsUtils.ts"
,
"./vs/workbench/parts/logs/common/logConstants.ts"
,
"./vs/workbench/parts/markers/electron-browser/constants.ts"
,
"./vs/workbench/parts/markers/electron-browser/markers.ts"
,
...
...
@@ -450,6 +463,7 @@
"./vs/workbench/parts/terminal/common/terminalMenu.ts"
,
"./vs/workbench/parts/terminal/node/terminalCommandTracker.ts"
,
"./vs/workbench/parts/terminal/node/terminalEnvironment.ts"
,
"./vs/workbench/parts/url/electron-browser/url.contribution.ts"
,
"./vs/workbench/parts/webview/electron-browser/webviewProtocols.ts"
,
"./vs/workbench/parts/welcome/gettingStarted/electron-browser/gettingStarted.ts"
,
"./vs/workbench/parts/welcome/page/electron-browser/vs_code_welcome_page.ts"
,
...
...
src/vs/base/node/console.ts
浏览文件 @
ff13b502
...
...
@@ -29,7 +29,7 @@ export function isRemoteConsoleLog(obj: any): obj is IRemoteConsoleLog {
export
function
parse
(
entry
:
IRemoteConsoleLog
):
{
args
:
any
[],
stack
?:
string
}
{
const
args
:
any
[]
=
[];
let
stack
:
string
;
let
stack
:
string
|
undefined
;
// Parse Entry
try
{
...
...
@@ -50,11 +50,11 @@ export function parse(entry: IRemoteConsoleLog): { args: any[], stack?: string }
return
{
args
,
stack
};
}
export
function
getFirstFrame
(
entry
:
IRemoteConsoleLog
):
IStackFrame
;
export
function
getFirstFrame
(
stack
:
string
):
IStackFrame
;
export
function
getFirstFrame
(
arg0
:
IRemoteConsoleLog
|
string
):
IStackFrame
{
export
function
getFirstFrame
(
entry
:
IRemoteConsoleLog
):
IStackFrame
|
undefined
;
export
function
getFirstFrame
(
stack
:
string
|
undefined
):
IStackFrame
|
undefined
;
export
function
getFirstFrame
(
arg0
:
IRemoteConsoleLog
|
string
|
undefined
):
IStackFrame
|
undefined
{
if
(
typeof
arg0
!==
'
string
'
)
{
return
getFirstFrame
(
parse
(
arg0
).
stack
);
return
getFirstFrame
(
parse
(
arg0
!
).
stack
);
}
// Parse a source information out of the stack if we have one. Format can be:
...
...
@@ -73,7 +73,7 @@ export function getFirstFrame(arg0: IRemoteConsoleLog | string): IStackFrame {
// (?:(?:[a-zA-Z]+:)|(?:[\/])|(?:\\\\) => windows drive letter OR unix root OR unc root
// (?:.+) => simple pattern for the path, only works because of the line/col pattern after
// :(?:\d+):(?:\d+) => :line:column data
const
matches
=
/at
[^\/]
*
((?:(?:[
a-zA-Z
]
+:
)
|
(?:[\/])
|
(?:\\\\))(?:
.+
))
:
(\d
+
)
:
(\d
+
)
/
.
exec
(
topFrame
);
const
matches
=
/at
[^\/]
*
((?:(?:[
a-zA-Z
]
+:
)
|
(?:[\/])
|
(?:\\\\))(?:
.+
))
:
(\d
+
)
:
(\d
+
)
/
.
exec
(
topFrame
||
''
);
if
(
matches
&&
matches
.
length
===
4
)
{
return
{
uri
:
URI
.
file
(
matches
[
1
]),
...
...
@@ -86,7 +86,7 @@ export function getFirstFrame(arg0: IRemoteConsoleLog | string): IStackFrame {
return
void
0
;
}
function
findFirstFrame
(
stack
:
string
):
string
{
function
findFirstFrame
(
stack
:
string
|
undefined
):
string
|
undefined
{
if
(
!
stack
)
{
return
stack
;
}
...
...
@@ -109,7 +109,7 @@ export function log(entry: IRemoteConsoleLog, label: string): void {
topFrame
=
`(
${
topFrame
.
trim
()}
)`
;
}
let
consoleArgs
=
[];
let
consoleArgs
:
string
[]
=
[];
// First arg is a string
if
(
typeof
args
[
0
]
===
'
string
'
)
{
...
...
src/vs/base/node/crypto.ts
浏览文件 @
ff13b502
...
...
@@ -10,7 +10,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
import
{
once
}
from
'
vs/base/common/functional
'
;
export
function
checksum
(
path
:
string
,
sha1hash
:
string
):
TPromise
<
void
>
{
const
promise
=
new
TPromise
<
string
>
((
c
,
e
)
=>
{
const
promise
=
new
TPromise
<
string
|
undefined
>
((
c
,
e
)
=>
{
const
input
=
fs
.
createReadStream
(
path
);
const
hash
=
crypto
.
createHash
(
'
sha1
'
);
const
hashStream
=
hash
as
any
as
stream
.
PassThrough
;
...
...
@@ -30,7 +30,7 @@ export function checksum(path: string, sha1hash: string): TPromise<void> {
input
.
once
(
'
error
'
,
done
);
input
.
once
(
'
end
'
,
done
);
hashStream
.
once
(
'
error
'
,
done
);
hashStream
.
once
(
'
data
'
,
(
data
:
Buffer
)
=>
done
(
null
,
data
.
toString
(
'
hex
'
)));
hashStream
.
once
(
'
data
'
,
(
data
:
Buffer
)
=>
done
(
undefined
,
data
.
toString
(
'
hex
'
)));
});
return
promise
.
then
(
hash
=>
{
...
...
@@ -38,6 +38,6 @@ export function checksum(path: string, sha1hash: string): TPromise<void> {
return
TPromise
.
wrapError
<
void
>
(
new
Error
(
'
Hash mismatch
'
));
}
return
TPromise
.
as
(
null
);
return
TPromise
.
as
(
void
0
);
});
}
\ No newline at end of file
src/vs/base/node/encoding.ts
浏览文件 @
ff13b502
...
...
@@ -142,7 +142,7 @@ function toNodeEncoding(enc: string): string {
return
enc
;
}
export
function
detectEncodingByBOMFromBuffer
(
buffer
:
Buffer
,
bytesRead
:
number
):
string
{
export
function
detectEncodingByBOMFromBuffer
(
buffer
:
Buffer
,
bytesRead
:
number
):
string
|
null
{
if
(
!
buffer
||
bytesRead
<
2
)
{
return
null
;
}
...
...
src/vs/base/node/flow.ts
浏览文件 @
ff13b502
...
...
@@ -9,9 +9,9 @@ import * as assert from 'assert';
* Executes the given function (fn) over the given array of items (list) in parallel and returns the resulting errors and results as
* array to the callback (callback). The resulting errors and results are evaluated by calling the provided callback function.
*/
export
function
parallel
<
T
,
E
>
(
list
:
T
[],
fn
:
(
item
:
T
,
callback
:
(
err
:
Error
,
result
:
E
)
=>
void
)
=>
void
,
callback
:
(
err
:
Error
[]
,
result
:
E
[])
=>
void
):
void
{
export
function
parallel
<
T
,
E
>
(
list
:
T
[],
fn
:
(
item
:
T
,
callback
:
(
err
:
Error
,
result
:
E
)
=>
void
)
=>
void
,
callback
:
(
err
:
Array
<
Error
|
null
>
|
null
,
result
:
E
[])
=>
void
):
void
{
let
results
=
new
Array
(
list
.
length
);
let
errors
=
new
Array
<
Error
>
(
list
.
length
);
let
errors
=
new
Array
<
Error
|
null
>
(
list
.
length
);
let
didErrorOccur
=
false
;
let
doneCount
=
0
;
...
...
@@ -42,9 +42,9 @@ export function parallel<T, E>(list: T[], fn: (item: T, callback: (err: Error, r
* array to the callback (callback). The resulting errors and results are evaluated by calling the provided callback function. The first param can
* either be a function that returns an array of results to loop in async fashion or be an array of items already.
*/
export
function
loop
<
T
,
E
>
(
param
:
(
callback
:
(
error
:
Error
,
result
:
T
[])
=>
void
)
=>
void
,
fn
:
(
item
:
T
,
callback
:
(
error
:
Error
,
result
:
E
)
=>
void
,
index
:
number
,
total
:
number
)
=>
void
,
callback
:
(
error
:
Error
,
result
:
E
[]
)
=>
void
):
void
;
export
function
loop
<
T
,
E
>
(
param
:
T
[],
fn
:
(
item
:
T
,
callback
:
(
error
:
Error
,
result
:
E
)
=>
void
,
index
:
number
,
total
:
number
)
=>
void
,
callback
:
(
error
:
Error
,
result
:
E
[]
)
=>
void
):
void
;
export
function
loop
<
E
>
(
param
:
any
,
fn
:
(
item
:
any
,
callback
:
(
error
:
Error
,
result
:
E
)
=>
void
,
index
:
number
,
total
:
number
)
=>
void
,
callback
:
(
error
:
Error
,
result
:
E
[]
)
=>
void
):
void
{
export
function
loop
<
T
,
E
>
(
param
:
(
callback
:
(
error
:
Error
,
result
:
T
[])
=>
void
)
=>
void
,
fn
:
(
item
:
T
,
callback
:
(
error
:
Error
|
null
,
result
:
E
|
null
)
=>
void
,
index
:
number
,
total
:
number
)
=>
void
,
callback
:
(
error
:
Error
|
null
,
result
:
E
[]
|
null
)
=>
void
):
void
;
export
function
loop
<
T
,
E
>
(
param
:
T
[],
fn
:
(
item
:
T
,
callback
:
(
error
:
Error
|
null
,
result
:
E
|
null
)
=>
void
,
index
:
number
,
total
:
number
)
=>
void
,
callback
:
(
error
:
Error
|
null
,
result
:
E
[]
|
null
)
=>
void
):
void
;
export
function
loop
<
E
>
(
param
:
any
,
fn
:
(
item
:
any
,
callback
:
(
error
:
Error
|
null
,
result
:
E
|
null
)
=>
void
,
index
:
number
,
total
:
number
)
=>
void
,
callback
:
(
error
:
Error
|
null
,
result
:
E
[]
|
null
)
=>
void
):
void
{
// Assert
assert
.
ok
(
param
,
'
Missing first parameter
'
);
...
...
src/vs/base/node/proxy.ts
浏览文件 @
ff13b502
...
...
@@ -7,7 +7,7 @@ import { Url, parse as parseUrl } from 'url';
import
{
isBoolean
}
from
'
vs/base/common/types
'
;
import
{
Agent
}
from
'
./request
'
;
function
getSystemProxyURI
(
requestURL
:
Url
):
string
{
function
getSystemProxyURI
(
requestURL
:
Url
):
string
|
null
{
if
(
requestURL
.
protocol
===
'
http:
'
)
{
return
process
.
env
.
HTTP_PROXY
||
process
.
env
.
http_proxy
||
null
;
}
else
if
(
requestURL
.
protocol
===
'
https:
'
)
{
...
...
@@ -32,12 +32,12 @@ export async function getProxyAgent(rawRequestURL: string, options: IOptions = {
const
proxyEndpoint
=
parseUrl
(
proxyURL
);
if
(
!
/^https
?
:$/
.
test
(
proxyEndpoint
.
protocol
))
{
if
(
!
/^https
?
:$/
.
test
(
proxyEndpoint
.
protocol
||
''
))
{
return
null
;
}
const
opts
=
{
host
:
proxyEndpoint
.
hostname
,
host
:
proxyEndpoint
.
hostname
||
''
,
port
:
Number
(
proxyEndpoint
.
port
),
auth
:
proxyEndpoint
.
auth
,
rejectUnauthorized
:
isBoolean
(
options
.
strictSSL
)
?
options
.
strictSSL
:
true
...
...
src/vs/base/node/stats.ts
浏览文件 @
ff13b502
...
...
@@ -93,7 +93,7 @@ export function collectWorkspaceStats(folder: string, filter: string[]): Promise
const
MAX_FILES
=
20000
;
function
walk
(
dir
:
string
,
filter
:
string
[],
token
,
done
:
(
allFiles
:
string
[])
=>
void
):
void
{
let
results
=
[];
let
results
:
string
[]
=
[];
readdir
(
dir
,
async
(
err
,
files
)
=>
{
// Ignore folders that can't be read
if
(
err
)
{
...
...
src/vs/base/node/storage.ts
浏览文件 @
ff13b502
...
...
@@ -84,7 +84,7 @@ export class Storage extends Disposable {
return
value
;
}
getBoolean
(
key
:
string
,
fallbackValue
?:
boolean
):
boolean
{
getBoolean
(
key
:
string
,
fallbackValue
:
boolean
=
false
):
boolean
{
const
value
=
this
.
get
(
key
);
if
(
isUndefinedOrNull
(
value
))
{
...
...
@@ -94,7 +94,7 @@ export class Storage extends Disposable {
return
value
===
'
true
'
;
}
getInteger
(
key
:
string
,
fallbackValue
?:
number
):
number
{
getInteger
(
key
:
string
,
fallbackValue
:
number
=
0
):
number
{
const
value
=
this
.
get
(
key
);
if
(
isUndefinedOrNull
(
value
))
{
...
...
@@ -269,7 +269,7 @@ export class SQLiteStorageImpl {
return
this
.
transaction
(
db
,
()
=>
{
if
(
request
.
insert
&&
request
.
insert
.
size
>
0
)
{
this
.
prepare
(
db
,
'
INSERT INTO ItemTable VALUES (?,?)
'
,
stmt
=>
{
request
.
insert
.
forEach
((
value
,
key
)
=>
{
request
.
insert
!
.
forEach
((
value
,
key
)
=>
{
stmt
.
run
([
key
,
value
]);
});
});
...
...
@@ -277,7 +277,7 @@ export class SQLiteStorageImpl {
if
(
request
.
delete
&&
request
.
delete
.
size
)
{
this
.
prepare
(
db
,
'
DELETE FROM ItemTable WHERE key=?
'
,
stmt
=>
{
request
.
delete
.
forEach
(
key
=>
{
request
.
delete
!
.
forEach
(
key
=>
{
stmt
.
run
(
key
);
});
});
...
...
@@ -457,35 +457,35 @@ export class SQLiteStorageImpl {
}
class
SQLiteStorageLogger
{
private
logInfo
:
boolean
;
private
logError
:
boolean
;
private
readonly
logInfo
:
boolean
;
private
readonly
logError
:
boolean
;
constructor
(
private
options
?:
IStorageLoggingOptions
)
{
this
.
logInfo
=
this
.
verbose
&&
options
&&
!!
options
.
infoLogger
;
this
.
logError
=
options
&&
!!
options
.
errorLogger
;
constructor
(
private
readonly
options
?:
IStorageLoggingOptions
)
{
this
.
logInfo
=
!!
(
this
.
verbose
&&
options
&&
options
.
infoLogger
)
;
this
.
logError
=
!!
(
options
&&
options
.
errorLogger
)
;
}
get
verbose
():
boolean
{
return
this
.
options
&&
(
this
.
options
.
info
||
this
.
options
.
trace
||
this
.
options
.
profile
);
return
!!
(
this
.
options
&&
(
this
.
options
.
info
||
this
.
options
.
trace
||
this
.
options
.
profile
)
);
}
get
trace
():
boolean
{
return
this
.
options
&&
this
.
options
.
trace
;
return
!!
(
this
.
options
&&
this
.
options
.
trace
)
;
}
get
profile
():
boolean
{
return
this
.
options
&&
this
.
options
.
profile
;
return
!!
(
this
.
options
&&
this
.
options
.
profile
)
;
}
info
(
msg
:
string
):
void
{
if
(
this
.
logInfo
)
{
this
.
options
.
infoLogger
(
msg
);
this
.
options
!
.
infoLogger
!
(
msg
);
}
}
error
(
error
:
string
|
Error
):
void
{
if
(
this
.
logError
)
{
this
.
options
.
errorLogger
(
error
);
this
.
options
!
.
errorLogger
!
(
error
);
}
}
}
\ No newline at end of file
src/vs/base/node/stream.ts
浏览文件 @
ff13b502
...
...
@@ -6,7 +6,7 @@
import
*
as
fs
from
'
fs
'
;
export
interface
ReadResult
{
buffer
:
Buffer
;
buffer
:
Buffer
|
null
;
bytesRead
:
number
;
}
...
...
@@ -20,7 +20,7 @@ export function readExactlyByFile(file: string, totalBytes: number): Promise<Rea
return
reject
(
err
);
}
function
end
(
err
:
Error
,
resultBuffer
:
Buffer
,
bytesRead
:
number
):
void
{
function
end
(
err
:
Error
|
null
,
resultBuffer
:
Buffer
|
null
,
bytesRead
:
number
):
void
{
fs
.
close
(
fd
,
closeError
=>
{
if
(
closeError
)
{
return
reject
(
closeError
);
...
...
@@ -71,14 +71,14 @@ export function readExactlyByFile(file: string, totalBytes: number): Promise<Rea
* @param maximumBytesToRead The maximum number of bytes to read before giving up.
* @param callback The finished callback.
*/
export
function
readToMatchingString
(
file
:
string
,
matchingString
:
string
,
chunkBytes
:
number
,
maximumBytesToRead
:
number
):
Promise
<
string
>
{
return
new
Promise
<
string
>
((
resolve
,
reject
)
=>
export
function
readToMatchingString
(
file
:
string
,
matchingString
:
string
,
chunkBytes
:
number
,
maximumBytesToRead
:
number
):
Promise
<
string
|
null
>
{
return
new
Promise
<
string
|
null
>
((
resolve
,
reject
)
=>
fs
.
open
(
file
,
'
r
'
,
null
,
(
err
,
fd
)
=>
{
if
(
err
)
{
return
reject
(
err
);
}
function
end
(
err
:
Error
,
result
:
string
):
void
{
function
end
(
err
:
Error
|
null
,
result
:
string
|
null
):
void
{
fs
.
close
(
fd
,
closeError
=>
{
if
(
closeError
)
{
return
reject
(
closeError
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录