Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
7f7df378
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,发现更多精彩内容 >>
提交
7f7df378
编写于
10月 22, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Strict null checks
上级
d79718a9
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
62 addition
and
33 deletion
+62
-33
src/tsconfig.strictNullChecks.json
src/tsconfig.strictNullChecks.json
+4
-1
src/vs/code/electron-main/sharedProcess.ts
src/vs/code/electron-main/sharedProcess.ts
+1
-1
src/vs/editor/contrib/codeAction/codeActionModel.ts
src/vs/editor/contrib/codeAction/codeActionModel.ts
+31
-12
src/vs/editor/contrib/codeAction/lightBulbWidget.ts
src/vs/editor/contrib/codeAction/lightBulbWidget.ts
+8
-5
src/vs/platform/update/electron-main/abstractUpdateService.ts
...vs/platform/update/electron-main/abstractUpdateService.ts
+10
-10
src/vs/platform/url/electron-main/electronUrlListener.ts
src/vs/platform/url/electron-main/electronUrlListener.ts
+5
-1
src/vs/workbench/common/notifications.ts
src/vs/workbench/common/notifications.ts
+3
-3
未找到文件。
src/tsconfig.strictNullChecks.json
浏览文件 @
7f7df378
...
...
@@ -90,7 +90,6 @@
"./vs/code/electron-browser/issue/issueReporterModel.ts"
,
"./vs/code/electron-browser/issue/issueReporterPage.ts"
,
"./vs/code/electron-browser/issue/issueReporterUtil.ts"
,
"./vs/code/electron-browser/processExplorer/processExplorerMain.ts"
,
"./vs/code/electron-main/auth.ts"
,
"./vs/code/electron-main/keyboard.ts"
,
"./vs/code/electron-main/theme.ts"
,
...
...
@@ -257,6 +256,7 @@
"./vs/editor/contrib/caretOperations/transpose.ts"
,
"./vs/editor/contrib/clipboard/clipboard.ts"
,
"./vs/editor/contrib/codeAction/codeAction.ts"
,
"./vs/editor/contrib/codeAction/codeActionModel.ts"
,
"./vs/editor/contrib/codeAction/codeActionTrigger.ts"
,
"./vs/editor/contrib/colorPicker/color.ts"
,
"./vs/editor/contrib/colorPicker/colorDetector.ts"
,
...
...
@@ -445,9 +445,11 @@
"./vs/platform/theme/common/themeService.ts"
,
"./vs/platform/theme/test/common/testThemeService.ts"
,
"./vs/platform/update/common/update.ts"
,
"./vs/platform/update/electron-main/abstractUpdateService.ts"
,
"./vs/platform/update/node/update.config.contribution.ts"
,
"./vs/platform/url/common/url.ts"
,
"./vs/platform/url/common/urlService.ts"
,
"./vs/platform/url/electron-main/electronUrlListener.ts"
,
"./vs/platform/widget/common/contextScopedWidget.ts"
,
"./vs/platform/windows/common/windows.ts"
,
"./vs/platform/windows/electron-browser/windowService.ts"
,
...
...
@@ -524,6 +526,7 @@
"./vs/workbench/parts/surveys/electron-browser/nps.contribution.ts"
,
"./vs/workbench/parts/tasks/common/problemCollectors.ts"
,
"./vs/workbench/parts/tasks/common/problemMatcher.ts"
,
"./vs/workbench/parts/tasks/common/taskService.ts"
,
"./vs/workbench/parts/tasks/common/taskSystem.ts"
,
"./vs/workbench/parts/tasks/common/taskTemplates.ts"
,
"./vs/workbench/parts/tasks/common/tasks.ts"
,
...
...
src/vs/code/electron-main/sharedProcess.ts
浏览文件 @
7f7df378
...
...
@@ -98,7 +98,7 @@ export class SharedProcess implements ISharedProcess {
logLevel
:
this
.
logService
.
getLevel
()
});
ipcMain
.
once
(
'
handshake:im ready
'
,
()
=>
c
(
null
));
ipcMain
.
once
(
'
handshake:im ready
'
,
()
=>
c
(
void
0
));
});
});
}
...
...
src/vs/editor/contrib/codeAction/codeActionModel.ts
浏览文件 @
7f7df378
...
...
@@ -49,8 +49,12 @@ export class CodeActionOracle {
}
private
_onMarkerChanges
(
resources
:
URI
[]):
void
{
const
{
uri
}
=
this
.
_editor
.
getModel
();
if
(
resources
.
some
(
resource
=>
resource
.
toString
()
===
uri
.
toString
()))
{
const
model
=
this
.
_editor
.
getModel
();
if
(
!
model
)
{
return
;
}
if
(
resources
.
some
(
resource
=>
resource
.
toString
()
===
model
.
uri
.
toString
()))
{
this
.
_autoTriggerTimer
.
cancelAndSet
(()
=>
{
this
.
trigger
({
type
:
'
auto
'
});
},
this
.
_delay
);
...
...
@@ -63,8 +67,11 @@ export class CodeActionOracle {
},
this
.
_delay
);
}
private
_getRangeOfMarker
(
selection
:
Selection
):
Range
{
private
_getRangeOfMarker
(
selection
:
Selection
):
Range
|
undefined
{
const
model
=
this
.
_editor
.
getModel
();
if
(
!
model
)
{
return
undefined
;
}
for
(
const
marker
of
this
.
_markerService
.
read
({
resource
:
model
.
uri
}))
{
if
(
Range
.
intersectRanges
(
marker
,
selection
))
{
return
Range
.
lift
(
marker
);
...
...
@@ -76,7 +83,7 @@ export class CodeActionOracle {
private
_getRangeOfSelectionUnlessWhitespaceEnclosed
(
trigger
:
CodeActionTrigger
):
Selection
|
undefined
{
const
model
=
this
.
_editor
.
getModel
();
const
selection
=
this
.
_editor
.
getSelection
();
if
(
selection
.
isEmpty
()
&&
!
(
trigger
.
filter
&&
trigger
.
filter
.
includeSourceActions
))
{
if
(
model
&&
selection
&&
selection
.
isEmpty
()
&&
!
(
trigger
.
filter
&&
trigger
.
filter
.
includeSourceActions
))
{
const
{
lineNumber
,
column
}
=
selection
.
getPosition
();
const
line
=
model
.
getLineContent
(
lineNumber
);
if
(
line
.
length
===
0
)
{
...
...
@@ -99,7 +106,7 @@ export class CodeActionOracle {
}
}
}
return
selection
;
return
selection
?
selection
:
undefined
;
}
private
_createEventAndSignalChange
(
trigger
:
CodeActionTrigger
,
selection
:
Selection
|
undefined
):
Thenable
<
CodeAction
[]
|
undefined
>
{
...
...
@@ -114,6 +121,17 @@ export class CodeActionOracle {
return
Promise
.
resolve
(
undefined
);
}
else
{
const
model
=
this
.
_editor
.
getModel
();
if
(
!
model
)
{
// cancel
this
.
_signalChange
({
trigger
,
rangeOrSelection
:
undefined
,
position
:
undefined
,
actions
:
undefined
,
});
return
Promise
.
resolve
(
undefined
);
}
const
markerRange
=
this
.
_getRangeOfMarker
(
selection
);
const
position
=
markerRange
?
markerRange
.
getStartPosition
()
:
selection
.
getStartPosition
();
const
actions
=
createCancelablePromise
(
token
=>
getCodeActions
(
model
,
selection
,
trigger
,
token
));
...
...
@@ -135,16 +153,16 @@ export class CodeActionOracle {
export
interface
CodeActionsComputeEvent
{
trigger
:
CodeActionTrigger
;
rangeOrSelection
:
Range
|
Selection
;
position
:
Position
;
actions
:
CancelablePromise
<
CodeAction
[]
>
;
rangeOrSelection
:
Range
|
Selection
|
undefined
;
position
:
Position
|
undefined
;
actions
:
CancelablePromise
<
CodeAction
[]
>
|
undefined
;
}
export
class
CodeActionModel
{
private
_editor
:
ICodeEditor
;
private
_markerService
:
IMarkerService
;
private
_codeActionOracle
:
CodeActionOracle
;
private
_codeActionOracle
?
:
CodeActionOracle
;
private
_onDidChangeFixes
=
new
Emitter
<
CodeActionsComputeEvent
>
();
private
_disposables
:
IDisposable
[]
=
[];
private
readonly
_supportedCodeActions
:
IContextKey
<
string
>
;
...
...
@@ -179,12 +197,13 @@ export class CodeActionModel {
this
.
_onDidChangeFixes
.
fire
(
undefined
);
}
if
(
this
.
_editor
.
getModel
()
&&
CodeActionProviderRegistry
.
has
(
this
.
_editor
.
getModel
())
const
model
=
this
.
_editor
.
getModel
();
if
(
model
&&
CodeActionProviderRegistry
.
has
(
model
)
&&
!
this
.
_editor
.
getConfiguration
().
readOnly
)
{
const
supportedActions
:
string
[]
=
[];
for
(
const
provider
of
CodeActionProviderRegistry
.
all
(
this
.
_editor
.
getModel
()
))
{
for
(
const
provider
of
CodeActionProviderRegistry
.
all
(
model
))
{
if
(
Array
.
isArray
(
provider
.
providedCodeActionKinds
))
{
supportedActions
.
push
(...
provider
.
providedCodeActionKinds
);
}
...
...
src/vs/editor/contrib/codeAction/lightBulbWidget.ts
浏览文件 @
7f7df378
...
...
@@ -25,8 +25,8 @@ export class LightBulbWidget implements IDisposable, IContentWidget {
readonly
onClick
:
Event
<
{
x
:
number
,
y
:
number
}
>
=
this
.
_onClick
.
event
;
private
_position
:
IContentWidgetPosition
;
private
_model
:
CodeActionsComputeEvent
;
private
_position
:
IContentWidgetPosition
|
null
;
private
_model
:
CodeActionsComputeEvent
|
null
;
private
_futureFixes
=
new
CancellationTokenSource
();
constructor
(
editor
:
ICodeEditor
)
{
...
...
@@ -40,7 +40,7 @@ export class LightBulbWidget implements IDisposable, IContentWidget {
this
.
_disposables
.
push
(
this
.
_editor
.
onDidChangeModelLanguage
(
_
=>
this
.
_futureFixes
.
cancel
()));
this
.
_disposables
.
push
(
this
.
_editor
.
onDidChangeModelContent
(
_
=>
{
// cancel when the line in question has been removed
if
(
this
.
_model
&&
this
.
model
.
position
.
lineNumber
>=
this
.
_editor
.
getModel
().
getLineCount
(
))
{
if
(
this
.
_model
&&
(
!
this
.
model
.
position
||
this
.
model
.
position
.
lineNumber
>=
this
.
_editor
.
getModel
().
getLineCount
()
))
{
this
.
_futureFixes
.
cancel
();
}
}));
...
...
@@ -96,7 +96,7 @@ export class LightBulbWidget implements IDisposable, IContentWidget {
return
this
.
_domNode
;
}
getPosition
():
IContentWidgetPosition
{
getPosition
():
IContentWidgetPosition
|
null
{
return
this
.
_position
;
}
...
...
@@ -126,7 +126,7 @@ export class LightBulbWidget implements IDisposable, IContentWidget {
}
else
{
this
.
hide
();
}
}).
catch
(
err
=>
{
}).
catch
(
()
=>
{
this
.
hide
();
});
}
...
...
@@ -148,6 +148,9 @@ export class LightBulbWidget implements IDisposable, IContentWidget {
if
(
!
config
.
contribInfo
.
lightbulbEnabled
)
{
return
;
}
if
(
!
this
.
_model
.
position
)
{
return
;
}
const
{
lineNumber
,
column
}
=
this
.
_model
.
position
;
const
model
=
this
.
_editor
.
getModel
();
if
(
!
model
)
{
...
...
src/vs/platform/update/electron-main/abstractUpdateService.ts
浏览文件 @
7f7df378
...
...
@@ -74,12 +74,12 @@ export abstract class AbstractUpdateService implements IUpdateService {
this
.
setState
(
State
.
Idle
(
this
.
getUpdateType
()));
// Start checking for updates after 30 seconds
this
.
scheduleCheckForUpdates
(
30
*
1000
).
then
(
null
,
err
=>
this
.
logService
.
error
(
err
));
this
.
scheduleCheckForUpdates
(
30
*
1000
).
then
(
undefined
,
err
=>
this
.
logService
.
error
(
err
));
}
private
getProductQuality
():
string
{
private
getProductQuality
():
string
|
undefined
{
const
quality
=
this
.
configurationService
.
getValue
<
string
>
(
'
update.channel
'
);
return
quality
===
'
none
'
?
null
:
product
.
quality
;
return
quality
===
'
none
'
?
undefined
:
product
.
quality
;
}
private
scheduleCheckForUpdates
(
delay
=
60
*
60
*
1000
):
Thenable
<
void
>
{
...
...
@@ -95,7 +95,7 @@ export abstract class AbstractUpdateService implements IUpdateService {
this
.
logService
.
trace
(
'
update#checkForUpdates, state =
'
,
this
.
state
.
type
);
if
(
this
.
state
.
type
!==
StateType
.
Idle
)
{
return
TPromise
.
as
(
null
);
return
TPromise
.
as
(
void
0
);
}
return
this
.
throttler
.
queue
(()
=>
TPromise
.
as
(
this
.
doCheckForUpdates
(
context
)));
...
...
@@ -105,35 +105,35 @@ export abstract class AbstractUpdateService implements IUpdateService {
this
.
logService
.
trace
(
'
update#downloadUpdate, state =
'
,
this
.
state
.
type
);
if
(
this
.
state
.
type
!==
StateType
.
AvailableForDownload
)
{
return
TPromise
.
as
(
null
);
return
TPromise
.
as
(
void
0
);
}
return
this
.
doDownloadUpdate
(
this
.
state
);
}
protected
doDownloadUpdate
(
state
:
AvailableForDownload
):
TPromise
<
void
>
{
return
TPromise
.
as
(
null
);
return
TPromise
.
as
(
void
0
);
}
applyUpdate
():
TPromise
<
void
>
{
this
.
logService
.
trace
(
'
update#applyUpdate, state =
'
,
this
.
state
.
type
);
if
(
this
.
state
.
type
!==
StateType
.
Downloaded
)
{
return
TPromise
.
as
(
null
);
return
TPromise
.
as
(
void
0
);
}
return
this
.
doApplyUpdate
();
}
protected
doApplyUpdate
():
TPromise
<
void
>
{
return
TPromise
.
as
(
null
);
return
TPromise
.
as
(
void
0
);
}
quitAndInstall
():
TPromise
<
void
>
{
this
.
logService
.
trace
(
'
update#quitAndInstall, state =
'
,
this
.
state
.
type
);
if
(
this
.
state
.
type
!==
StateType
.
Ready
)
{
return
TPromise
.
as
(
null
);
return
TPromise
.
as
(
void
0
);
}
this
.
logService
.
trace
(
'
update#quitAndInstall(): before lifecycle quit()
'
);
...
...
@@ -148,7 +148,7 @@ export abstract class AbstractUpdateService implements IUpdateService {
this
.
doQuitAndInstall
();
});
return
TPromise
.
as
(
null
);
return
TPromise
.
as
(
void
0
);
}
isLatestVersion
():
TPromise
<
boolean
|
undefined
>
{
...
...
src/vs/platform/url/electron-main/electronUrlListener.ts
浏览文件 @
7f7df378
...
...
@@ -36,7 +36,11 @@ export class ElectronURLListener {
];
const
buffer
=
rawBuffer
.
map
(
uriFromRawUrl
).
filter
(
uri
=>
!!
uri
);
const
flush
=
()
=>
buffer
.
forEach
(
uri
=>
urlService
.
open
(
uri
));
const
flush
=
()
=>
buffer
.
forEach
(
uri
=>
{
if
(
uri
)
{
urlService
.
open
(
uri
);
}
});
app
.
setAsDefaultProtocolClient
(
product
.
urlProtocol
,
process
.
execPath
,
[
'
--open-url
'
,
'
--
'
]);
...
...
src/vs/workbench/common/notifications.ts
浏览文件 @
7f7df378
...
...
@@ -125,7 +125,7 @@ export class NotificationsModel extends Disposable implements INotificationsMode
}
}
private
findNotification
(
item
:
INotificationViewItem
):
INotificationViewItem
{
private
findNotification
(
item
:
INotificationViewItem
):
INotificationViewItem
|
undefined
{
for
(
let
i
=
0
;
i
<
this
.
_notifications
.
length
;
i
++
)
{
const
notification
=
this
.
_notifications
[
i
];
if
(
notification
.
equals
(
item
))
{
...
...
@@ -136,7 +136,7 @@ export class NotificationsModel extends Disposable implements INotificationsMode
return
void
0
;
}
private
createViewItem
(
notification
:
INotification
):
INotificationViewItem
{
private
createViewItem
(
notification
:
INotification
):
INotificationViewItem
|
null
{
const
item
=
NotificationViewItem
.
create
(
notification
);
if
(
!
item
)
{
return
null
;
...
...
@@ -340,7 +340,7 @@ export class NotificationViewItem extends Disposable implements INotificationVie
private
readonly
_onDidLabelChange
:
Emitter
<
INotificationViewItemLabelChangeEvent
>
=
this
.
_register
(
new
Emitter
<
INotificationViewItemLabelChangeEvent
>
());
get
onDidLabelChange
():
Event
<
INotificationViewItemLabelChangeEvent
>
{
return
this
.
_onDidLabelChange
.
event
;
}
static
create
(
notification
:
INotification
):
INotificationViewItem
{
static
create
(
notification
:
INotification
):
INotificationViewItem
|
null
{
if
(
!
notification
||
!
notification
.
message
||
isPromiseCanceledError
(
notification
.
message
))
{
return
null
;
// we need a message to show
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录