Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
79a7e306
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,发现更多精彩内容 >>
提交
79a7e306
编写于
3月 24, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
✨
ICodeEditorService.listDiffEditors()
上级
c956b4a7
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
73 addition
and
23 deletion
+73
-23
src/vs/editor/browser/standalone/standaloneCodeEditor.ts
src/vs/editor/browser/standalone/standaloneCodeEditor.ts
+3
-2
src/vs/editor/browser/standalone/standaloneEditor.ts
src/vs/editor/browser/standalone/standaloneEditor.ts
+2
-1
src/vs/editor/browser/widget/diffEditorWidget.ts
src/vs/editor/browser/widget/diffEditorWidget.ts
+9
-1
src/vs/editor/common/services/abstractCodeEditorService.ts
src/vs/editor/common/services/abstractCodeEditorService.ts
+49
-15
src/vs/editor/common/services/codeEditorService.ts
src/vs/editor/common/services/codeEditorService.ts
+10
-4
未找到文件。
src/vs/editor/browser/standalone/standaloneCodeEditor.ts
浏览文件 @
79a7e306
...
...
@@ -280,14 +280,15 @@ export class StandaloneDiffEditor extends DiffEditorWidget implements IStandalon
@
IKeybindingService
keybindingService
:
IKeybindingService
,
@
IContextViewService
contextViewService
:
IContextViewService
,
@
IStandaloneThemeService
standaloneColorService
:
IStandaloneThemeService
,
@
IEditorWorkerService
editorWorkerService
:
IEditorWorkerService
@
IEditorWorkerService
editorWorkerService
:
IEditorWorkerService
,
@
ICodeEditorService
codeEditorService
:
ICodeEditorService
)
{
options
=
options
||
{};
if
(
typeof
options
.
theme
===
'
string
'
)
{
options
.
theme
=
standaloneColorService
.
setTheme
(
options
.
theme
);
}
super
(
domElement
,
options
,
editorWorkerService
,
contextKeyService
,
instantiationService
);
super
(
domElement
,
options
,
editorWorkerService
,
contextKeyService
,
instantiationService
,
codeEditorService
);
if
(
keybindingService
instanceof
StandaloneKeybindingService
)
{
this
.
_standaloneKeybindingService
=
keybindingService
;
...
...
src/vs/editor/browser/standalone/standaloneEditor.ts
浏览文件 @
79a7e306
...
...
@@ -124,7 +124,8 @@ export function createDiffEditor(domElement: HTMLElement, options?: IDiffEditorC
services
.
get
(
IKeybindingService
),
services
.
get
(
IContextViewService
),
services
.
get
(
IStandaloneThemeService
),
services
.
get
(
IEditorWorkerService
)
services
.
get
(
IEditorWorkerService
),
services
.
get
(
ICodeEditorService
)
);
});
}
...
...
src/vs/editor/browser/widget/diffEditorWidget.ts
浏览文件 @
79a7e306
...
...
@@ -15,6 +15,7 @@ import { FastDomNode, createFastDomNode } from 'vs/base/browser/fastDomNode';
import
{
ISashEvent
,
IVerticalSashLayoutProvider
,
Sash
}
from
'
vs/base/browser/ui/sash/sash
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
ICodeEditorService
}
from
'
vs/editor/common/services/codeEditorService
'
;
import
{
DefaultConfig
}
from
'
vs/editor/common/config/defaultConfig
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
...
...
@@ -204,16 +205,19 @@ export class DiffEditorWidget extends EventEmitter implements editorBrowser.IDif
private
_editorWorkerService
:
IEditorWorkerService
;
protected
_contextKeyService
:
IContextKeyService
;
private
_codeEditorService
:
ICodeEditorService
;
constructor
(
domElement
:
HTMLElement
,
options
:
editorCommon
.
IDiffEditorOptions
,
@
IEditorWorkerService
editorWorkerService
:
IEditorWorkerService
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IInstantiationService
instantiationService
:
IInstantiationService
@
IInstantiationService
instantiationService
:
IInstantiationService
,
@
ICodeEditorService
codeEditorService
:
ICodeEditorService
)
{
super
();
this
.
_editorWorkerService
=
editorWorkerService
;
this
.
_codeEditorService
=
codeEditorService
;
this
.
_contextKeyService
=
contextKeyService
.
createScoped
(
domElement
);
this
.
_contextKeyService
.
createKey
(
'
isInDiffEditor
'
,
true
);
...
...
@@ -314,6 +318,8 @@ export class DiffEditorWidget extends EventEmitter implements editorBrowser.IDif
}
else
{
this
.
_setStrategy
(
new
DiffEdtorWidgetInline
(
this
.
_createDataSource
(),
this
.
_enableSplitViewResizing
));
}
this
.
_codeEditorService
.
addDiffEditor
(
this
);
}
public
get
ignoreTrimWhitespace
():
boolean
{
...
...
@@ -392,6 +398,8 @@ export class DiffEditorWidget extends EventEmitter implements editorBrowser.IDif
}
public
dispose
():
void
{
this
.
_codeEditorService
.
removeDiffEditor
(
this
);
this
.
_toDispose
=
dispose
(
this
.
_toDispose
);
window
.
clearInterval
(
this
.
_measureDomElementToken
);
...
...
src/vs/editor/common/services/abstractCodeEditorService.ts
浏览文件 @
79a7e306
...
...
@@ -5,51 +5,85 @@
'
use strict
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
ICommonCodeEditor
,
IDecorationRenderOptions
,
IModelDecorationOptions
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICommonCodeEditor
,
I
CommonDiffEditor
,
I
DecorationRenderOptions
,
IModelDecorationOptions
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICodeEditorService
}
from
'
vs/editor/common/services/codeEditorService
'
;
export
abstract
class
AbstractCodeEditorService
implements
ICodeEditorService
{
public
_serviceBrand
:
any
;
_serviceBrand
:
any
;
private
_onCodeEditorAdd
:
Emitter
<
ICommonCodeEditor
>
;
private
_onCodeEditorRemove
:
Emitter
<
ICommonCodeEditor
>
;
private
_codeEditors
:
{
[
editorId
:
string
]:
ICommonCodeEditor
;
};
private
_codeEditors
:
{
[
editorId
:
string
]:
ICommonCodeEditor
;
};
private
_onDiffEditorAdd
:
Emitter
<
ICommonDiffEditor
>
;
private
_onDiffEditorRemove
:
Emitter
<
ICommonDiffEditor
>
;
private
_diffEditors
:
{
[
editorId
:
string
]:
ICommonDiffEditor
;
};
constructor
()
{
this
.
_codeEditors
=
Object
.
create
(
null
);
this
.
_diffEditors
=
Object
.
create
(
null
);
this
.
_onCodeEditorAdd
=
new
Emitter
<
ICommonCodeEditor
>
();
this
.
_onCodeEditorRemove
=
new
Emitter
<
ICommonCodeEditor
>
();
this
.
_onDiffEditorAdd
=
new
Emitter
<
ICommonDiffEditor
>
();
this
.
_onDiffEditorRemove
=
new
Emitter
<
ICommonDiffEditor
>
();
}
public
addCodeEditor
(
editor
:
ICommonCodeEditor
):
void
{
addCodeEditor
(
editor
:
ICommonCodeEditor
):
void
{
this
.
_codeEditors
[
editor
.
getId
()]
=
editor
;
this
.
_onCodeEditorAdd
.
fire
(
editor
);
}
public
get
onCodeEditorAdd
():
Event
<
ICommonCodeEditor
>
{
get
onCodeEditorAdd
():
Event
<
ICommonCodeEditor
>
{
return
this
.
_onCodeEditorAdd
.
event
;
}
public
removeCodeEditor
(
editor
:
ICommonCodeEditor
):
void
{
removeCodeEditor
(
editor
:
ICommonCodeEditor
):
void
{
if
(
delete
this
.
_codeEditors
[
editor
.
getId
()])
{
this
.
_onCodeEditorRemove
.
fire
(
editor
);
}
}
public
get
onCodeEditorRemove
():
Event
<
ICommonCodeEditor
>
{
get
onCodeEditorRemove
():
Event
<
ICommonCodeEditor
>
{
return
this
.
_onCodeEditorRemove
.
event
;
}
public
getCodeEditor
(
editorId
:
string
):
ICommonCodeEditor
{
getCodeEditor
(
editorId
:
string
):
ICommonCodeEditor
{
return
this
.
_codeEditors
[
editorId
]
||
null
;
}
public
listCodeEditors
():
ICommonCodeEditor
[]
{
listCodeEditors
():
ICommonCodeEditor
[]
{
return
Object
.
keys
(
this
.
_codeEditors
).
map
(
id
=>
this
.
_codeEditors
[
id
]);
}
public
getFocusedCodeEditor
():
ICommonCodeEditor
{
addDiffEditor
(
editor
:
ICommonDiffEditor
):
void
{
this
.
_diffEditors
[
editor
.
getId
()]
=
editor
;
this
.
_onDiffEditorAdd
.
fire
(
editor
);
}
get
onDiffEditorAdd
():
Event
<
ICommonDiffEditor
>
{
return
this
.
_onDiffEditorAdd
.
event
;
}
removeDiffEditor
(
editor
:
ICommonDiffEditor
):
void
{
if
(
delete
this
.
_diffEditors
[
editor
.
getId
()])
{
this
.
_onDiffEditorRemove
.
fire
(
editor
);
}
}
get
onDiffEditorRemove
():
Event
<
ICommonDiffEditor
>
{
return
this
.
_onDiffEditorRemove
.
event
;
}
getDiffEditor
(
editorId
:
string
):
ICommonDiffEditor
{
return
this
.
_diffEditors
[
editorId
]
||
null
;
}
listDiffEditors
():
ICommonDiffEditor
[]
{
return
Object
.
keys
(
this
.
_diffEditors
).
map
(
id
=>
this
.
_diffEditors
[
id
]);
}
getFocusedCodeEditor
():
ICommonCodeEditor
{
let
editorWithWidgetFocus
:
ICommonCodeEditor
=
null
;
let
editors
=
this
.
listCodeEditors
();
...
...
@@ -69,7 +103,7 @@ export abstract class AbstractCodeEditorService implements ICodeEditorService {
return
editorWithWidgetFocus
;
}
public
abstract
registerDecorationType
(
key
:
string
,
options
:
IDecorationRenderOptions
,
parentTypeKey
?:
string
):
void
;
public
abstract
removeDecorationType
(
key
:
string
):
void
;
public
abstract
resolveDecorationOptions
(
decorationTypeKey
:
string
,
writable
:
boolean
):
IModelDecorationOptions
;
abstract
registerDecorationType
(
key
:
string
,
options
:
IDecorationRenderOptions
,
parentTypeKey
?:
string
):
void
;
abstract
removeDecorationType
(
key
:
string
):
void
;
abstract
resolveDecorationOptions
(
decorationTypeKey
:
string
,
writable
:
boolean
):
IModelDecorationOptions
;
}
src/vs/editor/common/services/codeEditorService.ts
浏览文件 @
79a7e306
...
...
@@ -14,16 +14,22 @@ export var ICodeEditorService = createDecorator<ICodeEditorService>('codeEditorS
export
interface
ICodeEditorService
{
_serviceBrand
:
any
;
addCodeEditor
(
editor
:
ICommonCodeEditor
):
void
;
onCodeEditorAdd
:
Event
<
ICommonCodeEditor
>
;
removeCodeEditor
(
editor
:
ICommonCodeEditor
):
void
;
onCodeEditorRemove
:
Event
<
ICommonCodeEditor
>
;
getCodeEditor
(
editorId
:
string
):
ICommonCodeEditor
;
onDiffEditorAdd
:
Event
<
ICommonDiffEditor
>
;
onDiffEditorRemove
:
Event
<
ICommonDiffEditor
>
;
addCodeEditor
(
editor
:
ICommonCodeEditor
):
void
;
removeCodeEditor
(
editor
:
ICommonCodeEditor
):
void
;
getCodeEditor
(
editorId
:
string
):
ICommonCodeEditor
;
listCodeEditors
():
ICommonCodeEditor
[];
addDiffEditor
(
editor
:
ICommonDiffEditor
):
void
;
removeDiffEditor
(
editor
:
ICommonDiffEditor
):
void
;
getDiffEditor
(
editorId
:
string
):
ICommonDiffEditor
;
listDiffEditors
():
ICommonDiffEditor
[];
/**
* Returns the current focused code editor (if the focus is in the editor or in an editor widget) or null.
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录