Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
fb043c53
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,发现更多精彩内容 >>
未验证
提交
fb043c53
编写于
10月 12, 2019
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add DiffEditor contributions
上级
72a57179
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
51 addition
and
6 deletion
+51
-6
src/vs/editor/browser/editorExtensions.ts
src/vs/editor/browser/editorExtensions.ts
+25
-6
src/vs/editor/browser/widget/diffEditorWidget.ts
src/vs/editor/browser/widget/diffEditorWidget.ts
+11
-0
src/vs/editor/common/editorCommon.ts
src/vs/editor/common/editorCommon.ts
+15
-0
未找到文件。
src/vs/editor/browser/editorExtensions.ts
浏览文件 @
fb043c53
...
...
@@ -6,10 +6,10 @@
import
{
IPosition
}
from
'
vs/base/browser/ui/contextview/contextview
'
;
import
{
illegalArgument
}
from
'
vs/base/common/errors
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
ICodeEditor
,
IDiffEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
ICodeEditorService
}
from
'
vs/editor/browser/services/codeEditorService
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
IEditorContribution
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IEditorContribution
,
IDiffEditorContribution
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
ITextModelService
}
from
'
vs/editor/common/services/resolverService
'
;
...
...
@@ -24,6 +24,7 @@ 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
,
};
...
...
@@ -300,6 +301,10 @@ export function registerEditorContribution(ctor: IEditorContributionCtor): void
EditorContributionRegistry
.
INSTANCE
.
registerEditorContribution
(
ctor
);
}
export
function
registerDiffEditorContribution
(
ctor
:
IDiffEditorContributionCtor
):
void
{
EditorContributionRegistry
.
INSTANCE
.
registerDiffEditorContribution
(
ctor
);
}
export
namespace
EditorExtensionsRegistry
{
export
function
getEditorCommand
(
commandId
:
string
):
EditorCommand
{
...
...
@@ -313,6 +318,10 @@ export namespace EditorExtensionsRegistry {
export
function
getEditorContributions
():
IEditorContributionCtor
[]
{
return
EditorContributionRegistry
.
INSTANCE
.
getEditorContributions
();
}
export
function
getDiffEditorContributions
():
IDiffEditorContributionCtor
[]
{
return
EditorContributionRegistry
.
INSTANCE
.
getDiffEditorContributions
();
}
}
// Editor extension points
...
...
@@ -325,11 +334,13 @@ class EditorContributionRegistry {
public
static
readonly
INSTANCE
=
new
EditorContributionRegistry
();
private
readonly
editorContributions
:
IEditorContributionCtor
[];
private
readonly
diffEditorContributions
:
IDiffEditorContributionCtor
[];
private
readonly
editorActions
:
EditorAction
[];
private
readonly
editorCommands
:
{
[
commandId
:
string
]:
EditorCommand
;
};
constructor
()
{
this
.
editorContributions
=
[];
this
.
diffEditorContributions
=
[];
this
.
editorActions
=
[];
this
.
editorCommands
=
Object
.
create
(
null
);
}
...
...
@@ -338,15 +349,23 @@ class EditorContributionRegistry {
this
.
editorContributions
.
push
(
ctor
);
}
public
getEditorContributions
():
IEditorContributionCtor
[]
{
return
this
.
editorContributions
.
slice
(
0
);
}
public
registerDiffEditorContribution
(
ctor
:
IDiffEditorContributionCtor
):
void
{
this
.
diffEditorContributions
.
push
(
ctor
);
}
public
getDiffEditorContributions
():
IDiffEditorContributionCtor
[]
{
return
this
.
diffEditorContributions
.
slice
(
0
);
}
public
registerEditorAction
(
action
:
EditorAction
)
{
action
.
register
();
this
.
editorActions
.
push
(
action
);
}
public
getEditorContributions
():
IEditorContributionCtor
[]
{
return
this
.
editorContributions
.
slice
(
0
);
}
public
getEditorActions
():
EditorAction
[]
{
return
this
.
editorActions
.
slice
(
0
);
}
...
...
src/vs/editor/browser/widget/diffEditorWidget.ts
浏览文件 @
fb043c53
...
...
@@ -44,6 +44,8 @@ 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
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
interface
IEditorDiffDecorations
{
decorations
:
IModelDeltaDecoration
[];
...
...
@@ -365,6 +367,15 @@ export class DiffEditorWidget extends Disposable implements editorBrowser.IDiffE
this
.
_containerDomElement
.
className
=
DiffEditorWidget
.
_getClassName
(
this
.
_themeService
.
getTheme
(),
this
.
_renderSideBySide
);
}));
const
contributions
:
IDiffEditorContributionCtor
[]
=
EditorExtensionsRegistry
.
getDiffEditorContributions
();
for
(
const
ctor
of
contributions
)
{
try
{
this
.
_register
(
instantiationService
.
createInstance
(
ctor
,
this
));
}
catch
(
err
)
{
onUnexpectedError
(
err
);
}
}
this
.
_codeEditorService
.
addDiffEditor
(
this
);
}
...
...
src/vs/editor/common/editorCommon.ts
浏览文件 @
fb043c53
...
...
@@ -506,6 +506,21 @@ export interface IEditorContribution {
restoreViewState
?(
state
:
any
):
void
;
}
/**
* A diff editor contribution that gets created every time a new diffeditor gets created and gets disposed when the diff editor gets disposed.
* @internal
*/
export
interface
IDiffEditorContribution
{
/**
* Get a unique identifier for this contribution.
*/
getId
():
string
;
/**
* Dispose this contribution.
*/
dispose
():
void
;
}
/**
* @internal
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录