Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
7987bbfa
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7987bbfa
编写于
8月 27, 2018
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "when with panel service when figuring out the active editor, #55309"
This reverts commit
b078a67c
.
上级
061c99b1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
56 addition
and
83 deletion
+56
-83
src/vs/workbench/api/electron-browser/mainThreadDocumentsAndEditors.ts
...nch/api/electron-browser/mainThreadDocumentsAndEditors.ts
+26
-39
src/vs/workbench/test/electron-browser/api/mainThreadDocumentsAndEditors.test.ts
...lectron-browser/api/mainThreadDocumentsAndEditors.test.ts
+12
-19
src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts
...bench/test/electron-browser/api/mainThreadEditors.test.ts
+18
-25
未找到文件。
src/vs/workbench/api/electron-browser/mainThreadDocumentsAndEditors.ts
浏览文件 @
7987bbfa
...
...
@@ -4,31 +4,28 @@
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
dispose
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
ICodeEditor
,
isCodeEditor
,
isDiffEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
IBulkEditService
}
from
'
vs/editor/browser/services/bulkEditService
'
;
import
{
ICodeEditorService
}
from
'
vs/editor/browser/services/codeEditorService
'
;
import
{
IEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
IModelService
,
shouldSynchronizeModel
}
from
'
vs/editor/common/services/modelService
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
ITextModelService
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
ICodeEditorService
}
from
'
vs/editor/browser/services/codeEditorService
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
ExtHostContext
,
ExtHostDocumentsAndEditorsShape
,
IModelAddedData
,
ITextEditorAddData
,
IDocumentsAndEditorsDelta
,
IExtHostContext
,
MainContext
}
from
'
../node/extHost.protocol
'
;
import
{
MainThreadTextEditor
}
from
'
./mainThreadEditor
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
IEditorGroupsService
}
from
'
vs/workbench/services/group/common/editorGroupsService
'
;
import
{
EditorViewColumn
,
editorGroupToViewColumn
}
from
'
vs/workbench/api/shared/editor
'
;
import
{
IEditor
}
from
'
vs/workbench/common/editor
'
;
import
{
extHostCustomer
}
from
'
vs/workbench/api/electron-browser/extHostCustomers
'
;
import
{
MainThreadDocuments
}
from
'
vs/workbench/api/electron-browser/mainThreadDocuments
'
;
import
{
MainThreadTextEditors
}
from
'
vs/workbench/api/electron-browser/mainThreadEditors
'
;
import
{
editorGroupToViewColumn
,
EditorViewColumn
}
from
'
vs/workbench/api/shared/editor
'
;
import
{
BaseTextEditor
}
from
'
vs/workbench/browser/parts/editor/textEditor
'
;
import
{
IEditor
as
IWorkbenchEditor
}
from
'
vs/workbench/common/editor
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IEditorGroupsService
}
from
'
vs/workbench/services/group/common/editorGroupsService
'
;
import
{
IPanelService
}
from
'
vs/workbench/services/panel/common/panelService
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
ITextModelService
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
IUntitledEditorService
}
from
'
vs/workbench/services/untitled/common/untitledEditorService
'
;
import
{
ExtHostContext
,
ExtHostDocumentsAndEditorsShape
,
IDocumentsAndEditorsDelta
,
IExtHostContext
,
IModelAddedData
,
ITextEditorAddData
,
MainContext
}
from
'
../node/extHost.protocol
'
;
import
{
MainThreadTextEditor
}
from
'
./mainThreadEditor
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
isDiffEditor
,
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
IBulkEditService
}
from
'
vs/editor/browser/services/bulkEditService
'
;
namespace
mapset
{
...
...
@@ -164,8 +161,7 @@ class MainThreadDocumentAndEditorStateComputer {
private
readonly
_onDidChangeState
:
(
delta
:
DocumentAndEditorStateDelta
)
=>
void
,
@
IModelService
private
readonly
_modelService
:
IModelService
,
@
ICodeEditorService
private
readonly
_codeEditorService
:
ICodeEditorService
,
@
IEditorService
private
readonly
_editorService
:
IEditorService
,
@
IPanelService
private
readonly
_panelService
:
IPanelService
,
@
IEditorService
private
readonly
_editorService
:
IEditorService
)
{
this
.
_modelService
.
onModelAdded
(
this
.
_updateStateOnModelAdd
,
this
,
this
.
_toDispose
);
this
.
_modelService
.
onModelRemoved
(
this
.
_updateState
,
this
,
this
.
_toDispose
);
...
...
@@ -256,21 +252,13 @@ class MainThreadDocumentAndEditorStateComputer {
}
// active editor: if none of the previous editors had focus we try
// to match
output panels or the the active workbench editor with
//
one of editor we have
just computed
// to match
the active workbench editor with one of editor we have
// just computed
if
(
!
activeEditor
)
{
let
candidate
:
IEditor
;
let
panel
=
this
.
_panelService
.
getActivePanel
();
if
(
panel
instanceof
BaseTextEditor
&&
isCodeEditor
(
panel
.
getControl
()))
{
candidate
=
panel
.
getControl
();
}
else
{
candidate
=
this
.
_editorService
.
activeTextEditorWidget
;
if
(
isDiffEditor
(
candidate
))
{
candidate
=
candidate
.
getModifiedEditor
();
}
let
candidate
=
this
.
_editorService
.
activeTextEditorWidget
;
if
(
isDiffEditor
(
candidate
))
{
candidate
=
candidate
.
getModifiedEditor
();
}
if
(
candidate
)
{
editors
.
forEach
(
snapshot
=>
{
if
(
candidate
===
snapshot
.
editor
)
{
...
...
@@ -319,8 +307,7 @@ export class MainThreadDocumentsAndEditors {
@
ITextModelService
textModelResolverService
:
ITextModelService
,
@
IUntitledEditorService
untitledEditorService
:
IUntitledEditorService
,
@
IEditorGroupsService
private
readonly
_editorGroupService
:
IEditorGroupsService
,
@
IBulkEditService
bulkEditService
:
IBulkEditService
,
@
IPanelService
panelService
:
IPanelService
@
IBulkEditService
bulkEditService
:
IBulkEditService
)
{
this
.
_proxy
=
extHostContext
.
getProxy
(
ExtHostContext
.
ExtHostDocumentsAndEditors
);
...
...
@@ -332,7 +319,7 @@ export class MainThreadDocumentsAndEditors {
extHostContext
.
set
(
MainContext
.
MainThreadTextEditors
,
mainThreadTextEditors
);
// It is expected that the ctor of the state computer calls our `_onDelta`.
this
.
_stateComputer
=
new
MainThreadDocumentAndEditorStateComputer
(
delta
=>
this
.
_onDelta
(
delta
),
_modelService
,
codeEditorService
,
this
.
_editorService
,
panelService
);
this
.
_stateComputer
=
new
MainThreadDocumentAndEditorStateComputer
(
delta
=>
this
.
_onDelta
(
delta
),
_modelService
,
codeEditorService
,
this
.
_editorService
);
this
.
_toDispose
=
[
mainThreadDocuments
,
...
...
@@ -443,7 +430,7 @@ export class MainThreadDocumentsAndEditors {
return
undefined
;
}
findTextEditorIdFor
(
editor
:
I
Workbench
Editor
):
string
{
findTextEditorIdFor
(
editor
:
IEditor
):
string
{
for
(
let
id
in
this
.
_textEditors
)
{
if
(
this
.
_textEditors
[
id
].
matches
(
editor
))
{
return
id
;
...
...
src/vs/workbench/test/electron-browser/api/mainThreadDocumentsAndEditors.test.ts
浏览文件 @
7987bbfa
...
...
@@ -6,22 +6,21 @@
'
use strict
'
;
import
*
as
assert
from
'
assert
'
;
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
ICodeEditorService
}
from
'
vs/editor/browser/services/codeEditorService
'
;
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
MainThreadDocumentsAndEditors
}
from
'
vs/workbench/api/electron-browser/mainThreadDocumentsAndEditors
'
;
import
{
SingleProxyRPCProtocol
}
from
'
./testRPCProtocol
'
;
import
{
TestConfigurationService
}
from
'
vs/platform/configuration/test/common/testConfigurationService
'
;
import
{
ModelServiceImpl
}
from
'
vs/editor/common/services/modelServiceImpl
'
;
import
{
TestCodeEditorService
}
from
'
vs/editor/test/browser/editorTestServices
'
;
import
{
createTestCodeEditor
,
TestCodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
TestConfigurationService
}
from
'
vs/platform/configuration/test/common/testConfigurationService
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
MainThreadDocumentsAndEditors
}
from
'
vs/workbench/api/electron-browser/mainThreadDocumentsAndEditors
'
;
import
{
ExtHostDocumentsAndEditorsShape
,
IDocumentsAndEditorsDelta
}
from
'
vs/workbench/api/node/extHost.protocol
'
;
import
{
IPanelService
}
from
'
vs/workbench/services/panel/common/panelService
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
ExtHostDocumentsAndEditorsShape
,
IDocumentsAndEditorsDelta
}
from
'
vs/workbench/api/node/extHost.protocol
'
;
import
{
createTestCodeEditor
,
TestCodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
mock
}
from
'
vs/workbench/test/electron-browser/api/mock
'
;
import
{
TestEditorGroupsService
,
TestEditorService
}
from
'
vs/workbench/test/workbenchTestServices
'
;
import
{
SingleProxyRPCProtocol
}
from
'
./testRPCProtocol
'
;
import
{
TestEditorService
,
TestEditorGroupsService
}
from
'
vs/workbench/test/workbenchTestServices
'
;
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
ICodeEditorService
}
from
'
vs/editor/browser/services/codeEditorService
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
suite
(
'
MainThreadDocumentsAndEditors
'
,
()
=>
{
...
...
@@ -75,13 +74,7 @@ suite('MainThreadDocumentsAndEditors', () => {
null
,
null
,
editorGroupService
,
null
,
new
class
extends
mock
<
IPanelService
>
()
implements
IPanelService
{
_serviceBrand
:
any
;
getActivePanel
()
{
return
null
;
}
}
null
);
/* tslint:enable */
});
...
...
src/vs/workbench/test/electron-browser/api/mainThreadEditors.test.ts
浏览文件 @
7987bbfa
...
...
@@ -6,30 +6,29 @@
'
use strict
'
;
import
*
as
assert
from
'
assert
'
;
import
{
MainThreadDocumentsAndEditors
}
from
'
vs/workbench/api/electron-browser/mainThreadDocumentsAndEditors
'
;
import
{
SingleProxyRPCProtocol
,
TestRPCProtocol
}
from
'
./testRPCProtocol
'
;
import
{
TestConfigurationService
}
from
'
vs/platform/configuration/test/common/testConfigurationService
'
;
import
{
ModelServiceImpl
}
from
'
vs/editor/common/services/modelServiceImpl
'
;
import
{
TestCodeEditorService
}
from
'
vs/editor/test/browser/editorTestServices
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
ExtHostDocumentsAndEditorsShape
,
ExtHostContext
,
ExtHostDocumentsShape
}
from
'
vs/workbench/api/node/extHost.protocol
'
;
import
{
mock
}
from
'
vs/workbench/test/electron-browser/api/mock
'
;
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
ImmortalReference
,
IReference
}
from
'
vs/base/common/lifecycle
'
;
import
{
MainThreadTextEditors
}
from
'
vs/workbench/api/electron-browser/mainThreadEditors
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
EditOperation
}
from
'
vs/editor/common/core/editOperation
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
ResourceTextEdit
}
from
'
vs/editor/common/modes
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
ModelServiceImpl
}
from
'
vs/editor/common/services/modelServiceImpl
'
;
import
{
ITextEditorModel
,
ITextModelService
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
TestCodeEditorService
}
from
'
vs/editor/test/browser/editorTestServices
'
;
import
{
TestConfigurationService
}
from
'
vs/platform/configuration/test/common/testConfigurationService
'
;
import
{
LabelService
}
from
'
vs/platform/label/common/label
'
;
import
{
NullLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
MainThreadDocumentsAndEditors
}
from
'
vs/workbench/api/electron-browser/mainThreadDocumentsAndEditors
'
;
import
{
MainThreadTextEditors
}
from
'
vs/workbench/api/electron-browser/mainThreadEditors
'
;
import
{
ExtHostContext
,
ExtHostDocumentsAndEditorsShape
,
ExtHostDocumentsShape
}
from
'
vs/workbench/api/node/extHost.protocol
'
;
import
{
EditOperation
}
from
'
vs/editor/common/core/editOperation
'
;
import
{
TestFileService
,
TestEditorService
,
TestEditorGroupsService
,
TestEnvironmentService
,
TestContextService
}
from
'
vs/workbench/test/workbenchTestServices
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ResourceTextEdit
}
from
'
vs/editor/common/modes
'
;
import
{
BulkEditService
}
from
'
vs/workbench/services/bulkEdit/electron-browser/bulkEditService
'
;
import
{
IPanelService
}
from
'
vs/workbench/services/panel/common/panelService
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
mock
}
from
'
vs/workbench/test/electron-browser/api/mock
'
;
import
{
TestContextService
,
TestEditorGroupsService
,
TestEditorService
,
TestEnvironmentService
,
TestFileService
}
from
'
vs/workbench/test/workbenchTestServices
'
;
import
{
SingleProxyRPCProtocol
,
TestRPCProtocol
}
from
'
./testRPCProtocol
'
;
import
{
NullLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
ITextModelService
,
ITextEditorModel
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
IReference
,
ImmortalReference
}
from
'
vs/base/common/lifecycle
'
;
import
{
LabelService
}
from
'
vs/platform/label/common/label
'
;
suite
(
'
MainThreadEditors
'
,
()
=>
{
...
...
@@ -109,12 +108,6 @@ suite('MainThreadEditors', () => {
null
,
editorGroupService
,
bulkEditService
,
new
class
extends
mock
<
IPanelService
>
()
implements
IPanelService
{
_serviceBrand
:
any
;
getActivePanel
()
{
return
null
;
}
}
);
editors
=
new
MainThreadTextEditors
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录