Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
48024f70
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,发现更多精彩内容 >>
未验证
提交
48024f70
编写于
10月 17, 2019
作者:
A
Andre Weinand
提交者:
GitHub
10月 17, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into fix/78014/Fix-Special-Character
上级
0d80bd9a
da114f36
变更
65
隐藏空白更改
内联
并排
Showing
65 changed file
with
200 addition
and
395 deletion
+200
-395
.vscode/tasks.json
.vscode/tasks.json
+2
-2
src/vs/editor/browser/editorExtensions.ts
src/vs/editor/browser/editorExtensions.ts
+24
-18
src/vs/editor/browser/widget/codeEditorWidget.ts
src/vs/editor/browser/widget/codeEditorWidget.ts
+6
-7
src/vs/editor/browser/widget/diffEditorWidget.ts
src/vs/editor/browser/widget/diffEditorWidget.ts
+4
-4
src/vs/editor/common/editorCommon.ts
src/vs/editor/common/editorCommon.ts
+0
-8
src/vs/editor/contrib/bracketMatching/bracketMatching.ts
src/vs/editor/contrib/bracketMatching/bracketMatching.ts
+2
-6
src/vs/editor/contrib/bracketMatching/test/bracketMatching.test.ts
...itor/contrib/bracketMatching/test/bracketMatching.test.ts
+4
-4
src/vs/editor/contrib/codeAction/codeActionCommands.ts
src/vs/editor/contrib/codeAction/codeActionCommands.ts
+1
-5
src/vs/editor/contrib/codeAction/codeActionContributions.ts
src/vs/editor/contrib/codeAction/codeActionContributions.ts
+1
-1
src/vs/editor/contrib/codelens/codelensController.ts
src/vs/editor/contrib/codelens/codelensController.ts
+2
-6
src/vs/editor/contrib/colorPicker/colorDetector.ts
src/vs/editor/contrib/colorPicker/colorDetector.ts
+2
-6
src/vs/editor/contrib/contextmenu/contextmenu.ts
src/vs/editor/contrib/contextmenu/contextmenu.ts
+2
-6
src/vs/editor/contrib/cursorUndo/cursorUndo.ts
src/vs/editor/contrib/cursorUndo/cursorUndo.ts
+2
-6
src/vs/editor/contrib/dnd/dnd.ts
src/vs/editor/contrib/dnd/dnd.ts
+2
-6
src/vs/editor/contrib/find/findController.ts
src/vs/editor/contrib/find/findController.ts
+2
-6
src/vs/editor/contrib/find/test/findController.test.ts
src/vs/editor/contrib/find/test/findController.test.ts
+18
-18
src/vs/editor/contrib/folding/folding.ts
src/vs/editor/contrib/folding/folding.ts
+4
-8
src/vs/editor/contrib/format/formatActions.ts
src/vs/editor/contrib/format/formatActions.ts
+4
-12
src/vs/editor/contrib/goToDefinition/goToDefinitionMouse.ts
src/vs/editor/contrib/goToDefinition/goToDefinitionMouse.ts
+2
-6
src/vs/editor/contrib/gotoError/gotoError.ts
src/vs/editor/contrib/gotoError/gotoError.ts
+2
-6
src/vs/editor/contrib/hover/hover.ts
src/vs/editor/contrib/hover/hover.ts
+2
-6
src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts
src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts
+2
-6
src/vs/editor/contrib/indentation/indentation.ts
src/vs/editor/contrib/indentation/indentation.ts
+2
-6
src/vs/editor/contrib/links/links.ts
src/vs/editor/contrib/links/links.ts
+2
-6
src/vs/editor/contrib/message/messageController.ts
src/vs/editor/contrib/message/messageController.ts
+3
-7
src/vs/editor/contrib/multicursor/multicursor.ts
src/vs/editor/contrib/multicursor/multicursor.ts
+4
-12
src/vs/editor/contrib/multicursor/test/multicursor.test.ts
src/vs/editor/contrib/multicursor/test/multicursor.test.ts
+12
-12
src/vs/editor/contrib/parameterHints/parameterHints.ts
src/vs/editor/contrib/parameterHints/parameterHints.ts
+2
-6
src/vs/editor/contrib/referenceSearch/referenceSearch.ts
src/vs/editor/contrib/referenceSearch/referenceSearch.ts
+2
-6
src/vs/editor/contrib/referenceSearch/referencesController.ts
...vs/editor/contrib/referenceSearch/referencesController.ts
+1
-5
src/vs/editor/contrib/rename/rename.ts
src/vs/editor/contrib/rename/rename.ts
+2
-6
src/vs/editor/contrib/smartSelect/smartSelect.ts
src/vs/editor/contrib/smartSelect/smartSelect.ts
+3
-7
src/vs/editor/contrib/snippet/snippetController2.ts
src/vs/editor/contrib/snippet/snippetController2.ts
+4
-6
src/vs/editor/contrib/snippet/test/snippetController2.old.test.ts
...ditor/contrib/snippet/test/snippetController2.old.test.ts
+1
-1
src/vs/editor/contrib/suggest/suggestController.ts
src/vs/editor/contrib/suggest/suggestController.ts
+2
-7
src/vs/editor/contrib/suggest/test/suggestModel.test.ts
src/vs/editor/contrib/suggest/test/suggestModel.test.ts
+3
-3
src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts
src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts
+2
-6
src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts
...standalone/browser/accessibilityHelp/accessibilityHelp.ts
+2
-6
src/vs/editor/standalone/browser/iPadShowKeyboard/iPadShowKeyboard.ts
...r/standalone/browser/iPadShowKeyboard/iPadShowKeyboard.ts
+2
-6
src/vs/editor/standalone/browser/inspectTokens/inspectTokens.ts
.../editor/standalone/browser/inspectTokens/inspectTokens.ts
+2
-6
src/vs/editor/standalone/browser/quickOpen/editorQuickOpen.ts
...vs/editor/standalone/browser/quickOpen/editorQuickOpen.ts
+2
-6
src/vs/editor/standalone/browser/referenceSearch/standaloneReferenceSearch.ts
...lone/browser/referenceSearch/standaloneReferenceSearch.ts
+1
-1
src/vs/editor/test/browser/testCodeEditor.ts
src/vs/editor/test/browser/testCodeEditor.ts
+2
-2
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+0
-4
src/vs/workbench/browser/parts/editor/editor.contribution.ts
src/vs/workbench/browser/parts/editor/editor.contribution.ts
+1
-1
src/vs/workbench/browser/parts/editor/editorWidgets.ts
src/vs/workbench/browser/parts/editor/editorWidgets.ts
+1
-5
src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.ts
...ntrib/callHierarchy/browser/callHierarchy.contribution.ts
+1
-5
src/vs/workbench/contrib/codeEditor/browser/accessibility/accessibility.ts
...contrib/codeEditor/browser/accessibility/accessibility.ts
+2
-6
src/vs/workbench/contrib/codeEditor/browser/diffEditorHelper.ts
.../workbench/contrib/codeEditor/browser/diffEditorHelper.ts
+5
-7
src/vs/workbench/contrib/codeEditor/browser/inspectTMScopes/inspectTMScopes.ts
...rib/codeEditor/browser/inspectTMScopes/inspectTMScopes.ts
+2
-6
src/vs/workbench/contrib/codeEditor/browser/largeFileOptimizations.ts
...ench/contrib/codeEditor/browser/largeFileOptimizations.ts
+2
-6
src/vs/workbench/contrib/codeEditor/browser/menuPreventer.ts
src/vs/workbench/contrib/codeEditor/browser/menuPreventer.ts
+2
-6
src/vs/workbench/contrib/codeEditor/browser/selectionClipboard.ts
...orkbench/contrib/codeEditor/browser/selectionClipboard.ts
+2
-6
src/vs/workbench/contrib/codeEditor/browser/simpleEditorOptions.ts
...rkbench/contrib/codeEditor/browser/simpleEditorOptions.ts
+6
-6
src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.ts
...Editor/browser/suggestEnabledInput/suggestEnabledInput.ts
+7
-1
src/vs/workbench/contrib/codeEditor/browser/toggleWordWrap.ts
...vs/workbench/contrib/codeEditor/browser/toggleWordWrap.ts
+2
-6
src/vs/workbench/contrib/codeEditor/browser/workbenchReferenceSearch.ts
...ch/contrib/codeEditor/browser/workbenchReferenceSearch.ts
+1
-1
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
...ch/contrib/comments/browser/commentsEditorContribution.ts
+1
-5
src/vs/workbench/contrib/comments/browser/simpleCommentEditor.ts
...workbench/contrib/comments/browser/simpleCommentEditor.ts
+5
-5
src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts
...nch/contrib/debug/browser/breakpointEditorContribution.ts
+1
-5
src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts
...orkbench/contrib/debug/browser/debugEditorContribution.ts
+1
-5
src/vs/workbench/contrib/preferences/browser/keybindingsEditorContribution.ts
...trib/preferences/browser/keybindingsEditorContribution.ts
+2
-6
src/vs/workbench/contrib/preferences/browser/preferencesEditor.ts
...orkbench/contrib/preferences/browser/preferencesEditor.ts
+6
-15
src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts
src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts
+2
-6
src/vs/workbench/contrib/snippets/browser/tabCompletion.ts
src/vs/workbench/contrib/snippets/browser/tabCompletion.ts
+2
-6
未找到文件。
.vscode/tasks.json
浏览文件 @
48024f70
...
...
@@ -76,8 +76,8 @@
"problemMatcher"
:
[]
},
{
"type"
:
"
gulp
"
,
"
task
"
:
"electron"
,
"type"
:
"
npm
"
,
"
script
"
:
"electron"
,
"label"
:
"Download electron"
},
{
...
...
src/vs/editor/browser/editorExtensions.ts
浏览文件 @
48024f70
...
...
@@ -25,10 +25,16 @@ import { withNullAsUndefined } from 'vs/base/common/types';
export
type
ServicesAccessor
=
InstantiationServicesAccessor
;
export
type
IEditorContributionCtor
=
IConstructorSignature1
<
ICodeEditor
,
IEditorContribution
>
;
export
type
IDiffEditorContributionCtor
=
IConstructorSignature1
<
IDiffEditor
,
IDiffEditorContribution
>
;
export
type
EditorTelemetryDataFragment
=
{
target
:
{
classification
:
'
SystemMetaData
'
,
purpose
:
'
FeatureInsight
'
,
};
snippet
:
{
classification
:
'
SystemMetaData
'
,
purpose
:
'
FeatureInsight
'
,
isMeasurement
:
true
,
};
};
export
interface
IEditorContributionDescription
{
id
:
string
;
ctor
:
IEditorContributionCtor
;
}
export
interface
IDiffEditorContributionDescription
{
id
:
string
;
ctor
:
IDiffEditorContributionCtor
;
}
//#region Command
...
...
@@ -297,12 +303,12 @@ export function registerInstantiatedEditorAction(editorAction: EditorAction): vo
EditorContributionRegistry
.
INSTANCE
.
registerEditorAction
(
editorAction
);
}
export
function
registerEditorContribution
(
ctor
:
IEditorContributionCtor
):
void
{
EditorContributionRegistry
.
INSTANCE
.
registerEditorContribution
(
ctor
);
export
function
registerEditorContribution
(
id
:
string
,
ctor
:
IEditorContributionCtor
):
void
{
EditorContributionRegistry
.
INSTANCE
.
registerEditorContribution
(
id
,
ctor
);
}
export
function
registerDiffEditorContribution
(
ctor
:
IDiffEditorContributionCtor
):
void
{
EditorContributionRegistry
.
INSTANCE
.
registerDiffEditorContribution
(
ctor
);
export
function
registerDiffEditorContribution
(
id
:
string
,
ctor
:
IDiffEditorContributionCtor
):
void
{
EditorContributionRegistry
.
INSTANCE
.
registerDiffEditorContribution
(
id
,
ctor
);
}
export
namespace
EditorExtensionsRegistry
{
...
...
@@ -315,11 +321,11 @@ export namespace EditorExtensionsRegistry {
return
EditorContributionRegistry
.
INSTANCE
.
getEditorActions
();
}
export
function
getEditorContributions
():
IEditorContribution
Ctor
[]
{
export
function
getEditorContributions
():
IEditorContribution
Description
[]
{
return
EditorContributionRegistry
.
INSTANCE
.
getEditorContributions
();
}
export
function
getDiffEditorContributions
():
IDiffEditorContribution
Ctor
[]
{
export
function
getDiffEditorContributions
():
IDiffEditorContribution
Description
[]
{
return
EditorContributionRegistry
.
INSTANCE
.
getDiffEditorContributions
();
}
}
...
...
@@ -333,8 +339,8 @@ class EditorContributionRegistry {
public
static
readonly
INSTANCE
=
new
EditorContributionRegistry
();
private
readonly
editorContributions
:
IEditorContribution
Ctor
[];
private
readonly
diffEditorContributions
:
IDiffEditorContribution
Ctor
[];
private
readonly
editorContributions
:
IEditorContribution
Description
[];
private
readonly
diffEditorContributions
:
IDiffEditorContribution
Description
[];
private
readonly
editorActions
:
EditorAction
[];
private
readonly
editorCommands
:
{
[
commandId
:
string
]:
EditorCommand
;
};
...
...
@@ -345,19 +351,19 @@ class EditorContributionRegistry {
this
.
editorCommands
=
Object
.
create
(
null
);
}
public
registerEditorContribution
(
ctor
:
IEditorContributionCtor
):
void
{
this
.
editorContributions
.
push
(
ctor
);
public
registerEditorContribution
(
id
:
string
,
ctor
:
IEditorContributionCtor
):
void
{
this
.
editorContributions
.
push
(
{
id
,
ctor
}
);
}
public
getEditorContributions
():
IEditorContribution
Ctor
[]
{
public
getEditorContributions
():
IEditorContribution
Description
[]
{
return
this
.
editorContributions
.
slice
(
0
);
}
public
registerDiffEditorContribution
(
ctor
:
IDiffEditorContributionCtor
):
void
{
this
.
diffEditorContributions
.
push
(
ctor
);
public
registerDiffEditorContribution
(
id
:
string
,
ctor
:
IDiffEditorContributionCtor
):
void
{
this
.
diffEditorContributions
.
push
(
{
id
,
ctor
}
);
}
public
getDiffEditorContributions
():
IDiffEditorContribution
Ctor
[]
{
public
getDiffEditorContributions
():
IDiffEditorContribution
Description
[]
{
return
this
.
diffEditorContributions
.
slice
(
0
);
}
...
...
src/vs/editor/browser/widget/codeEditorWidget.ts
浏览文件 @
48024f70
...
...
@@ -18,7 +18,7 @@ import { Schemas } from 'vs/base/common/network';
import
{
Configuration
}
from
'
vs/editor/browser/config/configuration
'
;
import
{
CoreEditorCommand
}
from
'
vs/editor/browser/controller/coreCommands
'
;
import
*
as
editorBrowser
from
'
vs/editor/browser/editorBrowser
'
;
import
{
EditorExtensionsRegistry
,
IEditorContribution
Ctor
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
EditorExtensionsRegistry
,
IEditorContribution
Description
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
ICodeEditorService
}
from
'
vs/editor/browser/services/codeEditorService
'
;
import
{
ICommandDelegate
}
from
'
vs/editor/browser/view/viewController
'
;
import
{
IContentWidgetData
,
IOverlayWidgetData
,
View
}
from
'
vs/editor/browser/view/viewImpl
'
;
...
...
@@ -67,7 +67,7 @@ export interface ICodeEditorWidgetOptions {
* Contributions to instantiate.
* Defaults to EditorExtensionsRegistry.getEditorContributions().
*/
contributions
?:
IEditorContribution
Ctor
[];
contributions
?:
IEditorContribution
Description
[];
/**
* Telemetry data associated with this CodeEditorWidget.
...
...
@@ -294,17 +294,16 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
this
.
_contentWidgets
=
{};
this
.
_overlayWidgets
=
{};
let
contributions
:
IEditorContribution
Ctor
[];
let
contributions
:
IEditorContribution
Description
[];
if
(
Array
.
isArray
(
codeEditorWidgetOptions
.
contributions
))
{
contributions
=
codeEditorWidgetOptions
.
contributions
;
}
else
{
contributions
=
EditorExtensionsRegistry
.
getEditorContributions
();
}
for
(
let
i
=
0
,
len
=
contributions
.
length
;
i
<
len
;
i
++
)
{
const
ctor
=
contributions
[
i
];
for
(
const
desc
of
contributions
)
{
try
{
const
contribution
=
this
.
_instantiationService
.
createInstance
(
ctor
,
this
);
this
.
_contributions
[
contribution
.
getId
()
]
=
contribution
;
const
contribution
=
this
.
_instantiationService
.
createInstance
(
desc
.
ctor
,
this
);
this
.
_contributions
[
desc
.
id
]
=
contribution
;
}
catch
(
err
)
{
onUnexpectedError
(
err
);
}
...
...
src/vs/editor/browser/widget/diffEditorWidget.ts
浏览文件 @
48024f70
...
...
@@ -44,7 +44,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
import
{
IDiffLinesChange
,
InlineDiffMargin
}
from
'
vs/editor/browser/widget/inlineDiffMargin
'
;
import
{
IClipboardService
}
from
'
vs/platform/clipboard/common/clipboardService
'
;
import
{
Constants
}
from
'
vs/base/common/uint
'
;
import
{
IDiffEditorContributionCtor
,
EditorExtensionsRegistry
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
EditorExtensionsRegistry
,
IDiffEditorContributionDescription
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
IEditorProgressService
,
IProgressRunner
}
from
'
vs/platform/progress/common/progress
'
;
...
...
@@ -380,10 +380,10 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
this
.
_containerDomElement
.
className
=
DiffEditorWidget
.
_getClassName
(
this
.
_themeService
.
getTheme
(),
this
.
_renderSideBySide
);
}));
const
contributions
:
IDiffEditorContribution
Ctor
[]
=
EditorExtensionsRegistry
.
getDiffEditorContributions
();
for
(
const
ctor
of
contributions
)
{
const
contributions
:
IDiffEditorContribution
Description
[]
=
EditorExtensionsRegistry
.
getDiffEditorContributions
();
for
(
const
desc
of
contributions
)
{
try
{
this
.
_register
(
instantiationService
.
createInstance
(
ctor
,
this
));
this
.
_register
(
instantiationService
.
createInstance
(
desc
.
ctor
,
this
));
}
catch
(
err
)
{
onUnexpectedError
(
err
);
}
...
...
src/vs/editor/common/editorCommon.ts
浏览文件 @
48024f70
...
...
@@ -488,10 +488,6 @@ export interface IDiffEditor extends IEditor {
* An editor contribution that gets created every time a new editor gets created and gets disposed when the editor gets disposed.
*/
export
interface
IEditorContribution
{
/**
* Get a unique identifier for this contribution.
*/
getId
():
string
;
/**
* Dispose this contribution.
*/
...
...
@@ -511,10 +507,6 @@ export interface IEditorContribution {
* @internal
*/
export
interface
IDiffEditorContribution
{
/**
* Get a unique identifier for this contribution.
*/
getId
():
string
;
/**
* Dispose this contribution.
*/
...
...
src/vs/editor/contrib/bracketMatching/bracketMatching.ts
浏览文件 @
48024f70
...
...
@@ -82,7 +82,7 @@ class BracketsData {
}
export
class
BracketMatchingController
extends
Disposable
implements
editorCommon
.
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.bracketMatchingController
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.bracketMatchingController
'
;
public
static
get
(
editor
:
ICodeEditor
):
BracketMatchingController
{
return
editor
.
getContribution
<
BracketMatchingController
>
(
BracketMatchingController
.
ID
);
...
...
@@ -140,10 +140,6 @@ export class BracketMatchingController extends Disposable implements editorCommo
}));
}
public
getId
():
string
{
return
BracketMatchingController
.
ID
;
}
public
jumpToBracket
():
void
{
if
(
!
this
.
_editor
.
hasModel
())
{
return
;
...
...
@@ -311,7 +307,7 @@ export class BracketMatchingController extends Disposable implements editorCommo
}
}
registerEditorContribution
(
BracketMatchingController
);
registerEditorContribution
(
BracketMatchingController
.
ID
,
BracketMatchingController
);
registerEditorAction
(
SelectToBracketAction
);
registerEditorAction
(
JumpToBracketAction
);
registerThemingParticipant
((
theme
,
collector
)
=>
{
...
...
src/vs/editor/contrib/bracketMatching/test/bracketMatching.test.ts
浏览文件 @
48024f70
...
...
@@ -34,7 +34,7 @@ suite('bracket matching', () => {
let
model
=
TextModel
.
createFromString
(
'
var x = (3 + (5-7)) + ((5+3)+5);
'
,
undefined
,
mode
.
getLanguageIdentifier
());
withTestCodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
let
bracketMatchingController
=
editor
.
registerAndInstantiateContribution
<
BracketMatchingController
>
(
BracketMatchingController
);
let
bracketMatchingController
=
editor
.
registerAndInstantiateContribution
<
BracketMatchingController
>
(
BracketMatchingController
.
ID
,
BracketMatchingController
);
// start on closing bracket
editor
.
setPosition
(
new
Position
(
1
,
20
));
...
...
@@ -66,7 +66,7 @@ suite('bracket matching', () => {
let
model
=
TextModel
.
createFromString
(
'
var x = (3 + (5-7)); y();
'
,
undefined
,
mode
.
getLanguageIdentifier
());
withTestCodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
let
bracketMatchingController
=
editor
.
registerAndInstantiateContribution
<
BracketMatchingController
>
(
BracketMatchingController
);
let
bracketMatchingController
=
editor
.
registerAndInstantiateContribution
<
BracketMatchingController
>
(
BracketMatchingController
.
ID
,
BracketMatchingController
);
// start position between brackets
editor
.
setPosition
(
new
Position
(
1
,
16
));
...
...
@@ -103,7 +103,7 @@ suite('bracket matching', () => {
let
model
=
TextModel
.
createFromString
(
'
var x = (3 + (5-7)); y();
'
,
undefined
,
mode
.
getLanguageIdentifier
());
withTestCodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
let
bracketMatchingController
=
editor
.
registerAndInstantiateContribution
<
BracketMatchingController
>
(
BracketMatchingController
);
let
bracketMatchingController
=
editor
.
registerAndInstantiateContribution
<
BracketMatchingController
>
(
BracketMatchingController
.
ID
,
BracketMatchingController
);
// start position in open brackets
...
...
@@ -148,7 +148,7 @@ suite('bracket matching', () => {
let
model
=
TextModel
.
createFromString
(
'
{ } { } { }
'
,
undefined
,
mode
.
getLanguageIdentifier
());
withTestCodeEditor
(
null
,
{
model
:
model
},
(
editor
,
cursor
)
=>
{
let
bracketMatchingController
=
editor
.
registerAndInstantiateContribution
<
BracketMatchingController
>
(
BracketMatchingController
);
let
bracketMatchingController
=
editor
.
registerAndInstantiateContribution
<
BracketMatchingController
>
(
BracketMatchingController
.
ID
,
BracketMatchingController
);
// cursors inside brackets become selections of the entire bracket contents
editor
.
setSelections
([
...
...
src/vs/editor/contrib/codeAction/codeActionCommands.ts
浏览文件 @
48024f70
...
...
@@ -40,7 +40,7 @@ function contextKeyForSupportedActions(kind: CodeActionKind) {
export
class
QuickFixController
extends
Disposable
implements
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.quickFixController
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.quickFixController
'
;
public
static
get
(
editor
:
ICodeEditor
):
QuickFixController
{
return
editor
.
getContribution
<
QuickFixController
>
(
QuickFixController
.
ID
);
...
...
@@ -90,10 +90,6 @@ export class QuickFixController extends Disposable implements IEditorContributio
return
this
.
_ui
.
getValue
().
showCodeActionList
(
actions
,
at
);
}
public
getId
():
string
{
return
QuickFixController
.
ID
;
}
public
manualTriggerAtCurrentPosition
(
notAvailableMessage
:
string
,
filter
?:
CodeActionFilter
,
...
...
src/vs/editor/contrib/codeAction/codeActionContributions.ts
浏览文件 @
48024f70
...
...
@@ -7,7 +7,7 @@ import { registerEditorAction, registerEditorCommand, registerEditorContribution
import
{
CodeActionCommand
,
OrganizeImportsAction
,
QuickFixAction
,
QuickFixController
,
RefactorAction
,
SourceAction
,
AutoFixAction
,
FixAllAction
}
from
'
vs/editor/contrib/codeAction/codeActionCommands
'
;
registerEditorContribution
(
QuickFixController
);
registerEditorContribution
(
QuickFixController
.
ID
,
QuickFixController
);
registerEditorAction
(
QuickFixAction
);
registerEditorAction
(
RefactorAction
);
registerEditorAction
(
SourceAction
);
...
...
src/vs/editor/contrib/codelens/codelensController.ts
浏览文件 @
48024f70
...
...
@@ -21,7 +21,7 @@ import { EditorOption } from 'vs/editor/common/config/editorOptions';
export
class
CodeLensContribution
implements
editorCommon
.
IEditorContribution
{
p
rivate
static
readonly
ID
:
string
=
'
css.editor.codeLens
'
;
p
ublic
static
readonly
ID
:
string
=
'
css.editor.codeLens
'
;
private
_isEnabled
:
boolean
;
...
...
@@ -78,10 +78,6 @@ export class CodeLensContribution implements editorCommon.IEditorContribution {
dispose
(
this
.
_currentCodeLensModel
);
}
getId
():
string
{
return
CodeLensContribution
.
ID
;
}
private
_onModelChange
():
void
{
this
.
_localDispose
();
...
...
@@ -366,4 +362,4 @@ export class CodeLensContribution implements editorCommon.IEditorContribution {
}
}
registerEditorContribution
(
CodeLensContribution
);
registerEditorContribution
(
CodeLensContribution
.
ID
,
CodeLensContribution
);
src/vs/editor/contrib/colorPicker/colorDetector.ts
浏览文件 @
48024f70
...
...
@@ -25,7 +25,7 @@ const MAX_DECORATORS = 500;
export
class
ColorDetector
extends
Disposable
implements
IEditorContribution
{
p
rivate
static
readonly
ID
:
string
=
'
editor.contrib.colorDetector
'
;
p
ublic
static
readonly
ID
:
string
=
'
editor.contrib.colorDetector
'
;
static
readonly
RECOMPUTE_TIME
=
1000
;
// ms
...
...
@@ -88,10 +88,6 @@ export class ColorDetector extends Disposable implements IEditorContribution {
return
this
.
_editor
.
getOption
(
EditorOption
.
colorDecorators
);
}
getId
():
string
{
return
ColorDetector
.
ID
;
}
static
get
(
editor
:
ICodeEditor
):
ColorDetector
{
return
editor
.
getContribution
<
ColorDetector
>
(
this
.
ID
);
}
...
...
@@ -247,4 +243,4 @@ export class ColorDetector extends Disposable implements IEditorContribution {
}
}
registerEditorContribution
(
ColorDetector
);
registerEditorContribution
(
ColorDetector
.
ID
,
ColorDetector
);
src/vs/editor/contrib/contextmenu/contextmenu.ts
浏览文件 @
48024f70
...
...
@@ -26,7 +26,7 @@ import { EditorOption } from 'vs/editor/common/config/editorOptions';
export
class
ContextMenuController
implements
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.contextmenu
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.contextmenu
'
;
public
static
get
(
editor
:
ICodeEditor
):
ContextMenuController
{
return
editor
.
getContribution
<
ContextMenuController
>
(
ContextMenuController
.
ID
);
...
...
@@ -209,10 +209,6 @@ export class ContextMenuController implements IEditorContribution {
return
this
.
_keybindingService
.
lookupKeybinding
(
action
.
id
);
}
public
getId
():
string
{
return
ContextMenuController
.
ID
;
}
public
dispose
():
void
{
if
(
this
.
_contextMenuIsBeingShownCount
>
0
)
{
this
.
_contextViewService
.
hideContextView
();
...
...
@@ -244,5 +240,5 @@ class ShowContextMenu extends EditorAction {
}
}
registerEditorContribution
(
ContextMenuController
);
registerEditorContribution
(
ContextMenuController
.
ID
,
ContextMenuController
);
registerEditorAction
(
ShowContextMenu
);
src/vs/editor/contrib/cursorUndo/cursorUndo.ts
浏览文件 @
48024f70
...
...
@@ -28,7 +28,7 @@ class CursorState {
export
class
CursorUndoController
extends
Disposable
implements
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.cursorUndoController
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.cursorUndoController
'
;
public
static
get
(
editor
:
ICodeEditor
):
CursorUndoController
{
return
editor
.
getContribution
<
CursorUndoController
>
(
CursorUndoController
.
ID
);
...
...
@@ -79,10 +79,6 @@ export class CursorUndoController extends Disposable implements IEditorContribut
return
new
CursorState
(
this
.
_editor
.
getSelections
());
}
public
getId
():
string
{
return
CursorUndoController
.
ID
;
}
public
cursorUndo
():
void
{
if
(
!
this
.
_editor
.
hasModel
())
{
return
;
...
...
@@ -124,5 +120,5 @@ export class CursorUndo extends EditorAction {
}
}
registerEditorContribution
(
CursorUndoController
);
registerEditorContribution
(
CursorUndoController
.
ID
,
CursorUndoController
);
registerEditorAction
(
CursorUndo
);
src/vs/editor/contrib/dnd/dnd.ts
浏览文件 @
48024f70
...
...
@@ -31,7 +31,7 @@ function hasTriggerModifier(e: IKeyboardEvent | IMouseEvent): boolean {
export
class
DragAndDropController
extends
Disposable
implements
editorCommon
.
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.dragAndDrop
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.dragAndDrop
'
;
private
readonly
_editor
:
ICodeEditor
;
private
_dragSelection
:
Selection
|
null
;
...
...
@@ -219,10 +219,6 @@ export class DragAndDropController extends Disposable implements editorCommon.IE
target
.
type
===
MouseTargetType
.
GUTTER_LINE_DECORATIONS
;
}
public
getId
():
string
{
return
DragAndDropController
.
ID
;
}
public
dispose
():
void
{
this
.
_removeDecoration
();
this
.
_dragSelection
=
null
;
...
...
@@ -232,4 +228,4 @@ export class DragAndDropController extends Disposable implements editorCommon.IE
}
}
registerEditorContribution
(
DragAndDropController
);
registerEditorContribution
(
DragAndDropController
.
ID
,
DragAndDropController
);
src/vs/editor/contrib/find/findController.ts
浏览文件 @
48024f70
...
...
@@ -70,7 +70,7 @@ export interface IFindStartOptions {
export
class
CommonFindController
extends
Disposable
implements
editorCommon
.
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.findController
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.findController
'
;
protected
_editor
:
ICodeEditor
;
private
readonly
_findWidgetVisible
:
IContextKey
<
boolean
>
;
...
...
@@ -143,10 +143,6 @@ export class CommonFindController extends Disposable implements editorCommon.IEd
}
}
public
getId
():
string
{
return
CommonFindController
.
ID
;
}
private
_onStateChanged
(
e
:
FindReplaceStateChangedEvent
):
void
{
this
.
saveQueryState
(
e
);
...
...
@@ -735,7 +731,7 @@ export class StartFindReplaceAction extends EditorAction {
}
}
registerEditorContribution
(
FindController
);
registerEditorContribution
(
CommonFindController
.
ID
,
FindController
);
registerEditorAction
(
StartFindAction
);
registerEditorAction
(
StartFindWithSelectionAction
);
...
...
src/vs/editor/contrib/find/test/findController.test.ts
浏览文件 @
48024f70
...
...
@@ -89,7 +89,7 @@ suite('FindController', () => {
assert.ok(true);
return;
}
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController
.ID, TestFindController
);
let startFindAction = new StartFindAction();
// I select ABC on the first line
editor.setSelection(new Selection(1, 1, 1, 4));
...
...
@@ -115,7 +115,7 @@ suite('FindController', () => {
return;
}
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController
.ID, TestFindController
);
let findState = findController.getState();
let nextMatchFindAction = new NextMatchFindAction();
...
...
@@ -141,7 +141,7 @@ suite('FindController', () => {
return;
}
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController);
let findController = editor.registerAndInstantiateContribution<TestFindController>(TestFindController
.ID, TestFindController
);
let findState = findController.getState();
findState.change({ searchString: 'ABC' }, true);
...
...
@@ -161,7 +161,7 @@ suite('FindController', () => {
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
clipboardState
=
''
;
// The cursor is at the very top, of the file, at the first ABC
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
.
ID
,
TestFindController
);
let
findState
=
findController
.
getState
();
let
startFindAction
=
new
StartFindAction
();
let
nextMatchFindAction
=
new
NextMatchFindAction
();
...
...
@@ -215,7 +215,7 @@ suite('FindController', () => {
'
import nls = require(
\'
vs/nls
\'
);
'
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
clipboardState
=
''
;
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
.
ID
,
TestFindController
);
let
nextMatchFindAction
=
new
NextMatchFindAction
();
editor
.
setPosition
({
...
...
@@ -240,7 +240,7 @@ suite('FindController', () => {
'
var z = (3 * 5)
'
,
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
clipboardState
=
''
;
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
.
ID
,
TestFindController
);
let
startFindAction
=
new
StartFindAction
();
let
nextMatchFindAction
=
new
NextMatchFindAction
();
...
...
@@ -264,7 +264,7 @@ suite('FindController', () => {
'
test
'
,
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
let
testRegexString
=
'
tes.
'
;
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
.
ID
,
TestFindController
);
let
nextMatchFindAction
=
new
NextMatchFindAction
();
let
startFindReplaceAction
=
new
StartFindReplaceAction
();
...
...
@@ -294,7 +294,7 @@ suite('FindController', () => {
'
var z = (3 * 5)
'
,
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
clipboardState
=
''
;
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
.
ID
,
TestFindController
);
findController
.
start
({
forceRevealReplace
:
false
,
seedSearchStringFromSelection
:
false
,
...
...
@@ -322,7 +322,7 @@ suite('FindController', () => {
'
HRESULT OnAmbientPropertyChange(DISPID dispid);
'
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
clipboardState
=
''
;
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
.
ID
,
TestFindController
);
let
startFindAction
=
new
StartFindAction
();
startFindAction
.
run
(
null
,
editor
);
...
...
@@ -349,7 +349,7 @@ suite('FindController', () => {
'
line3
'
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
clipboardState
=
''
;
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
.
ID
,
TestFindController
);
let
startFindAction
=
new
StartFindAction
();
startFindAction
.
run
(
null
,
editor
);
...
...
@@ -376,7 +376,7 @@ suite('FindController', () => {
'
([funny]
'
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
clipboardState
=
''
;
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
.
ID
,
TestFindController
);
let
nextSelectionMatchFindAction
=
new
NextSelectionMatchFindAction
();
// toggle regex
...
...
@@ -403,7 +403,7 @@ suite('FindController', () => {
'
([funny]
'
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
clipboardState
=
''
;
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
.
ID
,
TestFindController
);
let
startFindAction
=
new
StartFindAction
();
let
nextSelectionMatchFindAction
=
new
NextSelectionMatchFindAction
();
...
...
@@ -454,7 +454,7 @@ suite('FindController query options persistence', () => {
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
queryState
=
{
'
editor.isRegex
'
:
false
,
'
editor.matchCase
'
:
true
,
'
editor.wholeWord
'
:
false
};
// The cursor is at the very top, of the file, at the first ABC
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
.
ID
,
TestFindController
);
let
findState
=
findController
.
getState
();
let
startFindAction
=
new
StartFindAction
();
...
...
@@ -481,7 +481,7 @@ suite('FindController query options persistence', () => {
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
queryState
=
{
'
editor.isRegex
'
:
false
,
'
editor.matchCase
'
:
false
,
'
editor.wholeWord
'
:
true
};
// The cursor is at the very top, of the file, at the first ABC
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
.
ID
,
TestFindController
);
let
findState
=
findController
.
getState
();
let
startFindAction
=
new
StartFindAction
();
...
...
@@ -506,7 +506,7 @@ suite('FindController query options persistence', () => {
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
queryState
=
{
'
editor.isRegex
'
:
false
,
'
editor.matchCase
'
:
false
,
'
editor.wholeWord
'
:
true
};
// The cursor is at the very top, of the file, at the first ABC
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
.
ID
,
TestFindController
);
findController
.
toggleRegex
();
assert
.
equal
(
queryState
[
'
editor.isRegex
'
],
true
);
...
...
@@ -522,7 +522,7 @@ suite('FindController query options persistence', () => {
],
{
serviceCollection
:
serviceCollection
,
find
:
{
autoFindInSelection
:
true
,
globalFindClipboard
:
false
}
},
(
editor
,
cursor
)
=>
{
// clipboardState = '';
editor
.
setSelection
(
new
Range
(
1
,
1
,
2
,
1
));
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
.
ID
,
TestFindController
);
findController
.
start
({
forceRevealReplace
:
false
,
...
...
@@ -545,7 +545,7 @@ suite('FindController query options persistence', () => {
],
{
serviceCollection
:
serviceCollection
,
find
:
{
autoFindInSelection
:
true
,
globalFindClipboard
:
false
}
},
(
editor
,
cursor
)
=>
{
// clipboardState = '';
editor
.
setSelection
(
new
Range
(
1
,
2
,
1
,
2
));
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
.
ID
,
TestFindController
);
findController
.
start
({
forceRevealReplace
:
false
,
...
...
@@ -568,7 +568,7 @@ suite('FindController query options persistence', () => {
],
{
serviceCollection
:
serviceCollection
,
find
:
{
autoFindInSelection
:
true
,
globalFindClipboard
:
false
}
},
(
editor
,
cursor
)
=>
{
// clipboardState = '';
editor
.
setSelection
(
new
Range
(
1
,
2
,
1
,
3
));
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
);
let
findController
=
editor
.
registerAndInstantiateContribution
<
TestFindController
>
(
TestFindController
.
ID
,
TestFindController
);
findController
.
start
({
forceRevealReplace
:
false
,
...
...
src/vs/editor/contrib/folding/folding.ts
浏览文件 @
48024f70
...
...
@@ -34,7 +34,6 @@ import { onUnexpectedError } from 'vs/base/common/errors';
import
{
RawContextKey
,
IContextKey
,
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
const
CONTEXT_FOLDING_ENABLED
=
new
RawContextKey
<
boolean
>
(
'
foldingEnabled
'
,
false
);
export
const
ID
=
'
editor.contrib.folding
'
;
export
interface
RangeProvider
{
readonly
id
:
string
;
...
...
@@ -50,11 +49,12 @@ interface FoldingStateMemento {
export
class
FoldingController
extends
Disposable
implements
IEditorContribution
{
static
readonly
MAX_FOLDING_REGIONS
=
5000
;
public
static
ID
=
'
editor.contrib.folding
'
;
static
readonly
MAX_FOLDING_REGIONS
=
5000
;
public
static
get
(
editor
:
ICodeEditor
):
FoldingController
{
return
editor
.
getContribution
<
FoldingController
>
(
ID
);
return
editor
.
getContribution
<
FoldingController
>
(
FoldingController
.
ID
);
}
private
readonly
editor
:
ICodeEditor
;
...
...
@@ -134,10 +134,6 @@ export class FoldingController extends Disposable implements IEditorContribution
this
.
onModelChanged
();
}
public
getId
():
string
{
return
ID
;
}
/**
* Store view state.
*/
...
...
@@ -856,7 +852,7 @@ class FoldLevelAction extends FoldingAction<void> {
}
}
registerEditorContribution
(
FoldingController
);
registerEditorContribution
(
FoldingController
.
ID
,
FoldingController
);
registerEditorAction
(
UnfoldAction
);
registerEditorAction
(
UnFoldRecursivelyAction
);
registerEditorAction
(
FoldAction
);
...
...
src/vs/editor/contrib/format/formatActions.ts
浏览文件 @
48024f70
...
...
@@ -28,7 +28,7 @@ import { EditorOption } from 'vs/editor/common/config/editorOptions';
class
FormatOnType
implements
editorCommon
.
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.autoFormat
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.autoFormat
'
;
private
readonly
_editor
:
ICodeEditor
;
private
readonly
_callOnDispose
=
new
DisposableStore
();
...
...
@@ -45,10 +45,6 @@ class FormatOnType implements editorCommon.IEditorContribution {
this
.
_callOnDispose
.
add
(
OnTypeFormattingEditProviderRegistry
.
onDidChange
(
this
.
_update
,
this
));
}
getId
():
string
{
return
FormatOnType
.
ID
;
}
dispose
():
void
{
this
.
_callOnDispose
.
dispose
();
this
.
_callOnModel
.
dispose
();
...
...
@@ -155,7 +151,7 @@ class FormatOnType implements editorCommon.IEditorContribution {
class
FormatOnPaste
implements
editorCommon
.
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.formatOnPaste
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.formatOnPaste
'
;
private
readonly
_callOnDispose
=
new
DisposableStore
();
private
readonly
_callOnModel
=
new
DisposableStore
();
...
...
@@ -170,10 +166,6 @@ class FormatOnPaste implements editorCommon.IEditorContribution {
this
.
_callOnDispose
.
add
(
DocumentRangeFormattingEditProviderRegistry
.
onDidChange
(
this
.
_update
,
this
));
}
getId
():
string
{
return
FormatOnPaste
.
ID
;
}
dispose
():
void
{
this
.
_callOnDispose
.
dispose
();
this
.
_callOnModel
.
dispose
();
...
...
@@ -278,8 +270,8 @@ class FormatSelectionAction extends EditorAction {
}
}
registerEditorContribution
(
FormatOnType
);
registerEditorContribution
(
FormatOnPaste
);
registerEditorContribution
(
FormatOnType
.
ID
,
FormatOnType
);
registerEditorContribution
(
FormatOnPaste
.
ID
,
FormatOnPaste
);
registerEditorAction
(
FormatDocumentAction
);
registerEditorAction
(
FormatSelectionAction
);
...
...
src/vs/editor/contrib/goToDefinition/goToDefinitionMouse.ts
浏览文件 @
48024f70
...
...
@@ -29,7 +29,7 @@ import { withNullAsUndefined } from 'vs/base/common/types';
class
GotoDefinitionWithMouseEditorContribution
implements
editorCommon
.
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.gotodefinitionwithmouse
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.gotodefinitionwithmouse
'
;
static
readonly
MAX_SOURCE_PREVIEW_LINES
=
8
;
private
readonly
editor
:
ICodeEditor
;
...
...
@@ -295,16 +295,12 @@ class GotoDefinitionWithMouseEditorContribution implements editorCommon.IEditorC
return
this
.
editor
.
invokeWithinContext
(
accessor
=>
action
.
run
(
accessor
,
this
.
editor
));
}
public
getId
():
string
{
return
GotoDefinitionWithMouseEditorContribution
.
ID
;
}
public
dispose
():
void
{
this
.
toUnhook
.
dispose
();
}
}
registerEditorContribution
(
GotoDefinitionWithMouseEditorContribution
);
registerEditorContribution
(
GotoDefinitionWithMouseEditorContribution
.
ID
,
GotoDefinitionWithMouseEditorContribution
);
registerThemingParticipant
((
theme
,
collector
)
=>
{
const
activeLinkForeground
=
theme
.
getColor
(
editorActiveLinkForeground
);
...
...
src/vs/editor/contrib/gotoError/gotoError.ts
浏览文件 @
48024f70
...
...
@@ -191,7 +191,7 @@ class MarkerModel {
export
class
MarkerController
implements
editorCommon
.
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.markerController
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.markerController
'
;
public
static
get
(
editor
:
ICodeEditor
):
MarkerController
{
return
editor
.
getContribution
<
MarkerController
>
(
MarkerController
.
ID
);
...
...
@@ -215,10 +215,6 @@ export class MarkerController implements editorCommon.IEditorContribution {
this
.
_widgetVisible
=
CONTEXT_MARKERS_NAVIGATION_VISIBLE
.
bindTo
(
this
.
_contextKeyService
);
}
public
getId
():
string
{
return
MarkerController
.
ID
;
}
public
dispose
():
void
{
this
.
_cleanUp
();
this
.
_disposeOnClose
.
dispose
();
...
...
@@ -479,7 +475,7 @@ class PrevMarkerInFilesAction extends MarkerNavigationAction {
}
}
registerEditorContribution
(
MarkerController
);
registerEditorContribution
(
MarkerController
.
ID
,
MarkerController
);
registerEditorAction
(
NextMarkerAction
);
registerEditorAction
(
PrevMarkerAction
);
registerEditorAction
(
NextMarkerInFilesAction
);
...
...
src/vs/editor/contrib/hover/hover.ts
浏览文件 @
48024f70
...
...
@@ -29,7 +29,7 @@ import { AccessibilitySupport } from 'vs/platform/accessibility/common/accessibi
export
class
ModesHoverController
implements
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.hover
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.hover
'
;
private
readonly
_toUnhook
=
new
DisposableStore
();
private
readonly
_didChangeConfigurationHandler
:
IDisposable
;
...
...
@@ -212,10 +212,6 @@ export class ModesHoverController implements IEditorContribution {
this
.
contentWidget
.
startShowingAt
(
range
,
mode
,
focus
);
}
public
getId
():
string
{
return
ModesHoverController
.
ID
;
}
public
dispose
():
void
{
this
.
_unhookEvents
();
this
.
_toUnhook
.
dispose
();
...
...
@@ -262,7 +258,7 @@ class ShowHoverAction extends EditorAction {
}
}
registerEditorContribution
(
ModesHoverController
);
registerEditorContribution
(
ModesHoverController
.
ID
,
ModesHoverController
);
registerEditorAction
(
ShowHoverAction
);
// theming
...
...
src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts
浏览文件 @
48024f70
...
...
@@ -24,7 +24,7 @@ import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegis
class
InPlaceReplaceController
implements
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.inPlaceReplaceController
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.inPlaceReplaceController
'
;
static
get
(
editor
:
ICodeEditor
):
InPlaceReplaceController
{
return
editor
.
getContribution
<
InPlaceReplaceController
>
(
InPlaceReplaceController
.
ID
);
...
...
@@ -51,10 +51,6 @@ class InPlaceReplaceController implements IEditorContribution {
public
dispose
():
void
{
}
public
getId
():
string
{
return
InPlaceReplaceController
.
ID
;
}
public
run
(
source
:
string
,
up
:
boolean
):
Promise
<
void
>
|
undefined
{
// cancel any pending request
...
...
@@ -183,7 +179,7 @@ class InPlaceReplaceDown extends EditorAction {
}
}
registerEditorContribution
(
InPlaceReplaceController
);
registerEditorContribution
(
InPlaceReplaceController
.
ID
,
InPlaceReplaceController
);
registerEditorAction
(
InPlaceReplaceUp
);
registerEditorAction
(
InPlaceReplaceDown
);
...
...
src/vs/editor/contrib/indentation/indentation.ts
浏览文件 @
48024f70
...
...
@@ -422,7 +422,7 @@ export class AutoIndentOnPasteCommand implements ICommand {
}
export
class
AutoIndentOnPaste
implements
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.autoIndentOnPaste
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.autoIndentOnPaste
'
;
private
readonly
editor
:
ICodeEditor
;
private
readonly
callOnDispose
=
new
DisposableStore
();
...
...
@@ -604,10 +604,6 @@ export class AutoIndentOnPaste implements IEditorContribution {
return
false
;
}
public
getId
():
string
{
return
AutoIndentOnPaste
.
ID
;
}
public
dispose
():
void
{
this
.
callOnDispose
.
dispose
();
this
.
callOnModel
.
dispose
();
...
...
@@ -681,7 +677,7 @@ export class IndentationToTabsCommand implements ICommand {
}
}
registerEditorContribution
(
AutoIndentOnPaste
);
registerEditorContribution
(
AutoIndentOnPaste
.
ID
,
AutoIndentOnPaste
);
registerEditorAction
(
IndentationToSpacesAction
);
registerEditorAction
(
IndentationToTabsAction
);
registerEditorAction
(
IndentUsingTabs
);
...
...
src/vs/editor/contrib/links/links.ts
浏览文件 @
48024f70
...
...
@@ -99,7 +99,7 @@ class LinkOccurrence {
class
LinkDetector
implements
editorCommon
.
IEditorContribution
{
p
rivate
static
readonly
ID
:
string
=
'
editor.linkDetector
'
;
p
ublic
static
readonly
ID
:
string
=
'
editor.linkDetector
'
;
public
static
get
(
editor
:
ICodeEditor
):
LinkDetector
{
return
editor
.
getContribution
<
LinkDetector
>
(
LinkDetector
.
ID
);
...
...
@@ -170,10 +170,6 @@ class LinkDetector implements editorCommon.IEditorContribution {
this
.
beginCompute
();
}
public
getId
():
string
{
return
LinkDetector
.
ID
;
}
private
onModelChanged
():
void
{
this
.
currentOccurrences
=
{};
this
.
activeLinkDecorationId
=
null
;
...
...
@@ -390,7 +386,7 @@ class OpenLinkAction extends EditorAction {
}
}
registerEditorContribution
(
LinkDetector
);
registerEditorContribution
(
LinkDetector
.
ID
,
LinkDetector
);
registerEditorAction
(
OpenLinkAction
);
registerThemingParticipant
((
theme
,
collector
)
=>
{
...
...
src/vs/editor/contrib/message/messageController.ts
浏览文件 @
48024f70
...
...
@@ -21,20 +21,16 @@ import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegis
export
class
MessageController
extends
Disposable
implements
editorCommon
.
IEditorContribution
{
p
rivate
static
readonly
_id
=
'
editor.contrib.messageController
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.messageController
'
;
static
readonly
MESSAGE_VISIBLE
=
new
RawContextKey
<
boolean
>
(
'
messageVisible
'
,
false
);
static
get
(
editor
:
ICodeEditor
):
MessageController
{
return
editor
.
getContribution
<
MessageController
>
(
MessageController
.
_id
);
return
editor
.
getContribution
<
MessageController
>
(
MessageController
.
ID
);
}
private
readonly
closeTimeout
=
3000
;
// close after 3s
getId
():
string
{
return
MessageController
.
_id
;
}
private
readonly
_editor
:
ICodeEditor
;
private
readonly
_visible
:
IContextKey
<
boolean
>
;
private
readonly
_messageWidget
=
this
.
_register
(
new
MutableDisposable
<
MessageWidget
>
());
...
...
@@ -184,7 +180,7 @@ class MessageWidget implements IContentWidget {
}
}
registerEditorContribution
(
MessageController
);
registerEditorContribution
(
MessageController
.
ID
,
MessageController
);
registerThemingParticipant
((
theme
,
collector
)
=>
{
const
border
=
theme
.
getColor
(
inputValidationInfoBorder
);
...
...
src/vs/editor/contrib/multicursor/multicursor.ts
浏览文件 @
48024f70
...
...
@@ -423,7 +423,7 @@ export class MultiCursorSession {
export
class
MultiCursorSelectionController
extends
Disposable
implements
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.multiCursorController
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.multiCursorController
'
;
private
readonly
_editor
:
ICodeEditor
;
private
_ignoreSelectionChange
:
boolean
;
...
...
@@ -446,10 +446,6 @@ export class MultiCursorSelectionController extends Disposable implements IEdito
super
.
dispose
();
}
public
getId
():
string
{
return
MultiCursorSelectionController
.
ID
;
}
private
_beginSessionIfNeeded
(
findController
:
CommonFindController
):
void
{
if
(
!
this
.
_session
)
{
// Create a new session
...
...
@@ -798,7 +794,7 @@ class SelectionHighlighterState {
}
export
class
SelectionHighlighter
extends
Disposable
implements
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.selectionHighlighter
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.selectionHighlighter
'
;
private
readonly
editor
:
ICodeEditor
;
private
_isEnabled
:
boolean
;
...
...
@@ -848,10 +844,6 @@ export class SelectionHighlighter extends Disposable implements IEditorContribut
}));
}
public
getId
():
string
{
return
SelectionHighlighter
.
ID
;
}
private
_update
():
void
{
this
.
_setState
(
SelectionHighlighter
.
_createState
(
this
.
_isEnabled
,
this
.
editor
));
}
...
...
@@ -1041,8 +1033,8 @@ function getValueInRange(model: ITextModel, range: Range, toLowerCase: boolean):
return
(
toLowerCase
?
text
.
toLowerCase
()
:
text
);
}
registerEditorContribution
(
MultiCursorSelectionController
);
registerEditorContribution
(
SelectionHighlighter
);
registerEditorContribution
(
MultiCursorSelectionController
.
ID
,
MultiCursorSelectionController
);
registerEditorContribution
(
SelectionHighlighter
.
ID
,
SelectionHighlighter
);
registerEditorAction
(
InsertCursorAbove
);
registerEditorAction
(
InsertCursorBelow
);
...
...
src/vs/editor/contrib/multicursor/test/multicursor.test.ts
浏览文件 @
48024f70
...
...
@@ -79,8 +79,8 @@ suite('Multicursor selection', () => {
'
var z = (3 * 5)
'
,
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
let
findController
=
editor
.
registerAndInstantiateContribution
<
CommonFindController
>
(
CommonFindController
);
let
multiCursorSelectController
=
editor
.
registerAndInstantiateContribution
<
MultiCursorSelectionController
>
(
MultiCursorSelectionController
);
let
findController
=
editor
.
registerAndInstantiateContribution
<
CommonFindController
>
(
CommonFindController
.
ID
,
CommonFindController
);
let
multiCursorSelectController
=
editor
.
registerAndInstantiateContribution
<
MultiCursorSelectionController
>
(
MultiCursorSelectionController
.
ID
,
MultiCursorSelectionController
);
let
selectHighlightsAction
=
new
SelectHighlightsAction
();
editor
.
setSelection
(
new
Selection
(
2
,
9
,
2
,
16
));
...
...
@@ -109,8 +109,8 @@ suite('Multicursor selection', () => {
'
nothing
'
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
let
findController
=
editor
.
registerAndInstantiateContribution
<
CommonFindController
>
(
CommonFindController
);
let
multiCursorSelectController
=
editor
.
registerAndInstantiateContribution
<
MultiCursorSelectionController
>
(
MultiCursorSelectionController
);
let
findController
=
editor
.
registerAndInstantiateContribution
<
CommonFindController
>
(
CommonFindController
.
ID
,
CommonFindController
);
let
multiCursorSelectController
=
editor
.
registerAndInstantiateContribution
<
MultiCursorSelectionController
>
(
MultiCursorSelectionController
.
ID
,
MultiCursorSelectionController
);
let
selectHighlightsAction
=
new
SelectHighlightsAction
();
editor
.
setSelection
(
new
Selection
(
1
,
1
,
1
,
1
));
...
...
@@ -143,8 +143,8 @@ suite('Multicursor selection', () => {
'
rty
'
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
let
findController
=
editor
.
registerAndInstantiateContribution
<
CommonFindController
>
(
CommonFindController
);
let
multiCursorSelectController
=
editor
.
registerAndInstantiateContribution
<
MultiCursorSelectionController
>
(
MultiCursorSelectionController
);
let
findController
=
editor
.
registerAndInstantiateContribution
<
CommonFindController
>
(
CommonFindController
.
ID
,
CommonFindController
);
let
multiCursorSelectController
=
editor
.
registerAndInstantiateContribution
<
MultiCursorSelectionController
>
(
MultiCursorSelectionController
.
ID
,
MultiCursorSelectionController
);
let
addSelectionToNextFindMatch
=
new
AddSelectionToNextFindMatchAction
();
editor
.
setSelection
(
new
Selection
(
2
,
1
,
3
,
4
));
...
...
@@ -171,8 +171,8 @@ suite('Multicursor selection', () => {
'
abcabc
'
,
],
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
let
findController
=
editor
.
registerAndInstantiateContribution
<
CommonFindController
>
(
CommonFindController
);
let
multiCursorSelectController
=
editor
.
registerAndInstantiateContribution
<
MultiCursorSelectionController
>
(
MultiCursorSelectionController
);
let
findController
=
editor
.
registerAndInstantiateContribution
<
CommonFindController
>
(
CommonFindController
.
ID
,
CommonFindController
);
let
multiCursorSelectController
=
editor
.
registerAndInstantiateContribution
<
MultiCursorSelectionController
>
(
MultiCursorSelectionController
.
ID
,
MultiCursorSelectionController
);
let
addSelectionToNextFindMatch
=
new
AddSelectionToNextFindMatchAction
();
editor
.
setSelection
(
new
Selection
(
1
,
1
,
1
,
4
));
...
...
@@ -228,8 +228,8 @@ suite('Multicursor selection', () => {
editor
.
getModel
()
!
.
setEOL
(
EndOfLineSequence
.
CRLF
);
let
findController
=
editor
.
registerAndInstantiateContribution
<
CommonFindController
>
(
CommonFindController
);
let
multiCursorSelectController
=
editor
.
registerAndInstantiateContribution
<
MultiCursorSelectionController
>
(
MultiCursorSelectionController
);
let
findController
=
editor
.
registerAndInstantiateContribution
<
CommonFindController
>
(
CommonFindController
.
ID
,
CommonFindController
);
let
multiCursorSelectController
=
editor
.
registerAndInstantiateContribution
<
MultiCursorSelectionController
>
(
MultiCursorSelectionController
.
ID
,
MultiCursorSelectionController
);
let
addSelectionToNextFindMatch
=
new
AddSelectionToNextFindMatchAction
();
editor
.
setSelection
(
new
Selection
(
2
,
1
,
3
,
4
));
...
...
@@ -251,8 +251,8 @@ suite('Multicursor selection', () => {
function
testMulticursor
(
text
:
string
[],
callback
:
(
editor
:
TestCodeEditor
,
findController
:
CommonFindController
)
=>
void
):
void
{
withTestCodeEditor
(
text
,
{
serviceCollection
:
serviceCollection
},
(
editor
,
cursor
)
=>
{
let
findController
=
editor
.
registerAndInstantiateContribution
<
CommonFindController
>
(
CommonFindController
);
let
multiCursorSelectController
=
editor
.
registerAndInstantiateContribution
<
MultiCursorSelectionController
>
(
MultiCursorSelectionController
);
let
findController
=
editor
.
registerAndInstantiateContribution
<
CommonFindController
>
(
CommonFindController
.
ID
,
CommonFindController
);
let
multiCursorSelectController
=
editor
.
registerAndInstantiateContribution
<
MultiCursorSelectionController
>
(
MultiCursorSelectionController
.
ID
,
MultiCursorSelectionController
);
callback
(
editor
,
findController
);
...
...
src/vs/editor/contrib/parameterHints/parameterHints.ts
浏览文件 @
48024f70
...
...
@@ -20,7 +20,7 @@ import { TriggerContext } from 'vs/editor/contrib/parameterHints/parameterHintsM
class
ParameterHintsController
extends
Disposable
implements
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.controller.parameterHints
'
;
p
ublic
static
readonly
ID
=
'
editor.controller.parameterHints
'
;
public
static
get
(
editor
:
ICodeEditor
):
ParameterHintsController
{
return
editor
.
getContribution
<
ParameterHintsController
>
(
ParameterHintsController
.
ID
);
...
...
@@ -35,10 +35,6 @@ class ParameterHintsController extends Disposable implements IEditorContribution
this
.
widget
=
this
.
_register
(
instantiationService
.
createInstance
(
ParameterHintsWidget
,
this
.
editor
));
}
getId
():
string
{
return
ParameterHintsController
.
ID
;
}
cancel
():
void
{
this
.
widget
.
cancel
();
}
...
...
@@ -82,7 +78,7 @@ export class TriggerParameterHintsAction extends EditorAction {
}
}
registerEditorContribution
(
ParameterHintsController
);
registerEditorContribution
(
ParameterHintsController
.
ID
,
ParameterHintsController
);
registerEditorAction
(
TriggerParameterHintsAction
);
const
weight
=
KeybindingWeight
.
EditorContrib
+
75
;
...
...
src/vs/editor/contrib/referenceSearch/referenceSearch.ts
浏览文件 @
48024f70
...
...
@@ -37,7 +37,7 @@ export const defaultReferenceSearchOptions: RequestOptions = {
export
class
ReferenceController
implements
editorCommon
.
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.referenceController
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.referenceController
'
;
constructor
(
editor
:
ICodeEditor
,
...
...
@@ -50,10 +50,6 @@ export class ReferenceController implements editorCommon.IEditorContribution {
public
dispose
():
void
{
}
public
getId
():
string
{
return
ReferenceController
.
ID
;
}
}
export
class
ReferenceAction
extends
EditorAction
{
...
...
@@ -93,7 +89,7 @@ export class ReferenceAction extends EditorAction {
}
}
registerEditorContribution
(
ReferenceController
);
registerEditorContribution
(
ReferenceController
.
ID
,
ReferenceController
);
registerEditorAction
(
ReferenceAction
);
...
...
src/vs/editor/contrib/referenceSearch/referencesController.ts
浏览文件 @
48024f70
...
...
@@ -30,7 +30,7 @@ export interface RequestOptions {
export
abstract
class
ReferencesController
implements
editorCommon
.
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.referencesController
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.referencesController
'
;
private
readonly
_disposables
=
new
DisposableStore
();
private
readonly
_editor
:
ICodeEditor
;
...
...
@@ -59,10 +59,6 @@ export abstract class ReferencesController implements editorCommon.IEditorContri
this
.
_referenceSearchVisible
=
ctxReferenceSearchVisible
.
bindTo
(
contextKeyService
);
}
public
getId
():
string
{
return
ReferencesController
.
ID
;
}
public
dispose
():
void
{
this
.
_referenceSearchVisible
.
reset
();
dispose
(
this
.
_disposables
);
...
...
src/vs/editor/contrib/rename/rename.ts
浏览文件 @
48024f70
...
...
@@ -97,7 +97,7 @@ export async function rename(model: ITextModel, position: Position, newName: str
class
RenameController
implements
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.renameController
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.renameController
'
;
static
get
(
editor
:
ICodeEditor
):
RenameController
{
return
editor
.
getContribution
<
RenameController
>
(
RenameController
.
ID
);
...
...
@@ -118,10 +118,6 @@ class RenameController implements IEditorContribution {
this
.
_renameInputField
=
new
IdleValue
(()
=>
this
.
_dispoableStore
.
add
(
new
RenameInputField
(
this
.
editor
,
this
.
_themeService
,
this
.
_contextKeyService
)));
}
getId
():
string
{
return
RenameController
.
ID
;
}
dispose
():
void
{
this
.
_dispoableStore
.
dispose
();
this
.
_cts
.
dispose
(
true
);
...
...
@@ -278,7 +274,7 @@ export class RenameAction extends EditorAction {
}
}
registerEditorContribution
(
RenameController
);
registerEditorContribution
(
RenameController
.
ID
,
RenameController
);
registerEditorAction
(
RenameAction
);
const
RenameCommand
=
EditorCommand
.
bindToContribution
<
RenameController
>
(
RenameController
.
get
);
...
...
src/vs/editor/contrib/smartSelect/smartSelect.ts
浏览文件 @
48024f70
...
...
@@ -47,10 +47,10 @@ class SelectionRanges {
class
SmartSelectController
implements
IEditorContribution
{
p
rivate
static
readonly
_id
=
'
editor.contrib.smartSelectController
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.smartSelectController
'
;
static
get
(
editor
:
ICodeEditor
):
SmartSelectController
{
return
editor
.
getContribution
<
SmartSelectController
>
(
SmartSelectController
.
_id
);
return
editor
.
getContribution
<
SmartSelectController
>
(
SmartSelectController
.
ID
);
}
private
readonly
_editor
:
ICodeEditor
;
...
...
@@ -67,10 +67,6 @@ class SmartSelectController implements IEditorContribution {
dispose
(
this
.
_selectionListener
);
}
getId
():
string
{
return
SmartSelectController
.
_id
;
}
run
(
forward
:
boolean
):
Promise
<
void
>
|
void
{
if
(
!
this
.
_editor
.
hasModel
())
{
return
;
...
...
@@ -210,7 +206,7 @@ class ShrinkSelectionAction extends AbstractSmartSelect {
}
}
registerEditorContribution
(
SmartSelectController
);
registerEditorContribution
(
SmartSelectController
.
ID
,
SmartSelectController
);
registerEditorAction
(
GrowSelectionAction
);
registerEditorAction
(
ShrinkSelectionAction
);
...
...
src/vs/editor/contrib/snippet/snippetController2.ts
浏览文件 @
48024f70
...
...
@@ -40,8 +40,10 @@ const _defaultOptions: ISnippetInsertOptions = {
export
class
SnippetController2
implements
IEditorContribution
{
public
static
ID
=
'
snippetController2
'
;
static
get
(
editor
:
ICodeEditor
):
SnippetController2
{
return
editor
.
getContribution
<
SnippetController2
>
(
'
snippetController2
'
);
return
editor
.
getContribution
<
SnippetController2
>
(
SnippetController2
.
ID
);
}
static
readonly
InSnippetMode
=
new
RawContextKey
(
'
inSnippetMode
'
,
false
);
...
...
@@ -75,10 +77,6 @@ export class SnippetController2 implements IEditorContribution {
this
.
_snippetListener
.
dispose
();
}
getId
():
string
{
return
'
snippetController2
'
;
}
insert
(
template
:
string
,
opts
?:
Partial
<
ISnippetInsertOptions
>
...
...
@@ -249,7 +247,7 @@ export class SnippetController2 implements IEditorContribution {
}
registerEditorContribution
(
SnippetController2
);
registerEditorContribution
(
SnippetController2
.
ID
,
SnippetController2
);
const
CommandCtor
=
EditorCommand
.
bindToContribution
<
SnippetController2
>
(
SnippetController2
.
get
);
...
...
src/vs/editor/contrib/snippet/test/snippetController2.old.test.ts
浏览文件 @
48024f70
...
...
@@ -45,7 +45,7 @@ suite('SnippetController', () => {
editor
.
getModel
()
!
.
updateOptions
({
insertSpaces
:
false
});
let
snippetController
=
editor
.
registerAndInstantiateContribution
<
TestSnippetController
>
(
TestSnippetController
);
let
snippetController
=
editor
.
registerAndInstantiateContribution
<
TestSnippetController
>
(
TestSnippetController
.
ID
,
TestSnippetController
);
let
template
=
[
'
for (var ${1:index}; $1 < ${2:array}.length; $1++) {
'
,
'
\t
var element = $2[$1];
'
,
...
...
src/vs/editor/contrib/suggest/suggestController.ts
浏览文件 @
48024f70
...
...
@@ -88,7 +88,7 @@ class LineSuffix {
export
class
SuggestController
implements
IEditorContribution
{
p
rivate
static
readonly
ID
:
string
=
'
editor.contrib.suggestController
'
;
p
ublic
static
readonly
ID
:
string
=
'
editor.contrib.suggestController
'
;
public
static
get
(
editor
:
ICodeEditor
):
SuggestController
{
return
editor
.
getContribution
<
SuggestController
>
(
SuggestController
.
ID
);
...
...
@@ -210,11 +210,6 @@ export class SuggestController implements IEditorContribution {
updateFromConfig
();
}
getId
():
string
{
return
SuggestController
.
ID
;
}
dispose
():
void
{
this
.
_alternatives
.
dispose
();
this
.
_toDispose
.
dispose
();
...
...
@@ -491,7 +486,7 @@ export class TriggerSuggestAction extends EditorAction {
}
}
registerEditorContribution
(
SuggestController
);
registerEditorContribution
(
SuggestController
.
ID
,
SuggestController
);
registerEditorAction
(
TriggerSuggestAction
);
const
weight
=
KeybindingWeight
.
EditorContrib
+
90
;
...
...
src/vs/editor/contrib/suggest/test/suggestModel.test.ts
浏览文件 @
48024f70
...
...
@@ -59,7 +59,7 @@ function createMockEditor(model: TextModel): TestCodeEditor {
}],
),
});
editor
.
registerAndInstantiateContribution
(
SnippetController2
);
editor
.
registerAndInstantiateContribution
(
SnippetController2
.
ID
,
SnippetController2
);
return
editor
;
}
...
...
@@ -679,8 +679,8 @@ suite('SuggestModel - TriggerAndCancelOracle', function () {
super
.
_insertSuggestion
(
item
,
false
,
true
,
true
,
false
);
}
}
const
ctrl
=
<
TestCtrl
>
editor
.
registerAndInstantiateContribution
(
TestCtrl
);
editor
.
registerAndInstantiateContribution
(
SnippetController2
);
const
ctrl
=
<
TestCtrl
>
editor
.
registerAndInstantiateContribution
(
TestCtrl
.
ID
,
TestCtrl
);
editor
.
registerAndInstantiateContribution
(
SnippetController2
.
ID
,
SnippetController2
);
await
assertEvent
(
sugget
.
onDidSuggest
,
()
=>
{
editor
.
setPosition
({
lineNumber
:
1
,
column
:
3
});
...
...
src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts
浏览文件 @
48024f70
...
...
@@ -458,7 +458,7 @@ class WordHighlighter {
class
WordHighlighterContribution
extends
Disposable
implements
editorCommon
.
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.wordHighlighter
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.wordHighlighter
'
;
public
static
get
(
editor
:
ICodeEditor
):
WordHighlighterContribution
{
return
editor
.
getContribution
<
WordHighlighterContribution
>
(
WordHighlighterContribution
.
ID
);
...
...
@@ -484,10 +484,6 @@ class WordHighlighterContribution extends Disposable implements editorCommon.IEd
createWordHighlighterIfPossible
();
}
public
getId
():
string
{
return
WordHighlighterContribution
.
ID
;
}
public
saveViewState
():
boolean
{
if
(
this
.
wordHighligher
&&
this
.
wordHighligher
.
hasDecorations
())
{
return
true
;
...
...
@@ -603,7 +599,7 @@ class TriggerWordHighlightAction extends EditorAction {
}
}
registerEditorContribution
(
WordHighlighterContribution
);
registerEditorContribution
(
WordHighlighterContribution
.
ID
,
WordHighlighterContribution
);
registerEditorAction
(
NextWordHighlightAction
);
registerEditorAction
(
PrevWordHighlightAction
);
registerEditorAction
(
TriggerWordHighlightAction
);
...
...
src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts
浏览文件 @
48024f70
...
...
@@ -37,7 +37,7 @@ const CONTEXT_ACCESSIBILITY_WIDGET_VISIBLE = new RawContextKey<boolean>('accessi
class
AccessibilityHelpController
extends
Disposable
implements
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.accessibilityHelpController
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.accessibilityHelpController
'
;
public
static
get
(
editor
:
ICodeEditor
):
AccessibilityHelpController
{
return
editor
.
getContribution
<
AccessibilityHelpController
>
(
...
...
@@ -60,10 +60,6 @@ class AccessibilityHelpController extends Disposable
);
}
public
getId
():
string
{
return
AccessibilityHelpController
.
ID
;
}
public
show
():
void
{
this
.
_widget
.
show
();
}
...
...
@@ -348,7 +344,7 @@ class ShowAccessibilityHelpAction extends EditorAction {
}
}
registerEditorContribution
(
AccessibilityHelpController
);
registerEditorContribution
(
AccessibilityHelpController
.
ID
,
AccessibilityHelpController
);
registerEditorAction
(
ShowAccessibilityHelpAction
);
const
AccessibilityHelpCommand
=
EditorCommand
.
bindToContribution
<
AccessibilityHelpController
>
(
AccessibilityHelpController
.
get
);
...
...
src/vs/editor/standalone/browser/iPadShowKeyboard/iPadShowKeyboard.ts
浏览文件 @
48024f70
...
...
@@ -14,7 +14,7 @@ import { EditorOption } from 'vs/editor/common/config/editorOptions';
export
class
IPadShowKeyboard
extends
Disposable
implements
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.iPadShowKeyboard
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.iPadShowKeyboard
'
;
private
readonly
editor
:
ICodeEditor
;
private
widget
:
ShowKeyboardWidget
|
null
;
...
...
@@ -44,10 +44,6 @@ export class IPadShowKeyboard extends Disposable implements IEditorContribution
}
}
public
getId
():
string
{
return
IPadShowKeyboard
.
ID
;
}
public
dispose
():
void
{
super
.
dispose
();
if
(
this
.
widget
)
{
...
...
@@ -103,4 +99,4 @@ class ShowKeyboardWidget extends Disposable implements IOverlayWidget {
}
}
registerEditorContribution
(
IPadShowKeyboard
);
registerEditorContribution
(
IPadShowKeyboard
.
ID
,
IPadShowKeyboard
);
src/vs/editor/standalone/browser/inspectTokens/inspectTokens.ts
浏览文件 @
48024f70
...
...
@@ -25,7 +25,7 @@ import { InspectTokensNLS } from 'vs/editor/common/standaloneStrings';
class
InspectTokensController
extends
Disposable
implements
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.inspectTokens
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.inspectTokens
'
;
public
static
get
(
editor
:
ICodeEditor
):
InspectTokensController
{
return
editor
.
getContribution
<
InspectTokensController
>
(
InspectTokensController
.
ID
);
...
...
@@ -50,10 +50,6 @@ class InspectTokensController extends Disposable implements IEditorContribution
this
.
_register
(
TokenizationRegistry
.
onDidChange
((
e
)
=>
this
.
stop
()));
}
public
getId
():
string
{
return
InspectTokensController
.
ID
;
}
public
dispose
():
void
{
this
.
stop
();
super
.
dispose
();
...
...
@@ -325,7 +321,7 @@ class InspectTokensWidget extends Disposable implements IContentWidget {
}
}
registerEditorContribution
(
InspectTokensController
);
registerEditorContribution
(
InspectTokensController
.
ID
,
InspectTokensController
);
registerEditorAction
(
InspectTokens
);
registerThemingParticipant
((
theme
,
collector
)
=>
{
...
...
src/vs/editor/standalone/browser/quickOpen/editorQuickOpen.ts
浏览文件 @
48024f70
...
...
@@ -24,7 +24,7 @@ export interface IQuickOpenControllerOpts {
export
class
QuickOpenController
implements
editorCommon
.
IEditorContribution
,
IDecorator
{
p
rivate
static
readonly
ID
=
'
editor.controller.quickOpenController
'
;
p
ublic
static
readonly
ID
=
'
editor.controller.quickOpenController
'
;
public
static
get
(
editor
:
ICodeEditor
):
QuickOpenController
{
return
editor
.
getContribution
<
QuickOpenController
>
(
QuickOpenController
.
ID
);
...
...
@@ -39,10 +39,6 @@ export class QuickOpenController implements editorCommon.IEditorContribution, ID
this
.
editor
=
editor
;
}
public
getId
():
string
{
return
QuickOpenController
.
ID
;
}
public
dispose
():
void
{
// Dispose widget
if
(
this
.
widget
)
{
...
...
@@ -173,4 +169,4 @@ export interface IDecorator {
clearDecorations
():
void
;
}
registerEditorContribution
(
QuickOpenController
);
registerEditorContribution
(
QuickOpenController
.
ID
,
QuickOpenController
);
src/vs/editor/standalone/browser/referenceSearch/standaloneReferenceSearch.ts
浏览文件 @
48024f70
...
...
@@ -37,4 +37,4 @@ export class StandaloneReferencesController extends ReferencesController {
}
}
registerEditorContribution
(
StandaloneReferencesController
);
registerEditorContribution
(
ReferencesController
.
ID
,
StandaloneReferencesController
);
src/vs/editor/test/browser/testCodeEditor.ts
浏览文件 @
48024f70
...
...
@@ -42,9 +42,9 @@ export class TestCodeEditor extends CodeEditorWidget implements editorBrowser.IC
public
getCursor
():
Cursor
|
undefined
{
return
this
.
_modelData
?
this
.
_modelData
.
cursor
:
undefined
;
}
public
registerAndInstantiateContribution
<
T
extends
editorCommon
.
IEditorContribution
>
(
ctor
:
any
):
T
{
public
registerAndInstantiateContribution
<
T
extends
editorCommon
.
IEditorContribution
>
(
id
:
string
,
ctor
:
any
):
T
{
let
r
=
<
T
>
this
.
_instantiationService
.
createInstance
(
ctor
,
this
);
this
.
_contributions
[
r
.
getId
()
]
=
r
;
this
.
_contributions
[
id
]
=
r
;
return
r
;
}
public
dispose
()
{
...
...
src/vs/monaco.d.ts
浏览文件 @
48024f70
...
...
@@ -2209,10 +2209,6 @@ declare namespace monaco.editor {
* An editor contribution that gets created every time a new editor gets created and gets disposed when the editor gets disposed.
*/
export
interface
IEditorContribution
{
/**
* Get a unique identifier for this contribution.
*/
getId
():
string
;
/**
* Dispose this contribution.
*/
...
...
src/vs/workbench/browser/parts/editor/editor.contribution.ts
浏览文件 @
48024f70
...
...
@@ -218,7 +218,7 @@ class SideBySideEditorInputFactory implements IEditorInputFactory {
Registry
.
as
<
IEditorInputFactoryRegistry
>
(
EditorInputExtensions
.
EditorInputFactories
).
registerEditorInputFactory
(
SideBySideEditorInput
.
ID
,
SideBySideEditorInputFactory
);
// Register Editor Contributions
registerEditorContribution
(
OpenWorkspaceButtonContribution
);
registerEditorContribution
(
OpenWorkspaceButtonContribution
.
ID
,
OpenWorkspaceButtonContribution
);
// Register Editor Status
Registry
.
as
<
IWorkbenchContributionsRegistry
>
(
WorkbenchExtensions
.
Workbench
).
registerWorkbenchContribution
(
EditorStatus
,
LifecyclePhase
.
Ready
);
...
...
src/vs/workbench/browser/parts/editor/editorWidgets.ts
浏览文件 @
48024f70
...
...
@@ -101,7 +101,7 @@ export class OpenWorkspaceButtonContribution extends Disposable implements IEdit
return
editor
.
getContribution
<
OpenWorkspaceButtonContribution
>
(
OpenWorkspaceButtonContribution
.
ID
);
}
p
rivate
static
readonly
ID
=
'
editor.contrib.openWorkspaceButton
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.openWorkspaceButton
'
;
private
openWorkspaceButton
:
FloatingClickWidget
|
undefined
;
...
...
@@ -122,10 +122,6 @@ export class OpenWorkspaceButtonContribution extends Disposable implements IEdit
this
.
_register
(
this
.
editor
.
onDidChangeModel
(
e
=>
this
.
update
()));
}
getId
():
string
{
return
OpenWorkspaceButtonContribution
.
ID
;
}
private
update
():
void
{
if
(
!
this
.
shouldShowButton
(
this
.
editor
))
{
this
.
disposeOpenWorkspaceWidgetRenderer
();
...
...
src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.ts
浏览文件 @
48024f70
...
...
@@ -59,10 +59,6 @@ class CallHierarchyController implements IEditorContribution {
this
.
_dispoables
.
dispose
();
}
getId
():
string
{
return
CallHierarchyController
.
Id
;
}
async
startCallHierarchy
():
Promise
<
void
>
{
this
.
_sessionDisposables
.
clear
();
...
...
@@ -115,7 +111,7 @@ class CallHierarchyController implements IEditorContribution {
}
}
registerEditorContribution
(
CallHierarchyController
);
registerEditorContribution
(
CallHierarchyController
.
Id
,
CallHierarchyController
);
registerEditorAction
(
class
extends
EditorAction
{
...
...
src/vs/workbench/contrib/codeEditor/browser/accessibility/accessibility.ts
浏览文件 @
48024f70
...
...
@@ -35,7 +35,7 @@ const CONTEXT_ACCESSIBILITY_WIDGET_VISIBLE = new RawContextKey<boolean>('accessi
class
AccessibilityHelpController
extends
Disposable
implements
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.accessibilityHelpController
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.accessibilityHelpController
'
;
public
static
get
(
editor
:
ICodeEditor
):
AccessibilityHelpController
{
return
editor
.
getContribution
<
AccessibilityHelpController
>
(
AccessibilityHelpController
.
ID
);
...
...
@@ -54,10 +54,6 @@ class AccessibilityHelpController extends Disposable implements IEditorContribut
this
.
_widget
=
this
.
_register
(
instantiationService
.
createInstance
(
AccessibilityHelpWidget
,
this
.
_editor
));
}
public
getId
():
string
{
return
AccessibilityHelpController
.
ID
;
}
public
show
():
void
{
this
.
_widget
.
show
();
}
...
...
@@ -299,7 +295,7 @@ class ShowAccessibilityHelpAction extends EditorAction {
}
}
registerEditorContribution
(
AccessibilityHelpController
);
registerEditorContribution
(
AccessibilityHelpController
.
ID
,
AccessibilityHelpController
);
registerEditorAction
(
ShowAccessibilityHelpAction
);
const
AccessibilityHelpCommand
=
EditorCommand
.
bindToContribution
<
AccessibilityHelpController
>
(
AccessibilityHelpController
.
get
);
...
...
src/vs/workbench/contrib/codeEditor/browser/diffEditorHelper.ts
浏览文件 @
48024f70
...
...
@@ -6,7 +6,7 @@
import
*
as
nls
from
'
vs/nls
'
;
import
{
IDiffEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
registerDiffEditorContribution
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
IEditorContribution
}
from
'
vs/editor/common/editorCommon
'
;
import
{
I
Diff
EditorContribution
}
from
'
vs/editor/common/editorCommon
'
;
import
{
Disposable
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
FloatingClickWidget
}
from
'
vs/workbench/browser/parts/editor/editorWidgets
'
;
import
{
IDiffComputationResult
}
from
'
vs/editor/common/services/editorWorkerService
'
;
...
...
@@ -19,7 +19,9 @@ const enum WidgetState {
HintWhitespace
}
class
DiffEditorHelperContribution
extends
Disposable
implements
IEditorContribution
{
class
DiffEditorHelperContribution
extends
Disposable
implements
IDiffEditorContribution
{
public
static
ID
=
'
editor.contrib.diffEditorHelper
'
;
private
_helperWidget
:
FloatingClickWidget
|
null
;
private
_helperWidgetListener
:
IDisposable
|
null
;
...
...
@@ -99,10 +101,6 @@ class DiffEditorHelperContribution extends Disposable implements IEditorContribu
dispose
():
void
{
super
.
dispose
();
}
getId
():
string
{
return
'
editor.contrib.diffEditorHelper
'
;
}
}
registerDiffEditorContribution
(
DiffEditorHelperContribution
);
registerDiffEditorContribution
(
DiffEditorHelperContribution
.
ID
,
DiffEditorHelperContribution
);
src/vs/workbench/contrib/codeEditor/browser/inspectTMScopes/inspectTMScopes.ts
浏览文件 @
48024f70
...
...
@@ -27,7 +27,7 @@ import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/work
class
InspectTMScopesController
extends
Disposable
implements
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.inspectTMScopes
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.inspectTMScopes
'
;
public
static
get
(
editor
:
ICodeEditor
):
InspectTMScopesController
{
return
editor
.
getContribution
<
InspectTMScopesController
>
(
InspectTMScopesController
.
ID
);
...
...
@@ -60,10 +60,6 @@ class InspectTMScopesController extends Disposable implements IEditorContributio
this
.
_register
(
this
.
_editor
.
onKeyUp
((
e
)
=>
e
.
keyCode
===
KeyCode
.
Escape
&&
this
.
stop
()));
}
public
getId
():
string
{
return
InspectTMScopesController
.
ID
;
}
public
dispose
():
void
{
this
.
stop
();
super
.
dispose
();
...
...
@@ -374,7 +370,7 @@ class InspectTMScopesWidget extends Disposable implements IContentWidget {
}
}
registerEditorContribution
(
InspectTMScopesController
);
registerEditorContribution
(
InspectTMScopesController
.
ID
,
InspectTMScopesController
);
registerEditorAction
(
InspectTMScopes
);
registerThemingParticipant
((
theme
,
collector
)
=>
{
...
...
src/vs/workbench/contrib/codeEditor/browser/largeFileOptimizations.ts
浏览文件 @
48024f70
...
...
@@ -17,7 +17,7 @@ import { INotificationService, Severity } from 'vs/platform/notification/common/
*/
export
class
LargeFileOptimizationsWarner
extends
Disposable
implements
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.largeFileOptimizationsWarner
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.largeFileOptimizationsWarner
'
;
constructor
(
private
readonly
_editor
:
ICodeEditor
,
...
...
@@ -60,10 +60,6 @@ export class LargeFileOptimizationsWarner extends Disposable implements IEditorC
}
}));
}
public
getId
():
string
{
return
LargeFileOptimizationsWarner
.
ID
;
}
}
registerEditorContribution
(
LargeFileOptimizationsWarner
);
registerEditorContribution
(
LargeFileOptimizationsWarner
.
ID
,
LargeFileOptimizationsWarner
);
src/vs/workbench/contrib/codeEditor/browser/menuPreventer.ts
浏览文件 @
48024f70
...
...
@@ -14,7 +14,7 @@ import { IEditorContribution } from 'vs/editor/common/editorCommon';
*/
export
class
MenuPreventer
extends
Disposable
implements
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.menuPreventer
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.menuPreventer
'
;
private
_editor
:
ICodeEditor
;
private
_altListeningMouse
:
boolean
;
...
...
@@ -55,10 +55,6 @@ export class MenuPreventer extends Disposable implements IEditorContribution {
}
}));
}
public
getId
():
string
{
return
MenuPreventer
.
ID
;
}
}
registerEditorContribution
(
MenuPreventer
);
registerEditorContribution
(
MenuPreventer
.
ID
,
MenuPreventer
);
src/vs/workbench/contrib/codeEditor/browser/selectionClipboard.ts
浏览文件 @
48024f70
...
...
@@ -17,7 +17,7 @@ import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService
export
class
SelectionClipboard
extends
Disposable
implements
IEditorContribution
{
private
static
readonly
SELECTION_LENGTH_LIMIT
=
65536
;
p
rivate
static
readonly
ID
=
'
editor.contrib.selectionClipboard
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.selectionClipboard
'
;
constructor
(
editor
:
ICodeEditor
,
@
IClipboardService
clipboardService
:
IClipboardService
)
{
super
();
...
...
@@ -87,13 +87,9 @@ export class SelectionClipboard extends Disposable implements IEditorContributio
}
}
public
getId
():
string
{
return
SelectionClipboard
.
ID
;
}
public
dispose
():
void
{
super
.
dispose
();
}
}
registerEditorContribution
(
SelectionClipboard
);
registerEditorContribution
(
SelectionClipboard
.
ID
,
SelectionClipboard
);
src/vs/workbench/contrib/codeEditor/browser/simpleEditorOptions.ts
浏览文件 @
48024f70
...
...
@@ -41,12 +41,12 @@ export function getSimpleCodeEditorWidgetOptions(): ICodeEditorWidgetOptions {
return
{
isSimpleWidget
:
true
,
contributions
:
[
MenuPreventer
,
SelectionClipboard
,
ContextMenuController
,
SuggestController
,
SnippetController2
,
TabCompletionController
,
{
id
:
MenuPreventer
.
ID
,
ctor
:
MenuPreventer
}
,
{
id
:
SelectionClipboard
.
ID
,
ctor
:
SelectionClipboard
}
,
{
id
:
ContextMenuController
.
ID
,
ctor
:
ContextMenuController
}
,
{
id
:
SuggestController
.
ID
,
ctor
:
SuggestController
}
,
{
id
:
SnippetController2
.
ID
,
ctor
:
SnippetController2
}
,
{
id
:
TabCompletionController
.
ID
,
ctor
:
TabCompletionController
}
,
]
};
}
src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.ts
浏览文件 @
48024f70
...
...
@@ -130,7 +130,13 @@ export class SuggestEnabledInput extends Widget implements IThemable {
this
.
inputWidget
=
instantiationService
.
createInstance
(
CodeEditorWidget
,
this
.
stylingContainer
,
editorOptions
,
{
contributions
:
[
SuggestController
,
SnippetController2
,
ContextMenuController
,
MenuPreventer
,
SelectionClipboard
],
contributions
:
[
{
id
:
SuggestController
.
ID
,
ctor
:
SuggestController
},
{
id
:
SnippetController2
.
ID
,
ctor
:
SnippetController2
},
{
id
:
ContextMenuController
.
ID
,
ctor
:
ContextMenuController
},
{
id
:
MenuPreventer
.
ID
,
ctor
:
MenuPreventer
},
{
id
:
SelectionClipboard
.
ID
,
ctor
:
SelectionClipboard
}
],
isSimpleWidget
:
true
,
});
this
.
_register
(
this
.
inputWidget
);
...
...
src/vs/workbench/contrib/codeEditor/browser/toggleWordWrap.ts
浏览文件 @
48024f70
...
...
@@ -166,7 +166,7 @@ class ToggleWordWrapAction extends EditorAction {
class
ToggleWordWrapController
extends
Disposable
implements
IEditorContribution
{
p
rivate
static
readonly
_
ID
=
'
editor.contrib.toggleWordWrapController
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.toggleWordWrapController
'
;
constructor
(
private
readonly
editor
:
ICodeEditor
,
...
...
@@ -254,10 +254,6 @@ class ToggleWordWrapController extends Disposable implements IEditorContribution
wordWrapMinified
:
state
.
configuredWordWrapMinified
});
}
public
getId
():
string
{
return
ToggleWordWrapController
.
_ID
;
}
}
function
canToggleWordWrap
(
uri
:
URI
):
boolean
{
...
...
@@ -268,7 +264,7 @@ function canToggleWordWrap(uri: URI): boolean {
}
registerEditorContribution
(
ToggleWordWrapController
);
registerEditorContribution
(
ToggleWordWrapController
.
ID
,
ToggleWordWrapController
);
registerEditorAction
(
ToggleWordWrapAction
);
...
...
src/vs/workbench/contrib/codeEditor/browser/workbenchReferenceSearch.ts
浏览文件 @
48024f70
...
...
@@ -37,4 +37,4 @@ export class WorkbenchReferencesController extends ReferencesController {
}
}
registerEditorContribution
(
WorkbenchReferencesController
);
registerEditorContribution
(
ReferencesController
.
ID
,
WorkbenchReferencesController
);
src/vs/workbench/contrib/comments/browser/commentsEditorContribution.ts
浏览文件 @
48024f70
...
...
@@ -314,10 +314,6 @@ export class CommentController implements IEditorContribution {
}
}
public
getId
():
string
{
return
ID
;
}
public
dispose
():
void
{
this
.
globalToDispose
.
dispose
();
this
.
localToDispose
.
dispose
();
...
...
@@ -694,7 +690,7 @@ export class NextCommentThreadAction extends EditorAction {
}
registerEditorContribution
(
CommentController
);
registerEditorContribution
(
ID
,
CommentController
);
registerEditorAction
(
NextCommentThreadAction
);
CommandsRegistry
.
registerCommand
({
...
...
src/vs/workbench/contrib/comments/browser/simpleCommentEditor.ts
浏览文件 @
48024f70
...
...
@@ -48,11 +48,11 @@ export class SimpleCommentEditor extends CodeEditorWidget {
)
{
const
codeEditorWidgetOptions
=
{
contributions
:
[
MenuPreventer
,
ContextMenuController
,
SuggestController
,
SnippetController2
,
TabCompletionController
,
{
id
:
MenuPreventer
.
ID
,
ctor
:
MenuPreventer
}
,
{
id
:
ContextMenuController
.
ID
,
ctor
:
ContextMenuController
}
,
{
id
:
SuggestController
.
ID
,
ctor
:
SuggestController
}
,
{
id
:
SnippetController2
.
ID
,
ctor
:
SnippetController2
}
,
{
id
:
TabCompletionController
.
ID
,
ctor
:
TabCompletionController
}
,
]
};
...
...
src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts
浏览文件 @
48024f70
...
...
@@ -145,10 +145,6 @@ class BreakpointEditorContribution implements IBreakpointEditorContribution {
this
.
setDecorationsScheduler
=
new
RunOnceScheduler
(()
=>
this
.
setDecorations
(),
30
);
}
getId
():
string
{
return
BREAKPOINT_EDITOR_CONTRIBUTION_ID
;
}
private
registerListeners
():
void
{
this
.
toDispose
.
push
(
this
.
editor
.
onMouseDown
(
async
(
e
:
IEditorMouseEvent
)
=>
{
const
data
=
e
.
target
.
detail
as
IMarginData
;
...
...
@@ -587,4 +583,4 @@ class InlineBreakpointWidget implements IContentWidget, IDisposable {
}
}
registerEditorContribution
(
BreakpointEditorContribution
);
registerEditorContribution
(
B
REAKPOINT_EDITOR_CONTRIBUTION_ID
,
B
reakpointEditorContribution
);
src/vs/workbench/contrib/debug/browser/debugEditorContribution.ts
浏览文件 @
48024f70
...
...
@@ -141,10 +141,6 @@ class DebugEditorContribution implements IDebugEditorContribution {
}
}
getId
():
string
{
return
EDITOR_CONTRIBUTION_ID
;
}
async
showHover
(
range
:
Range
,
focus
:
boolean
):
Promise
<
void
>
{
const
sf
=
this
.
debugService
.
getViewModel
().
focusedStackFrame
;
const
model
=
this
.
editor
.
getModel
();
...
...
@@ -545,4 +541,4 @@ class DebugEditorContribution implements IDebugEditorContribution {
}
}
registerEditorContribution
(
DebugEditorContribution
);
registerEditorContribution
(
EDITOR_CONTRIBUTION_ID
,
DebugEditorContribution
);
src/vs/workbench/contrib/preferences/browser/keybindingsEditorContribution.ts
浏览文件 @
48024f70
...
...
@@ -38,7 +38,7 @@ const INTERESTING_FILE = /keybindings\.json$/;
export
class
DefineKeybindingController
extends
Disposable
implements
editorCommon
.
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.defineKeybinding
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.defineKeybinding
'
;
static
get
(
editor
:
ICodeEditor
):
DefineKeybindingController
{
return
editor
.
getContribution
<
DefineKeybindingController
>
(
DefineKeybindingController
.
ID
);
...
...
@@ -57,10 +57,6 @@ export class DefineKeybindingController extends Disposable implements editorComm
this
.
_update
();
}
getId
():
string
{
return
DefineKeybindingController
.
ID
;
}
get
keybindingWidgetRenderer
():
KeybindingWidgetRenderer
|
undefined
{
return
this
.
_keybindingWidgetRenderer
;
}
...
...
@@ -385,5 +381,5 @@ function isInterestingEditorModel(editor: ICodeEditor): boolean {
return
INTERESTING_FILE
.
test
(
url
);
}
registerEditorContribution
(
DefineKeybindingController
);
registerEditorContribution
(
DefineKeybindingController
.
ID
,
DefineKeybindingController
);
registerEditorCommand
(
new
DefineKeybindingCommand
());
src/vs/workbench/contrib/preferences/browser/preferencesEditor.ts
浏览文件 @
48024f70
...
...
@@ -17,7 +17,7 @@ import { Disposable, dispose, IDisposable } from 'vs/base/common/lifecycle';
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
EditorExtensionsRegistry
,
IEditorContributionCtor
,
registerEditorContribu
tion
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
EditorExtensionsRegistry
,
registerEditorContribution
,
IEditorContributionDescrip
tion
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
CodeEditorWidget
}
from
'
vs/editor/browser/widget/codeEditorWidget
'
;
import
{
IEditorOptions
}
from
'
vs/editor/common/config/editorOptions
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
...
...
@@ -986,10 +986,10 @@ export class DefaultPreferencesEditor extends BaseTextEditor {
super
(
DefaultPreferencesEditor
.
ID
,
telemetryService
,
instantiationService
,
storageService
,
configurationService
,
themeService
,
textFileService
,
editorService
,
editorGroupService
,
hostService
);
}
private
static
_getContributions
():
IEditorContribution
Ctor
[]
{
const
skipContributions
=
[
FoldingController
.
prototype
,
SelectionHighlighter
.
prototype
,
FindController
.
prototype
];
const
contributions
=
EditorExtensionsRegistry
.
getEditorContributions
().
filter
(
c
=>
skipContributions
.
indexOf
(
c
.
prototype
)
===
-
1
);
contributions
.
push
(
DefaultSettingsEditorContribution
);
private
static
_getContributions
():
IEditorContribution
Description
[]
{
const
skipContributions
=
[
FoldingController
.
ID
,
SelectionHighlighter
.
ID
,
FindController
.
ID
];
const
contributions
=
EditorExtensionsRegistry
.
getEditorContributions
().
filter
(
c
=>
skipContributions
.
indexOf
(
c
.
id
)
===
-
1
);
contributions
.
push
(
{
id
:
DefaultSettingsEditorContribution
.
ID
,
ctor
:
DefaultSettingsEditorContribution
}
);
return
contributions
;
}
...
...
@@ -1158,17 +1158,12 @@ abstract class AbstractSettingsEditorContribution extends Disposable implements
}
protected
abstract
_createPreferencesRenderer
():
Promise
<
IPreferencesRenderer
<
ISetting
>
|
null
>
|
null
;
abstract
getId
():
string
;
}
export
class
DefaultSettingsEditorContribution
extends
AbstractSettingsEditorContribution
implements
ISettingsEditorContribution
{
static
readonly
ID
:
string
=
'
editor.contrib.defaultsettings
'
;
getId
():
string
{
return
DefaultSettingsEditorContribution
.
ID
;
}
protected
_createPreferencesRenderer
():
Promise
<
IPreferencesRenderer
<
ISetting
>
|
null
>
|
null
{
return
this
.
preferencesService
.
createPreferencesEditorModel
(
this
.
editor
.
getModel
()
!
.
uri
)
.
then
<
any
>
(
editorModel
=>
{
...
...
@@ -1195,10 +1190,6 @@ class SettingsEditorContribution extends AbstractSettingsEditorContribution impl
this
.
_register
(
this
.
workspaceContextService
.
onDidChangeWorkbenchState
(()
=>
this
.
_onModelChanged
()));
}
getId
():
string
{
return
SettingsEditorContribution
.
ID
;
}
protected
_createPreferencesRenderer
():
Promise
<
IPreferencesRenderer
<
ISetting
>
|
null
>
|
null
{
const
model
=
this
.
editor
.
getModel
();
if
(
model
)
{
...
...
@@ -1228,4 +1219,4 @@ class SettingsEditorContribution extends AbstractSettingsEditorContribution impl
}
}
registerEditorContribution
(
SettingsEditorContribution
);
registerEditorContribution
(
SettingsEditorContribution
.
ID
,
SettingsEditorContribution
);
src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.ts
浏览文件 @
48024f70
...
...
@@ -556,7 +556,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
export
class
DirtyDiffController
extends
Disposable
implements
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.contrib.dirtydiff
'
;
p
ublic
static
readonly
ID
=
'
editor.contrib.dirtydiff
'
;
static
get
(
editor
:
ICodeEditor
):
DirtyDiffController
{
return
editor
.
getContribution
<
DirtyDiffController
>
(
DirtyDiffController
.
ID
);
...
...
@@ -588,10 +588,6 @@ export class DirtyDiffController extends Disposable implements IEditorContributi
}
}
getId
():
string
{
return
DirtyDiffController
.
ID
;
}
canNavigate
():
boolean
{
return
this
.
currentIndex
===
-
1
||
(
!!
this
.
model
&&
this
.
model
.
changes
.
length
>
1
);
}
...
...
@@ -1319,7 +1315,7 @@ export class DirtyDiffWorkbenchController extends Disposable implements ext.IWor
}
}
registerEditorContribution
(
DirtyDiffController
);
registerEditorContribution
(
DirtyDiffController
.
ID
,
DirtyDiffController
);
registerThemingParticipant
((
theme
:
ITheme
,
collector
:
ICssStyleCollector
)
=>
{
const
editorGutterModifiedBackgroundColor
=
theme
.
getColor
(
editorGutterModifiedBackground
);
...
...
src/vs/workbench/contrib/snippets/browser/tabCompletion.ts
浏览文件 @
48024f70
...
...
@@ -23,7 +23,7 @@ import { EditorOption } from 'vs/editor/common/config/editorOptions';
export
class
TabCompletionController
implements
editorCommon
.
IEditorContribution
{
p
rivate
static
readonly
ID
=
'
editor.tabCompletionController
'
;
p
ublic
static
readonly
ID
=
'
editor.tabCompletionController
'
;
static
readonly
ContextKey
=
new
RawContextKey
<
boolean
>
(
'
hasSnippetCompletions
'
,
undefined
);
public
static
get
(
editor
:
ICodeEditor
):
TabCompletionController
{
...
...
@@ -50,10 +50,6 @@ export class TabCompletionController implements editorCommon.IEditorContribution
this
.
_update
();
}
getId
():
string
{
return
TabCompletionController
.
ID
;
}
dispose
():
void
{
dispose
(
this
.
_configListener
);
dispose
(
this
.
_selectionListener
);
...
...
@@ -143,7 +139,7 @@ export class TabCompletionController implements editorCommon.IEditorContribution
}
}
registerEditorContribution
(
TabCompletionController
);
registerEditorContribution
(
TabCompletionController
.
ID
,
TabCompletionController
);
const
TabCompletionCommand
=
EditorCommand
.
bindToContribution
<
TabCompletionController
>
(
TabCompletionController
.
get
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录