Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
b72fede4
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
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,发现更多精彩内容 >>
提交
b72fede4
编写于
10月 15, 2018
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
strict null checks (#60565)
上级
655682c0
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
78 addition
and
56 deletion
+78
-56
src/tsconfig.strictNullChecks.json
src/tsconfig.strictNullChecks.json
+9
-0
src/vs/editor/browser/editorBrowser.ts
src/vs/editor/browser/editorBrowser.ts
+6
-2
src/vs/editor/browser/view/viewController.ts
src/vs/editor/browser/view/viewController.ts
+3
-3
src/vs/editor/browser/view/viewOutgoingEvents.ts
src/vs/editor/browser/view/viewOutgoingEvents.ts
+8
-6
src/vs/editor/browser/widget/codeEditorWidget.ts
src/vs/editor/browser/widget/codeEditorWidget.ts
+4
-4
src/vs/editor/contrib/codeAction/codeAction.ts
src/vs/editor/contrib/codeAction/codeAction.ts
+1
-1
src/vs/editor/contrib/goToDefinition/clickLinkGesture.ts
src/vs/editor/contrib/goToDefinition/clickLinkGesture.ts
+1
-1
src/vs/editor/contrib/goToDefinition/goToDefinition.ts
src/vs/editor/contrib/goToDefinition/goToDefinition.ts
+2
-2
src/vs/editor/contrib/links/links.ts
src/vs/editor/contrib/links/links.ts
+3
-3
src/vs/editor/contrib/message/messageController.ts
src/vs/editor/contrib/message/messageController.ts
+3
-1
src/vs/editor/contrib/parameterHints/provideSignatureHelp.ts
src/vs/editor/contrib/parameterHints/provideSignatureHelp.ts
+1
-1
src/vs/editor/test/browser/controller/imeTester.ts
src/vs/editor/test/browser/controller/imeTester.ts
+1
-1
src/vs/editor/test/browser/editorTestServices.ts
src/vs/editor/test/browser/editorTestServices.ts
+3
-3
src/vs/editor/test/browser/view/minimapFontCreator.ts
src/vs/editor/test/browser/view/minimapFontCreator.ts
+1
-1
src/vs/editor/test/common/model/editableTextModelTestUtils.ts
...vs/editor/test/common/model/editableTextModelTestUtils.ts
+2
-2
src/vs/editor/test/common/viewModel/testViewModel.ts
src/vs/editor/test/common/viewModel/testViewModel.ts
+1
-1
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+7
-2
src/vs/platform/contextkey/common/contextkey.ts
src/vs/platform/contextkey/common/contextkey.ts
+1
-1
src/vs/platform/keybinding/test/common/mockKeybindingService.ts
.../platform/keybinding/test/common/mockKeybindingService.ts
+9
-9
src/vs/workbench/common/resources.ts
src/vs/workbench/common/resources.ts
+2
-2
src/vs/workbench/parts/codeEditor/electron-browser/selectionClipboard.ts
...h/parts/codeEditor/electron-browser/selectionClipboard.ts
+2
-2
src/vs/workbench/parts/codeEditor/electron-browser/textMate/inspectTMScopes.ts
...s/codeEditor/electron-browser/textMate/inspectTMScopes.ts
+7
-7
src/vs/workbench/services/mode/common/workbenchModeService.ts
...vs/workbench/services/mode/common/workbenchModeService.ts
+1
-1
未找到文件。
src/tsconfig.strictNullChecks.json
浏览文件 @
b72fede4
...
...
@@ -271,6 +271,7 @@
"./vs/editor/contrib/caretOperations/moveCaretCommand.ts"
,
"./vs/editor/contrib/caretOperations/transpose.ts"
,
"./vs/editor/contrib/clipboard/clipboard.ts"
,
"./vs/editor/contrib/codeAction/codeAction.ts"
,
"./vs/editor/contrib/codeAction/codeActionTrigger.ts"
,
"./vs/editor/contrib/colorPicker/color.ts"
,
"./vs/editor/contrib/colorPicker/colorPickerModel.ts"
,
...
...
@@ -300,6 +301,7 @@
"./vs/editor/contrib/folding/test/foldingModel.test.ts"
,
"./vs/editor/contrib/fontZoom/fontZoom.ts"
,
"./vs/editor/contrib/goToDefinition/clickLinkGesture.ts"
,
"./vs/editor/contrib/goToDefinition/goToDefinition.ts"
,
"./vs/editor/contrib/hover/getHover.ts"
,
"./vs/editor/contrib/hover/hoverOperation.ts"
,
"./vs/editor/contrib/hover/hoverWidgets.ts"
,
...
...
@@ -310,6 +312,8 @@
"./vs/editor/contrib/linesOperations/sortLinesCommand.ts"
,
"./vs/editor/contrib/links/getLinks.ts"
,
"./vs/editor/contrib/links/links.ts"
,
"./vs/editor/contrib/message/messageController.ts"
,
"./vs/editor/contrib/parameterHints/provideSignatureHelp.ts"
,
"./vs/editor/contrib/quickOpen/quickOpen.ts"
,
"./vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode.ts"
,
"./vs/editor/contrib/wordHighlighter/wordHighlighter.ts"
,
...
...
@@ -327,12 +331,16 @@
"./vs/editor/standalone/common/monarch/monarchTypes.ts"
,
"./vs/editor/standalone/common/standaloneThemeService.ts"
,
"./vs/editor/standalone/common/themes.ts"
,
"./vs/editor/test/browser/controller/imeTester.ts"
,
"./vs/editor/test/browser/editorTestServices.ts"
,
"./vs/editor/test/browser/view/minimapFontCreator.ts"
,
"./vs/editor/test/common/commentMode.ts"
,
"./vs/editor/test/common/core/viewLineToken.ts"
,
"./vs/editor/test/common/editorTestUtils.ts"
,
"./vs/editor/test/common/mocks/mockMode.ts"
,
"./vs/editor/test/common/mocks/testConfiguration.ts"
,
"./vs/editor/test/common/model/benchmark/benchmarkUtils.ts"
,
"./vs/editor/test/common/model/editableTextModelTestUtils.ts"
,
"./vs/editor/test/common/modes/supports/javascriptOnEnterRules.ts"
,
"./vs/editor/test/common/modesTestUtils.ts"
,
"./vs/editor/test/common/view/minimapCharRendererFactory.ts"
,
...
...
@@ -465,6 +473,7 @@
"./vs/workbench/services/keybinding/common/macLinuxFallbackKeyboardMapper.ts"
,
"./vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.ts"
,
"./vs/workbench/services/keybinding/common/windowsKeyboardMapper.ts"
,
"./vs/workbench/services/mode/common/workbenchModeService.ts"
,
"./vs/workbench/services/panel/common/panelService.ts"
,
"./vs/workbench/services/scm/common/scm.ts"
,
"./vs/workbench/services/scm/common/scmService.ts"
,
...
...
src/vs/editor/browser/editorBrowser.ts
浏览文件 @
b72fede4
...
...
@@ -299,6 +299,10 @@ export interface IMouseTarget {
* A mouse event originating from the editor.
*/
export
interface
IEditorMouseEvent
{
readonly
event
:
IMouseEvent
;
readonly
target
:
IMouseTarget
;
}
export
interface
IPartialEditorMouseEvent
{
readonly
event
:
IMouseEvent
;
readonly
target
:
IMouseTarget
|
null
;
}
...
...
@@ -441,7 +445,7 @@ export interface ICodeEditor extends editorCommon.IEditor {
* @internal
* @event
*/
onMouseDrop
(
listener
:
(
e
:
IEditorMouseEvent
)
=>
void
):
IDisposable
;
onMouseDrop
(
listener
:
(
e
:
I
Partial
EditorMouseEvent
)
=>
void
):
IDisposable
;
/**
* An event emitted on a "contextmenu".
* @event
...
...
@@ -456,7 +460,7 @@ export interface ICodeEditor extends editorCommon.IEditor {
* An event emitted on a "mouseleave".
* @event
*/
onMouseLeave
(
listener
:
(
e
:
IEditorMouseEvent
)
=>
void
):
IDisposable
;
onMouseLeave
(
listener
:
(
e
:
I
Partial
EditorMouseEvent
)
=>
void
):
IDisposable
;
/**
* An event emitted on a "keyup".
* @event
...
...
src/vs/editor/browser/view/viewController.ts
浏览文件 @
b72fede4
...
...
@@ -6,7 +6,7 @@
import
{
IKeyboardEvent
}
from
'
vs/base/browser/keyboardEvent
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
Selection
}
from
'
vs/editor/common/core/selection
'
;
import
{
IEditorMouseEvent
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
IEditorMouseEvent
,
IPartialEditorMouseEvent
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
IViewModel
}
from
'
vs/editor/common/viewModel/viewModel
'
;
import
{
ViewOutgoingEvents
}
from
'
vs/editor/browser/view/viewOutgoingEvents
'
;
import
{
CoreNavigationCommands
,
CoreEditorCommand
}
from
'
vs/editor/browser/controller/coreCommands
'
;
...
...
@@ -293,7 +293,7 @@ export class ViewController {
this
.
outgoingEvents
.
emitMouseMove
(
e
);
}
public
emitMouseLeave
(
e
:
IEditorMouseEvent
):
void
{
public
emitMouseLeave
(
e
:
I
Partial
EditorMouseEvent
):
void
{
this
.
outgoingEvents
.
emitMouseLeave
(
e
);
}
...
...
@@ -309,7 +309,7 @@ export class ViewController {
this
.
outgoingEvents
.
emitMouseDrag
(
e
);
}
public
emitMouseDrop
(
e
:
IEditorMouseEvent
):
void
{
public
emitMouseDrop
(
e
:
I
Partial
EditorMouseEvent
):
void
{
this
.
outgoingEvents
.
emitMouseDrop
(
e
);
}
}
src/vs/editor/browser/view/viewOutgoingEvents.ts
浏览文件 @
b72fede4
...
...
@@ -9,7 +9,7 @@ import { Position } from 'vs/editor/common/core/position';
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
IViewModel
}
from
'
vs/editor/common/viewModel/viewModel
'
;
import
{
IScrollEvent
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IEditorMouseEvent
,
IMouseTarget
,
MouseTargetType
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
IEditorMouseEvent
,
IMouseTarget
,
MouseTargetType
,
IPartialEditorMouseEvent
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
MouseTarget
}
from
'
vs/editor/browser/controller/mouseTarget
'
;
import
*
as
viewEvents
from
'
vs/editor/common/view/viewEvents
'
;
...
...
@@ -26,11 +26,11 @@ export class ViewOutgoingEvents extends Disposable {
public
onKeyUp
:
EventCallback
<
IKeyboardEvent
>
|
null
=
null
;
public
onContextMenu
:
EventCallback
<
IEditorMouseEvent
>
|
null
=
null
;
public
onMouseMove
:
EventCallback
<
IEditorMouseEvent
>
|
null
=
null
;
public
onMouseLeave
:
EventCallback
<
IEditorMouseEvent
>
|
null
=
null
;
public
onMouseLeave
:
EventCallback
<
I
Partial
EditorMouseEvent
>
|
null
=
null
;
public
onMouseUp
:
EventCallback
<
IEditorMouseEvent
>
|
null
=
null
;
public
onMouseDown
:
EventCallback
<
IEditorMouseEvent
>
|
null
=
null
;
public
onMouseDrag
:
EventCallback
<
IEditorMouseEvent
>
|
null
=
null
;
public
onMouseDrop
:
EventCallback
<
IEditorMouseEvent
>
|
null
=
null
;
public
onMouseDrop
:
EventCallback
<
I
Partial
EditorMouseEvent
>
|
null
=
null
;
private
_viewModel
:
IViewModel
;
...
...
@@ -81,7 +81,7 @@ export class ViewOutgoingEvents extends Disposable {
}
}
public
emitMouseLeave
(
e
:
IEditorMouseEvent
):
void
{
public
emitMouseLeave
(
e
:
I
Partial
EditorMouseEvent
):
void
{
if
(
this
.
onMouseLeave
)
{
this
.
onMouseLeave
(
this
.
_convertViewToModelMouseEvent
(
e
));
}
...
...
@@ -105,13 +105,15 @@ export class ViewOutgoingEvents extends Disposable {
}
}
public
emitMouseDrop
(
e
:
IEditorMouseEvent
):
void
{
public
emitMouseDrop
(
e
:
I
Partial
EditorMouseEvent
):
void
{
if
(
this
.
onMouseDrop
)
{
this
.
onMouseDrop
(
this
.
_convertViewToModelMouseEvent
(
e
));
}
}
private
_convertViewToModelMouseEvent
(
e
:
IEditorMouseEvent
):
IEditorMouseEvent
{
private
_convertViewToModelMouseEvent
(
e
:
IEditorMouseEvent
):
IEditorMouseEvent
;
private
_convertViewToModelMouseEvent
(
e
:
IPartialEditorMouseEvent
):
IPartialEditorMouseEvent
;
private
_convertViewToModelMouseEvent
(
e
:
IEditorMouseEvent
|
IPartialEditorMouseEvent
):
IEditorMouseEvent
|
IPartialEditorMouseEvent
{
if
(
e
.
target
)
{
return
{
event
:
e
.
event
,
...
...
src/vs/editor/browser/widget/codeEditorWidget.ts
浏览文件 @
b72fede4
...
...
@@ -173,8 +173,8 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
private
readonly
_onMouseDrag
:
Emitter
<
editorBrowser
.
IEditorMouseEvent
>
=
this
.
_register
(
new
Emitter
<
editorBrowser
.
IEditorMouseEvent
>
());
public
readonly
onMouseDrag
:
Event
<
editorBrowser
.
IEditorMouseEvent
>
=
this
.
_onMouseDrag
.
event
;
private
readonly
_onMouseDrop
:
Emitter
<
editorBrowser
.
I
EditorMouseEvent
>
=
this
.
_register
(
new
Emitter
<
editorBrowser
.
I
EditorMouseEvent
>
());
public
readonly
onMouseDrop
:
Event
<
editorBrowser
.
IEditorMouseEvent
>
=
this
.
_onMouseDrop
.
event
;
private
readonly
_onMouseDrop
:
Emitter
<
editorBrowser
.
I
PartialEditorMouseEvent
>
=
this
.
_register
(
new
Emitter
<
editorBrowser
.
IPartial
EditorMouseEvent
>
());
public
readonly
onMouseDrop
:
Event
<
editorBrowser
.
I
Partial
EditorMouseEvent
>
=
this
.
_onMouseDrop
.
event
;
private
readonly
_onContextMenu
:
Emitter
<
editorBrowser
.
IEditorMouseEvent
>
=
this
.
_register
(
new
Emitter
<
editorBrowser
.
IEditorMouseEvent
>
());
public
readonly
onContextMenu
:
Event
<
editorBrowser
.
IEditorMouseEvent
>
=
this
.
_onContextMenu
.
event
;
...
...
@@ -182,8 +182,8 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
private
readonly
_onMouseMove
:
Emitter
<
editorBrowser
.
IEditorMouseEvent
>
=
this
.
_register
(
new
Emitter
<
editorBrowser
.
IEditorMouseEvent
>
());
public
readonly
onMouseMove
:
Event
<
editorBrowser
.
IEditorMouseEvent
>
=
this
.
_onMouseMove
.
event
;
private
readonly
_onMouseLeave
:
Emitter
<
editorBrowser
.
I
EditorMouseEvent
>
=
this
.
_register
(
new
Emitter
<
editorBrowser
.
I
EditorMouseEvent
>
());
public
readonly
onMouseLeave
:
Event
<
editorBrowser
.
IEditorMouseEvent
>
=
this
.
_onMouseLeave
.
event
;
private
readonly
_onMouseLeave
:
Emitter
<
editorBrowser
.
I
PartialEditorMouseEvent
>
=
this
.
_register
(
new
Emitter
<
editorBrowser
.
IPartial
EditorMouseEvent
>
());
public
readonly
onMouseLeave
:
Event
<
editorBrowser
.
I
Partial
EditorMouseEvent
>
=
this
.
_onMouseLeave
.
event
;
private
readonly
_onKeyUp
:
Emitter
<
IKeyboardEvent
>
=
this
.
_register
(
new
Emitter
<
IKeyboardEvent
>
());
public
readonly
onKeyUp
:
Event
<
IKeyboardEvent
>
=
this
.
_onKeyUp
.
event
;
...
...
src/vs/editor/contrib/codeAction/codeAction.ts
浏览文件 @
b72fede4
...
...
@@ -70,7 +70,7 @@ function codeActionsComparator(a: CodeAction, b: CodeAction): number {
const
bHasDiags
=
!
isFalsyOrEmpty
(
b
.
diagnostics
);
if
(
aHasDiags
)
{
if
(
bHasDiags
)
{
return
a
.
diagnostics
[
0
].
message
.
localeCompare
(
b
.
diagnostics
[
0
].
message
);
return
a
.
diagnostics
!
[
0
].
message
.
localeCompare
(
b
.
diagnostics
!
[
0
].
message
);
}
else
{
return
-
1
;
}
...
...
src/vs/editor/contrib/goToDefinition/clickLinkGesture.ts
浏览文件 @
b72fede4
...
...
@@ -22,7 +22,7 @@ function hasModifier(e: { ctrlKey: boolean; shiftKey: boolean; altKey: boolean;
*/
export
class
ClickLinkMouseEvent
{
public
readonly
target
:
IMouseTarget
|
null
;
public
readonly
target
:
IMouseTarget
;
public
readonly
hasTriggerModifier
:
boolean
;
public
readonly
hasSideBySideModifier
:
boolean
;
public
readonly
isNoneOrSingleMouseDown
:
boolean
;
...
...
src/vs/editor/contrib/goToDefinition/goToDefinition.ts
浏览文件 @
b72fede4
...
...
@@ -17,12 +17,12 @@ function getDefinitions<T>(
model
:
ITextModel
,
position
:
Position
,
registry
:
LanguageFeatureRegistry
<
T
>
,
provide
:
(
provider
:
T
,
model
:
ITextModel
,
position
:
Position
)
=>
DefinitionLink
|
DefinitionLink
[]
|
Thenable
<
DefinitionLink
|
DefinitionLink
[]
>
provide
:
(
provider
:
T
,
model
:
ITextModel
,
position
:
Position
)
=>
DefinitionLink
|
DefinitionLink
[]
|
null
|
undefined
|
Thenable
<
DefinitionLink
|
DefinitionLink
[]
|
null
|
undefined
>
):
Thenable
<
DefinitionLink
[]
>
{
const
provider
=
registry
.
ordered
(
model
);
// get results
const
promises
=
provider
.
map
((
provider
):
Thenable
<
DefinitionLink
|
DefinitionLink
[]
>
=>
{
const
promises
=
provider
.
map
((
provider
):
Thenable
<
DefinitionLink
|
DefinitionLink
[]
|
null
|
undefined
>
=>
{
return
Promise
.
resolve
(
provide
(
provider
,
model
,
position
)).
then
(
undefined
,
err
=>
{
onUnexpectedExternalError
(
err
);
return
null
;
...
...
src/vs/editor/contrib/links/links.ts
浏览文件 @
b72fede4
...
...
@@ -289,7 +289,7 @@ class LinkDetector implements editorCommon.IEditorContribution {
const
useMetaKey
=
(
this
.
editor
.
getConfiguration
().
multiCursorModifier
===
'
altKey
'
);
if
(
this
.
isEnabled
(
mouseEvent
,
withKey
))
{
this
.
cleanUpActiveLinkDecoration
();
// always remove previous link decoration as their can only be one
const
occurrence
=
this
.
getLinkOccurrence
(
mouseEvent
.
target
!
.
position
);
const
occurrence
=
this
.
getLinkOccurrence
(
mouseEvent
.
target
.
position
);
if
(
occurrence
)
{
this
.
editor
.
changeDecorations
((
changeAccessor
)
=>
{
occurrence
.
activate
(
changeAccessor
,
useMetaKey
);
...
...
@@ -319,7 +319,7 @@ class LinkDetector implements editorCommon.IEditorContribution {
if
(
!
this
.
isEnabled
(
mouseEvent
))
{
return
;
}
const
occurrence
=
this
.
getLinkOccurrence
(
mouseEvent
.
target
!
.
position
);
const
occurrence
=
this
.
getLinkOccurrence
(
mouseEvent
.
target
.
position
);
if
(
!
occurrence
)
{
return
;
}
...
...
@@ -374,7 +374,7 @@ class LinkDetector implements editorCommon.IEditorContribution {
private
isEnabled
(
mouseEvent
:
ClickLinkMouseEvent
,
withKey
?:
ClickLinkKeyboardEvent
|
null
):
boolean
{
return
Boolean
(
(
mouseEvent
.
target
&&
mouseEvent
.
target
.
type
===
MouseTargetType
.
CONTENT_TEXT
)
(
mouseEvent
.
target
.
type
===
MouseTargetType
.
CONTENT_TEXT
)
&&
(
mouseEvent
.
hasTriggerModifier
||
(
withKey
&&
withKey
.
keyCodeIsTriggerKey
))
);
}
...
...
src/vs/editor/contrib/message/messageController.ts
浏览文件 @
b72fede4
...
...
@@ -100,7 +100,9 @@ export class MessageController extends Disposable implements editorCommon.IEdito
}
private
_onDidAttemptReadOnlyEdit
():
void
{
this
.
showMessage
(
nls
.
localize
(
'
editor.readonly
'
,
"
Cannot edit in read-only editor
"
),
this
.
_editor
.
getPosition
());
if
(
this
.
_editor
.
hasModel
())
{
this
.
showMessage
(
nls
.
localize
(
'
editor.readonly
'
,
"
Cannot edit in read-only editor
"
),
this
.
_editor
.
getPosition
());
}
}
}
...
...
src/vs/editor/contrib/parameterHints/provideSignatureHelp.ts
浏览文件 @
b72fede4
...
...
@@ -17,7 +17,7 @@ export const Context = {
MultipleSignatures
:
new
RawContextKey
<
boolean
>
(
'
parameterHintsMultipleSignatures
'
,
false
),
};
export
function
provideSignatureHelp
(
model
:
ITextModel
,
position
:
Position
,
context
:
modes
.
SignatureHelpContext
,
token
:
CancellationToken
):
Promise
<
modes
.
SignatureHelp
>
{
export
function
provideSignatureHelp
(
model
:
ITextModel
,
position
:
Position
,
context
:
modes
.
SignatureHelpContext
,
token
:
CancellationToken
):
Promise
<
modes
.
SignatureHelp
|
null
|
undefined
>
{
const
supports
=
modes
.
SignatureHelpProviderRegistry
.
ordered
(
model
);
...
...
src/vs/editor/test/browser/controller/imeTester.ts
浏览文件 @
b72fede4
...
...
@@ -100,7 +100,7 @@ function doCreateTest(description: string, inputStr: string, expectedStr: string
return
PagedScreenReaderStrategy
.
fromEditorSelection
(
currentState
,
model
,
selection
,
true
);
},
deduceModelPosition
:
(
viewAnchorPosition
:
Position
,
deltaOffset
:
number
,
lineFeedCnt
:
number
):
Position
=>
{
return
null
;
return
null
!
;
}
};
...
...
src/vs/editor/test/browser/editorTestServices.ts
浏览文件 @
b72fede4
...
...
@@ -15,14 +15,14 @@ import { IResourceInput } from 'vs/platform/editor/common/editor';
export
class
TestCodeEditorService
extends
AbstractCodeEditorService
{
public
lastInput
:
IResourceInput
;
public
getActiveCodeEditor
():
ICodeEditor
{
return
null
;
}
public
openCodeEditor
(
input
:
IResourceInput
,
source
:
ICodeEditor
|
null
,
sideBySide
?:
boolean
):
TPromise
<
ICodeEditor
>
{
public
getActiveCodeEditor
():
ICodeEditor
|
null
{
return
null
;
}
public
openCodeEditor
(
input
:
IResourceInput
,
source
:
ICodeEditor
|
null
,
sideBySide
?:
boolean
):
TPromise
<
ICodeEditor
|
null
>
{
this
.
lastInput
=
input
;
return
TPromise
.
as
(
null
);
}
public
registerDecorationType
(
key
:
string
,
options
:
IDecorationRenderOptions
,
parentTypeKey
?:
string
):
void
{
}
public
removeDecorationType
(
key
:
string
):
void
{
}
public
resolveDecorationOptions
(
decorationTypeKey
:
string
,
writable
:
boolean
):
IModelDecorationOptions
{
return
null
;
}
public
resolveDecorationOptions
(
decorationTypeKey
:
string
,
writable
:
boolean
):
IModelDecorationOptions
{
return
{}
;
}
}
export
class
TestCommandService
implements
ICommandService
{
...
...
src/vs/editor/test/browser/view/minimapFontCreator.ts
浏览文件 @
b72fede4
...
...
@@ -9,7 +9,7 @@ import { getOrCreateMinimapCharRenderer } from 'vs/editor/common/view/runtimeMin
import
{
RGBA8
}
from
'
vs/editor/common/core/rgba
'
;
let
canvas
=
<
HTMLCanvasElement
>
document
.
getElementById
(
'
my-canvas
'
);
let
ctx
=
canvas
.
getContext
(
'
2d
'
);
let
ctx
=
canvas
.
getContext
(
'
2d
'
)
!
;
canvas
.
style
.
height
=
100
+
'
px
'
;
canvas
.
height
=
100
;
...
...
src/vs/editor/test/common/model/editableTextModelTestUtils.ts
浏览文件 @
b72fede4
...
...
@@ -87,7 +87,7 @@ function assertLineMapping(model: TextModel, msg: string): void {
}
export
function
assertSyncedModels
(
text
:
string
,
callback
:
(
model
:
TextModel
,
assertMirrorModels
:
()
=>
void
)
=>
void
,
setup
:
(
model
:
TextModel
)
=>
void
=
null
):
void
{
export
function
assertSyncedModels
(
text
:
string
,
callback
:
(
model
:
TextModel
,
assertMirrorModels
:
()
=>
void
)
=>
void
,
setup
:
(
(
model
:
TextModel
)
=>
void
)
|
null
=
null
):
void
{
let
model
=
new
TextModel
(
text
,
TextModel
.
DEFAULT_CREATION_OPTIONS
,
null
);
model
.
setEOL
(
EndOfLineSequence
.
LF
);
assertLineMapping
(
model
,
'
model
'
);
...
...
@@ -97,7 +97,7 @@ export function assertSyncedModels(text: string, callback: (model: TextModel, as
assertLineMapping
(
model
,
'
model
'
);
}
let
mirrorModel2
=
new
MirrorTextModel
(
null
,
model
.
getLinesContent
(),
model
.
getEOL
(),
model
.
getVersionId
());
let
mirrorModel2
=
new
MirrorTextModel
(
null
!
,
model
.
getLinesContent
(),
model
.
getEOL
(),
model
.
getVersionId
());
let
mirrorModel2PrevVersionId
=
model
.
getVersionId
();
model
.
onDidChangeContent
((
e
:
IModelContentChangedEvent
)
=>
{
...
...
src/vs/editor/test/common/viewModel/testViewModel.ts
浏览文件 @
b72fede4
...
...
@@ -15,7 +15,7 @@ export function testViewModel(text: string[], options: IEditorOptions, callback:
let
model
=
TextModel
.
createFromString
(
text
.
join
(
'
\n
'
));
let
viewModel
=
new
ViewModel
(
EDITOR_ID
,
configuration
,
model
,
null
);
let
viewModel
=
new
ViewModel
(
EDITOR_ID
,
configuration
,
model
,
null
!
);
callback
(
viewModel
,
model
);
...
...
src/vs/monaco.d.ts
浏览文件 @
b72fede4
...
...
@@ -1111,7 +1111,7 @@ declare namespace monaco.editor {
export
interface
IContextKey
<
T
>
{
set
(
value
:
T
):
void
;
reset
():
void
;
get
():
T
;
get
():
T
|
undefined
;
}
export
interface
IEditorOverrideServices
{
...
...
@@ -3741,6 +3741,11 @@ declare namespace monaco.editor {
* A mouse event originating from the editor.
*/
export
interface
IEditorMouseEvent
{
readonly
event
:
IMouseEvent
;
readonly
target
:
IMouseTarget
;
}
export
interface
IPartialEditorMouseEvent
{
readonly
event
:
IMouseEvent
;
readonly
target
:
IMouseTarget
|
null
;
}
...
...
@@ -3846,7 +3851,7 @@ declare namespace monaco.editor {
* An event emitted on a "mouseleave".
* @event
*/
onMouseLeave
(
listener
:
(
e
:
IEditorMouseEvent
)
=>
void
):
IDisposable
;
onMouseLeave
(
listener
:
(
e
:
I
Partial
EditorMouseEvent
)
=>
void
):
IDisposable
;
/**
* An event emitted on a "keyup".
* @event
...
...
src/vs/platform/contextkey/common/contextkey.ts
浏览文件 @
b72fede4
...
...
@@ -549,7 +549,7 @@ export interface IContext {
export
interface
IContextKey
<
T
>
{
set
(
value
:
T
):
void
;
reset
():
void
;
get
():
T
;
get
():
T
|
undefined
;
}
export
interface
IContextKeyServiceTarget
{
...
...
src/vs/platform/keybinding/test/common/mockKeybindingService.ts
浏览文件 @
b72fede4
...
...
@@ -13,15 +13,15 @@ import { OS } from 'vs/base/common/platform';
import
{
ResolvedKeybindingItem
}
from
'
vs/platform/keybinding/common/resolvedKeybindingItem
'
;
class
MockKeybindingContextKey
<
T
>
implements
IContextKey
<
T
>
{
private
_defaultValue
:
T
;
private
_value
:
T
;
private
_defaultValue
:
T
|
undefined
;
private
_value
:
T
|
undefined
;
constructor
(
defaultValue
:
T
)
{
constructor
(
defaultValue
:
T
|
undefined
)
{
this
.
_defaultValue
=
defaultValue
;
this
.
_value
=
this
.
_defaultValue
;
}
public
set
(
value
:
T
):
void
{
public
set
(
value
:
T
|
undefined
):
void
{
this
.
_value
=
value
;
}
...
...
@@ -29,7 +29,7 @@ class MockKeybindingContextKey<T> implements IContextKey<T> {
this
.
_value
=
this
.
_defaultValue
;
}
public
get
():
T
{
public
get
():
T
|
undefined
{
return
this
.
_value
;
}
}
...
...
@@ -42,7 +42,7 @@ export class MockContextKeyService implements IContextKeyService {
public
dispose
():
void
{
//
}
public
createKey
<
T
>
(
key
:
string
,
defaultValue
:
T
):
IContextKey
<
T
>
{
public
createKey
<
T
>
(
key
:
string
,
defaultValue
:
T
|
undefined
):
IContextKey
<
T
>
{
let
ret
=
new
MockKeybindingContextKey
(
defaultValue
);
this
.
_keys
.
set
(
key
,
ret
);
return
ret
;
...
...
@@ -74,7 +74,7 @@ export class MockKeybindingService implements IKeybindingService {
}
public
getDefaultKeybindingsContent
():
string
{
return
null
;
return
''
;
}
public
getDefaultKeybindings
():
ResolvedKeybindingItem
[]
{
...
...
@@ -108,7 +108,7 @@ export class MockKeybindingService implements IKeybindingService {
return
[];
}
public
lookupKeybinding
(
commandId
:
string
):
ResolvedKeybinding
{
public
lookupKeybinding
(
commandId
:
string
):
ResolvedKeybinding
|
null
{
return
null
;
}
...
...
@@ -116,7 +116,7 @@ export class MockKeybindingService implements IKeybindingService {
return
0
;
}
public
softDispatch
(
keybinding
:
IKeyboardEvent
,
target
:
IContextKeyServiceTarget
):
IResolveResult
{
public
softDispatch
(
keybinding
:
IKeyboardEvent
,
target
:
IContextKeyServiceTarget
):
IResolveResult
|
null
{
return
null
;
}
...
...
src/vs/workbench/common/resources.ts
浏览文件 @
b72fede4
...
...
@@ -49,7 +49,7 @@ export class ResourceContextKey extends Disposable implements IContextKey<URI> {
this
.
_register
(
_fileService
.
onDidChangeFileSystemProviderRegistrations
(()
=>
{
const
resource
=
this
.
_resourceKey
.
get
();
this
.
_isfileSystemResource
.
set
(
resource
&&
_fileService
.
canHandleResource
(
resource
));
this
.
_isfileSystemResource
.
set
(
Boolean
(
resource
&&
_fileService
.
canHandleResource
(
resource
)
));
this
.
_isFileSystemResourceOrUntitled
.
set
(
this
.
_isfileSystemResource
.
get
()
||
this
.
_schemeKey
.
get
()
===
Schemas
.
untitled
);
}));
}
...
...
@@ -74,7 +74,7 @@ export class ResourceContextKey extends Disposable implements IContextKey<URI> {
this
.
_hasResource
.
reset
();
}
get
():
URI
{
get
():
URI
|
undefined
{
return
this
.
_resourceKey
.
get
();
}
}
...
...
src/vs/workbench/parts/codeEditor/electron-browser/selectionClipboard.ts
浏览文件 @
b72fede4
...
...
@@ -43,11 +43,11 @@ export class SelectionClipboard extends Disposable implements IEditorContributio
e
.
event
.
preventDefault
();
editor
.
focus
();
if
(
e
.
target
&&
e
.
target
.
position
)
{
if
(
e
.
target
.
position
)
{
editor
.
setPosition
(
e
.
target
.
position
);
}
if
(
e
.
target
&&
e
.
target
.
type
===
MouseTargetType
.
SCROLLBAR
)
{
if
(
e
.
target
.
type
===
MouseTargetType
.
SCROLLBAR
)
{
return
;
}
...
...
src/vs/workbench/parts/codeEditor/electron-browser/textMate/inspectTMScopes.ts
浏览文件 @
b72fede4
...
...
@@ -13,7 +13,7 @@ import { Position } from 'vs/editor/common/core/position';
import
{
IEditorContribution
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
registerEditorAction
,
registerEditorContribution
,
EditorAction
,
ServicesAccessor
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
ICodeEditor
,
ContentWidgetPositionPreference
,
IContentWidget
,
IContentWidgetPosition
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
ICodeEditor
,
ContentWidgetPositionPreference
,
IContentWidget
,
IContentWidgetPosition
,
IActiveCodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IGrammar
,
StackElement
,
IToken
}
from
'
vscode-textmate
'
;
import
{
ITextMateService
}
from
'
vs/workbench/services/textMate/electron-browser/textMateService
'
;
...
...
@@ -40,7 +40,7 @@ class InspectTMScopesController extends Disposable implements IEditorContributio
private
_themeService
:
IWorkbenchThemeService
;
private
_modeService
:
IModeService
;
private
_notificationService
:
INotificationService
;
private
_widget
:
InspectTMScopesWidget
;
private
_widget
:
InspectTMScopesWidget
|
null
;
constructor
(
editor
:
ICodeEditor
,
...
...
@@ -75,7 +75,7 @@ class InspectTMScopesController extends Disposable implements IEditorContributio
if
(
this
.
_widget
)
{
return
;
}
if
(
!
this
.
_editor
.
get
Model
())
{
if
(
!
this
.
_editor
.
has
Model
())
{
return
;
}
this
.
_widget
=
new
InspectTMScopesWidget
(
this
.
_editor
,
this
.
_textMateService
,
this
.
_modeService
,
this
.
_themeService
,
this
.
_notificationService
);
...
...
@@ -174,7 +174,7 @@ class InspectTMScopesWidget extends Disposable implements IContentWidget {
public
readonly
allowEditorOverflow
=
true
;
private
_isDisposed
:
boolean
;
private
readonly
_editor
:
ICodeEditor
;
private
readonly
_editor
:
I
Active
CodeEditor
;
private
readonly
_modeService
:
IModeService
;
private
readonly
_themeService
:
IWorkbenchThemeService
;
private
readonly
_notificationService
:
INotificationService
;
...
...
@@ -183,7 +183,7 @@ class InspectTMScopesWidget extends Disposable implements IContentWidget {
private
readonly
_grammar
:
TPromise
<
IGrammar
>
;
constructor
(
editor
:
ICodeEditor
,
editor
:
I
Active
CodeEditor
,
textMateService
:
ITextMateService
,
modeService
:
IModeService
,
themeService
:
IWorkbenchThemeService
,
...
...
@@ -292,14 +292,14 @@ class InspectTMScopesWidget extends Disposable implements IContentWidget {
}
private
_decodeMetadata
(
metadata
:
number
):
IDecodedMetadata
{
let
colorMap
=
TokenizationRegistry
.
getColorMap
();
let
colorMap
=
TokenizationRegistry
.
getColorMap
()
!
;
let
languageId
=
TokenMetadata
.
getLanguageId
(
metadata
);
let
tokenType
=
TokenMetadata
.
getTokenType
(
metadata
);
let
fontStyle
=
TokenMetadata
.
getFontStyle
(
metadata
);
let
foreground
=
TokenMetadata
.
getForeground
(
metadata
);
let
background
=
TokenMetadata
.
getBackground
(
metadata
);
return
{
languageIdentifier
:
this
.
_modeService
.
getLanguageIdentifier
(
languageId
),
languageIdentifier
:
this
.
_modeService
.
getLanguageIdentifier
(
languageId
)
!
,
tokenType
:
tokenType
,
fontStyle
:
fontStyle
,
foreground
:
colorMap
[
foreground
],
...
...
src/vs/workbench/services/mode/common/workbenchModeService.ts
浏览文件 @
b72fede4
...
...
@@ -115,7 +115,7 @@ export class WorkbenchModeServiceImpl extends ModeServiceImpl {
for
(
let
j
=
0
,
lenJ
=
extension
.
value
.
length
;
j
<
lenJ
;
j
++
)
{
let
ext
=
extension
.
value
[
j
];
if
(
isValidLanguageExtensionPoint
(
ext
,
extension
.
collector
))
{
let
configuration
:
URI
;
let
configuration
:
URI
|
undefined
=
undefined
;
if
(
ext
.
configuration
)
{
configuration
=
resources
.
joinPath
(
extension
.
description
.
extensionLocation
,
ext
.
configuration
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录