Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
08f1beb9
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,发现更多精彩内容 >>
提交
08f1beb9
编写于
5月 16, 2018
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bye bye old editorService and old groupService
上级
2571a957
变更
27
隐藏空白更改
内联
并排
Showing
27 changed file
with
201 addition
and
230 deletion
+201
-230
src/vs/workbench/api/browser/viewsContainersExtensionPoint.ts
...vs/workbench/api/browser/viewsContainersExtensionPoint.ts
+4
-4
src/vs/workbench/browser/parts/editor/editorCommands.ts
src/vs/workbench/browser/parts/editor/editorCommands.ts
+7
-8
src/vs/workbench/browser/parts/editor/textDiffEditor.ts
src/vs/workbench/browser/parts/editor/textDiffEditor.ts
+3
-6
src/vs/workbench/browser/parts/editor/textEditor.ts
src/vs/workbench/browser/parts/editor/textEditor.ts
+6
-6
src/vs/workbench/browser/parts/editor/textResourceEditor.ts
src/vs/workbench/browser/parts/editor/textResourceEditor.ts
+7
-7
src/vs/workbench/browser/viewlet.ts
src/vs/workbench/browser/viewlet.ts
+4
-4
src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts
...kbench/parts/debug/electron-browser/debug.contribution.ts
+2
-2
src/vs/workbench/parts/execution/electron-browser/execution.contribution.ts
...arts/execution/electron-browser/execution.contribution.ts
+2
-2
src/vs/workbench/parts/extensions/browser/extensionsActions.ts
...s/workbench/parts/extensions/browser/extensionsActions.ts
+5
-5
src/vs/workbench/parts/files/browser/editors/binaryFileEditor.ts
...workbench/parts/files/browser/editors/binaryFileEditor.ts
+3
-3
src/vs/workbench/parts/files/browser/editors/fileEditorTracker.ts
...orkbench/parts/files/browser/editors/fileEditorTracker.ts
+22
-29
src/vs/workbench/parts/files/browser/editors/textFileEditor.ts
...s/workbench/parts/files/browser/editors/textFileEditor.ts
+4
-6
src/vs/workbench/parts/files/browser/files.ts
src/vs/workbench/parts/files/browser/files.ts
+4
-4
src/vs/workbench/parts/files/common/dirtyFilesTracker.ts
src/vs/workbench/parts/files/common/dirtyFilesTracker.ts
+9
-15
src/vs/workbench/parts/files/electron-browser/fileActions.ts
src/vs/workbench/parts/files/electron-browser/fileActions.ts
+15
-17
src/vs/workbench/parts/files/electron-browser/fileCommands.ts
...vs/workbench/parts/files/electron-browser/fileCommands.ts
+54
-57
src/vs/workbench/parts/files/electron-browser/files.contribution.ts
...kbench/parts/files/electron-browser/files.contribution.ts
+3
-3
src/vs/workbench/parts/files/electron-browser/saveErrorHandler.ts
...orkbench/parts/files/electron-browser/saveErrorHandler.ts
+14
-16
src/vs/workbench/parts/files/electron-browser/views/explorerView.ts
...kbench/parts/files/electron-browser/views/explorerView.ts
+7
-9
src/vs/workbench/parts/files/electron-browser/views/explorerViewer.ts
...ench/parts/files/electron-browser/views/explorerViewer.ts
+3
-3
src/vs/workbench/parts/files/test/browser/fileEditorInput.test.ts
...orkbench/parts/files/test/browser/fileEditorInput.test.ts
+4
-4
src/vs/workbench/parts/files/test/browser/fileEditorTracker.test.ts
...kbench/parts/files/test/browser/fileEditorTracker.test.ts
+2
-2
src/vs/workbench/parts/output/browser/logViewer.ts
src/vs/workbench/parts/output/browser/logViewer.ts
+4
-5
src/vs/workbench/parts/output/browser/outputPanel.ts
src/vs/workbench/parts/output/browser/outputPanel.ts
+4
-4
src/vs/workbench/parts/preferences/browser/preferencesEditor.ts
.../workbench/parts/preferences/browser/preferencesEditor.ts
+4
-4
src/vs/workbench/parts/scm/electron-browser/scm.contribution.ts
.../workbench/parts/scm/electron-browser/scm.contribution.ts
+3
-3
src/vs/workbench/parts/search/electron-browser/search.contribution.ts
...ench/parts/search/electron-browser/search.contribution.ts
+2
-2
未找到文件。
src/vs/workbench/api/browser/viewsContainersExtensionPoint.ts
浏览文件 @
08f1beb9
...
...
@@ -17,7 +17,6 @@ import { IPartService } from 'vs/workbench/services/part/common/partService';
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
...
...
@@ -29,6 +28,7 @@ import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import
{
forEach
}
from
'
vs/base/common/collections
'
;
import
{
IWorkbenchContributionsRegistry
,
Extensions
as
WorkbenchExtensions
,
IWorkbenchContribution
}
from
'
vs/workbench/common/contributions
'
;
import
{
LifecyclePhase
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
export
interface
IUserFriendlyViewsContainerDescriptor
{
...
...
@@ -158,7 +158,7 @@ class ViewsContainersExtensionHandler implements IWorkbenchContribution {
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
IWorkspaceContextService
contextService
:
IWorkspaceContextService
,
@
IStorageService
storageService
:
IStorageService
,
@
I
WorkbenchEditorService
editorService
:
IWorkbench
EditorService
,
@
I
NextEditorService
editorService
:
INext
EditorService
,
@
IInstantiationService
instantiationService
:
IInstantiationService
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IThemeService
themeService
:
IThemeService
,
...
...
@@ -184,7 +184,7 @@ class ViewsContainersExtensionHandler implements IWorkbenchContribution {
constructor
(
id
:
string
,
label
:
string
,
@
IViewletService
viewletService
:
IViewletService
,
@
I
WorkbenchEditorService
editorService
:
IWorkbench
EditorService
@
I
NextEditorService
editorService
:
INext
EditorService
)
{
super
(
id
,
label
,
id
,
viewletService
,
editorService
);
}
...
...
@@ -205,4 +205,4 @@ class ViewsContainersExtensionHandler implements IWorkbenchContribution {
}
const
workbenchRegistry
=
Registry
.
as
<
IWorkbenchContributionsRegistry
>
(
WorkbenchExtensions
.
Workbench
);
workbenchRegistry
.
registerWorkbenchContribution
(
ViewsContainersExtensionHandler
,
LifecyclePhase
.
Starting
);
\ No newline at end of file
workbenchRegistry
.
registerWorkbenchContribution
(
ViewsContainersExtensionHandler
,
LifecyclePhase
.
Starting
);
src/vs/workbench/browser/parts/editor/editorCommands.ts
浏览文件 @
08f1beb9
...
...
@@ -300,7 +300,7 @@ function registerEditorCommands() {
const
editorGroupService
=
accessor
.
get
(
IEditorGroupService
);
const
model
=
editorGroupService
.
getStacksModel
();
const
editorService
=
accessor
.
get
(
IWorkbenchEditorService
);
const
contexts
=
getMultiSelectedEditorContexts
(
context
,
accessor
.
get
(
IListService
),
accessor
.
get
(
I
EditorGroup
Service
));
const
contexts
=
getMultiSelectedEditorContexts
(
context
,
accessor
.
get
(
IListService
),
accessor
.
get
(
I
NextEditorGroups
Service
));
if
(
contexts
.
length
===
0
&&
model
.
activeGroup
)
{
// If command is triggered from the command palette use the active group
contexts
.
push
({
groupId
:
model
.
activeGroup
.
id
});
...
...
@@ -329,7 +329,7 @@ function registerEditorCommands() {
handler
:
(
accessor
,
resource
:
URI
|
object
,
context
:
IEditorCommandsContext
)
=>
{
const
editorGroupService
=
accessor
.
get
(
IEditorGroupService
);
const
editorService
=
accessor
.
get
(
IWorkbenchEditorService
);
const
contexts
=
getMultiSelectedEditorContexts
(
context
,
accessor
.
get
(
IListService
),
accessor
.
get
(
I
EditorGroup
Service
));
const
contexts
=
getMultiSelectedEditorContexts
(
context
,
accessor
.
get
(
IListService
),
accessor
.
get
(
I
NextEditorGroups
Service
));
const
distinctGroupIds
=
distinct
(
contexts
.
map
(
c
=>
c
.
groupId
));
const
model
=
editorGroupService
.
getStacksModel
();
...
...
@@ -356,7 +356,7 @@ function registerEditorCommands() {
const
editorService
=
accessor
.
get
(
IWorkbenchEditorService
);
const
nextEditorGroupService
=
accessor
.
get
(
INextEditorGroupsService
);
const
contexts
=
getMultiSelectedEditorContexts
(
context
,
accessor
.
get
(
IListService
),
accessor
.
get
(
I
EditorGroup
Service
));
const
contexts
=
getMultiSelectedEditorContexts
(
context
,
accessor
.
get
(
IListService
),
accessor
.
get
(
I
NextEditorGroups
Service
));
const
groupIds
=
distinct
(
contexts
.
map
(
context
=>
context
.
groupId
));
const
model
=
editorGroupService
.
getStacksModel
();
...
...
@@ -415,7 +415,7 @@ function registerEditorCommands() {
handler
:
(
accessor
,
resource
:
URI
|
object
,
context
:
IEditorCommandsContext
)
=>
{
const
editorGroupService
=
accessor
.
get
(
IEditorGroupService
);
const
editorService
=
accessor
.
get
(
IWorkbenchEditorService
);
const
contexts
=
getMultiSelectedEditorContexts
(
context
,
accessor
.
get
(
IListService
),
accessor
.
get
(
I
EditorGroup
Service
));
const
contexts
=
getMultiSelectedEditorContexts
(
context
,
accessor
.
get
(
IListService
),
accessor
.
get
(
I
NextEditorGroups
Service
));
const
model
=
editorGroupService
.
getStacksModel
();
if
(
contexts
.
length
===
0
)
{
...
...
@@ -547,13 +547,12 @@ function positionAndInput(editorGroupService: IEditorGroupService, editorService
return
{
position
,
input
};
}
export
function
getMultiSelectedEditorContexts
(
editorContext
:
IEditorCommandsContext
,
listService
:
IListService
,
editorGroupService
:
IEditorGroupService
):
IEditorCommandsContext
[]
{
const
stacks
=
editorGroupService
.
getStacksModel
();
export
function
getMultiSelectedEditorContexts
(
editorContext
:
IEditorCommandsContext
,
listService
:
IListService
,
editorGroupService
:
INextEditorGroupsService
):
IEditorCommandsContext
[]
{
// First check for a focused list to return the selected items from
const
list
=
listService
.
lastFocusedList
;
if
(
list
instanceof
List
&&
list
.
isDOMFocused
())
{
const
elementToContext
=
(
element
:
IEditorIdentifier
|
EditorGroup
)
=>
element
instanceof
EditorGroup
?
{
groupId
:
element
.
id
,
editorIndex
:
undefined
}
:
{
groupId
:
element
.
group
,
editorIndex
:
stacks
.
getGroup
(
element
.
group
).
indexOf
(
element
.
editor
)
};
element
instanceof
EditorGroup
?
{
groupId
:
element
.
id
,
editorIndex
:
undefined
}
:
{
groupId
:
element
.
group
,
editorIndex
:
editorGroupService
.
getGroup
(
element
.
group
).
getIndexOfEditor
(
element
.
editor
)
};
const
onlyEditorGroupAndEditor
=
(
e
:
IEditorIdentifier
|
EditorGroup
)
=>
e
instanceof
EditorGroup
||
(
'
editor
'
in
e
&&
'
group
'
in
e
);
const
focusedElements
:
(
IEditorIdentifier
|
EditorGroup
)[]
=
list
.
getFocusedElements
().
filter
(
onlyEditorGroupAndEditor
);
...
...
@@ -563,7 +562,7 @@ export function getMultiSelectedEditorContexts(editorContext: IEditorCommandsCon
if
(
focus
)
{
const
selection
:
(
IEditorIdentifier
|
EditorGroup
)[]
=
list
.
getSelectedElements
().
filter
(
onlyEditorGroupAndEditor
);
// Only respect selection if it contains focused element
if
(
selection
&&
selection
.
some
(
s
=>
s
instanceof
EditorGroup
?
s
.
id
===
focus
.
groupId
:
s
.
group
===
focus
.
groupId
&&
stacks
.
getGroup
(
s
.
group
).
indexOf
(
s
.
editor
)
===
focus
.
editorIndex
))
{
if
(
selection
&&
selection
.
some
(
s
=>
s
instanceof
EditorGroup
?
s
.
id
===
focus
.
groupId
:
s
.
group
===
focus
.
groupId
&&
editorGroupService
.
getGroup
(
s
.
group
).
getIndexOfEditor
(
s
.
editor
)
===
focus
.
editorIndex
))
{
return
selection
.
map
(
elementToContext
);
}
...
...
src/vs/workbench/browser/parts/editor/textDiffEditor.ts
浏览文件 @
08f1beb9
...
...
@@ -28,9 +28,7 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
import
{
ITextResourceConfigurationService
}
from
'
vs/editor/common/services/resourceConfiguration
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
ScrollType
,
IDiffEditorViewState
,
IDiffEditorModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
...
...
@@ -63,13 +61,12 @@ export class TextDiffEditor extends BaseTextEditor {
@
IStorageService
storageService
:
IStorageService
,
@
ITextResourceConfigurationService
configurationService
:
ITextResourceConfigurationService
,
@
IConfigurationService
private
readonly
_actualConfigurationService
:
IConfigurationService
,
@
I
WorkbenchEditorService
private
editorService
:
IWorkbench
EditorService
,
@
I
NextEditorService
editorService
:
INext
EditorService
,
@
IThemeService
themeService
:
IThemeService
,
@
I
EditorGroupService
editorGroupService
:
IEditorGroup
Service
,
@
I
NextEditorGroupsService
editorGroupService
:
INextEditorGroups
Service
,
@
ITextFileService
textFileService
:
ITextFileService
,
@
INextEditorGroupsService
nextEditorGroupService
:
INextEditorGroupsService
)
{
super
(
TextDiffEditor
.
ID
,
telemetryService
,
instantiationService
,
storageService
,
configurationService
,
themeService
,
textFileService
,
editor
GroupService
,
nextE
ditorGroupService
);
super
(
TextDiffEditor
.
ID
,
telemetryService
,
instantiationService
,
storageService
,
configurationService
,
themeService
,
textFileService
,
editor
Service
,
e
ditorGroupService
);
this
.
diffNavigatorDisposables
=
[];
this
.
toUnbind
.
push
(
this
.
_actualConfigurationService
.
onDidChangeConfiguration
((
e
)
=>
{
...
...
src/vs/workbench/browser/parts/editor/textEditor.ts
浏览文件 @
08f1beb9
...
...
@@ -23,11 +23,11 @@ import { Scope } from 'vs/workbench/common/memento';
import
{
getCodeEditor
,
getCodeOrDiffEditor
}
from
'
vs/editor/browser/services/codeEditorService
'
;
import
{
ITextFileService
,
SaveReason
,
AutoSaveMode
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
ITextResourceConfigurationService
}
from
'
vs/editor/common/services/resourceConfiguration
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
IEditorOptions
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
isDiffEditor
,
isCodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
INextEditorGroupsService
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
const
TEXT_EDITOR_VIEW_STATE_PREFERENCE_KEY
=
'
textEditorViewState
'
;
...
...
@@ -55,12 +55,12 @@ export abstract class BaseTextEditor extends BaseEditor {
@
ITextResourceConfigurationService
private
readonly
_configurationService
:
ITextResourceConfigurationService
,
@
IThemeService
protected
themeService
:
IThemeService
,
@
ITextFileService
private
readonly
_textFileService
:
ITextFileService
,
@
I
EditorGroupService
protected
editorGroupService
:
IEditorGroup
Service
,
@
INextEditorGroupsService
private
nextEditorGroupService
:
INextEditorGroupsService
@
I
NextEditorService
protected
editorService
:
INextEditor
Service
,
@
INextEditorGroupsService
private
editorGroupService
:
INextEditorGroupsService
,
)
{
super
(
id
,
telemetryService
,
themeService
);
this
.
editorViewStateMemento
=
new
EditorViewStateMemento
<
IEditorViewState
>
(
nextE
ditorGroupService
,
this
.
getMemento
(
storageService
,
Scope
.
WORKSPACE
),
TEXT_EDITOR_VIEW_STATE_PREFERENCE_KEY
,
100
);
this
.
editorViewStateMemento
=
new
EditorViewStateMemento
<
IEditorViewState
>
(
e
ditorGroupService
,
this
.
getMemento
(
storageService
,
Scope
.
WORKSPACE
),
TEXT_EDITOR_VIEW_STATE_PREFERENCE_KEY
,
100
);
this
.
toUnbind
.
push
(
this
.
configurationService
.
onDidChangeConfiguration
(
e
=>
this
.
handleConfigurationChangeEvent
(
this
.
configurationService
.
getValue
<
IEditorConfiguration
>
(
this
.
getResource
()))));
}
...
...
@@ -109,7 +109,7 @@ export abstract class BaseTextEditor extends BaseEditor {
// Apply group information to help identify in which group we are
if
(
ariaLabel
)
{
const
group
=
this
.
nextE
ditorGroupService
.
getGroup
(
this
.
group
);
const
group
=
this
.
e
ditorGroupService
.
getGroup
(
this
.
group
);
if
(
group
)
{
ariaLabel
=
nls
.
localize
(
'
editorLabelWithGroup
'
,
"
{0}, {1}.
"
,
ariaLabel
,
group
.
label
);
}
...
...
@@ -150,7 +150,7 @@ export abstract class BaseTextEditor extends BaseEditor {
this
.
toUnbind
.
push
(
this
.
editorControl
.
getModifiedEditor
().
onDidBlurEditorWidget
(()
=>
this
.
onEditorFocusLost
()));
}
this
.
toUnbind
.
push
(
this
.
editor
GroupService
.
onEditorsChanged
(()
=>
this
.
onEditorFocusLost
()));
this
.
toUnbind
.
push
(
this
.
editor
Service
.
onDidActiveEditorChange
(()
=>
this
.
onEditorFocusLost
()));
this
.
toUnbind
.
push
(
DOM
.
addDisposableListener
(
window
,
DOM
.
EventType
.
BLUR
,
()
=>
this
.
onWindowFocusLost
()));
}
...
...
src/vs/workbench/browser/parts/editor/textResourceEditor.ts
浏览文件 @
08f1beb9
...
...
@@ -19,12 +19,12 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
import
{
ITextResourceConfigurationService
}
from
'
vs/editor/common/services/resourceConfiguration
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
once
}
from
'
vs/base/common/event
'
;
import
{
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
INextEditorGroupsService
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
/**
* An editor implementation that is capable of showing the contents of resource inputs. Uses
...
...
@@ -39,11 +39,11 @@ export class AbstractTextResourceEditor extends BaseTextEditor {
@
IStorageService
storageService
:
IStorageService
,
@
ITextResourceConfigurationService
configurationService
:
ITextResourceConfigurationService
,
@
IThemeService
themeService
:
IThemeService
,
@
I
EditorGroupService
editorGroupService
:
IEditorGroup
Service
,
@
I
NextEditorGroupsService
editorGroupService
:
INextEditorGroups
Service
,
@
ITextFileService
textFileService
:
ITextFileService
,
@
INextEditor
GroupsService
nextEditorGroupService
:
INextEditorGroups
Service
@
INextEditor
Service
editorService
:
INextEditor
Service
)
{
super
(
id
,
telemetryService
,
instantiationService
,
storageService
,
configurationService
,
themeService
,
textFileService
,
editor
GroupService
,
nextE
ditorGroupService
);
super
(
id
,
telemetryService
,
instantiationService
,
storageService
,
configurationService
,
themeService
,
textFileService
,
editor
Service
,
e
ditorGroupService
);
}
public
getTitle
():
string
{
...
...
@@ -208,10 +208,10 @@ export class TextResourceEditor extends AbstractTextResourceEditor {
@
IStorageService
storageService
:
IStorageService
,
@
ITextResourceConfigurationService
configurationService
:
ITextResourceConfigurationService
,
@
IThemeService
themeService
:
IThemeService
,
@
IEditorGroupService
editorGroupService
:
IEditorGroupService
,
@
ITextFileService
textFileService
:
ITextFileService
,
@
INextEditorGroupsService
nextEditorGroupService
:
INextEditorGroupsService
@
INextEditorService
editorService
:
INextEditorService
,
@
INextEditorGroupsService
editorGroupService
:
INextEditorGroupsService
)
{
super
(
TextResourceEditor
.
ID
,
telemetryService
,
instantiationService
,
storageService
,
configurationService
,
themeService
,
editorGroupService
,
textFileService
,
nextEditorGroup
Service
);
super
(
TextResourceEditor
.
ID
,
telemetryService
,
instantiationService
,
storageService
,
configurationService
,
themeService
,
editorGroupService
,
textFileService
,
editor
Service
);
}
}
src/vs/workbench/browser/viewlet.ts
浏览文件 @
08f1beb9
...
...
@@ -10,7 +10,6 @@ import { Registry } from 'vs/platform/registry/common/platform';
import
{
Action
,
IAction
}
from
'
vs/base/common/actions
'
;
import
{
ITree
}
from
'
vs/base/parts/tree/browser/tree
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IViewlet
}
from
'
vs/workbench/common/viewlet
'
;
import
{
Composite
,
CompositeDescriptor
,
CompositeRegistry
}
from
'
vs/workbench/browser/composite
'
;
import
{
IConstructorSignature0
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -18,6 +17,7 @@ import { ToggleSidebarVisibilityAction } from 'vs/workbench/browser/actions/togg
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IPartService
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
export
abstract
class
Viewlet
extends
Composite
implements
IViewlet
{
...
...
@@ -120,7 +120,7 @@ export class ToggleViewletAction extends Action {
name
:
string
,
viewletId
:
string
,
@
IViewletService
protected
viewletService
:
IViewletService
,
@
I
WorkbenchEditorService
private
editorService
:
IWorkbench
EditorService
@
I
NextEditorService
private
editorService
:
INext
EditorService
)
{
super
(
id
,
name
);
...
...
@@ -136,7 +136,7 @@ export class ToggleViewletAction extends Action {
}
// Otherwise pass focus to editor if possible
const
editor
=
this
.
editorService
.
getActiveEditor
()
;
const
editor
=
this
.
editorService
.
activeControl
;
if
(
editor
)
{
editor
.
focus
();
}
...
...
@@ -176,4 +176,4 @@ export class CollapseAction extends Action {
return
TPromise
.
as
(
null
);
});
}
}
\ No newline at end of file
}
src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts
浏览文件 @
08f1beb9
...
...
@@ -37,7 +37,6 @@ import * as service from 'vs/workbench/parts/debug/electron-browser/debugService
import
{
DebugContentProvider
}
from
'
vs/workbench/parts/debug/browser/debugContentProvider
'
;
import
'
vs/workbench/parts/debug/electron-browser/debugEditorContribution
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
registerCommands
}
from
'
vs/workbench/parts/debug/browser/debugCommands
'
;
import
{
IQuickOpenRegistry
,
Extensions
as
QuickOpenExtensions
,
QuickOpenHandlerDescriptor
}
from
'
vs/workbench/browser/quickopen
'
;
import
{
StatusBarColorProvider
}
from
'
vs/workbench/parts/debug/browser/statusbarColorProvider
'
;
...
...
@@ -51,6 +50,7 @@ import { DebugQuickOpenHandler } from 'vs/workbench/parts/debug/browser/debugQui
import
{
DebugStatus
}
from
'
vs/workbench/parts/debug/browser/debugStatus
'
;
import
{
LifecyclePhase
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
launchSchemaId
}
from
'
vs/workbench/services/configuration/common/configuration
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
class
OpenDebugViewletAction
extends
ToggleViewletAction
{
public
static
readonly
ID
=
VIEWLET_ID
;
...
...
@@ -60,7 +60,7 @@ class OpenDebugViewletAction extends ToggleViewletAction {
id
:
string
,
label
:
string
,
@
IViewletService
viewletService
:
IViewletService
,
@
I
WorkbenchEditorService
editorService
:
IWorkbench
EditorService
@
I
NextEditorService
editorService
:
INext
EditorService
)
{
super
(
id
,
label
,
VIEWLET_ID
,
viewletService
,
editorService
);
}
...
...
src/vs/workbench/parts/execution/electron-browser/execution.contribution.ts
浏览文件 @
08f1beb9
...
...
@@ -13,7 +13,6 @@ import * as paths from 'vs/base/common/paths';
import
uri
from
'
vs/base/common/uri
'
;
import
{
ITerminalService
}
from
'
vs/workbench/parts/execution/common/execution
'
;
import
{
MenuId
,
MenuRegistry
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
KeyMod
,
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
Extensions
,
IConfigurationRegistry
,
ConfigurationScope
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
ITerminalService
as
IIntegratedTerminalService
,
KEYBINDING_CONTEXT_TERMINAL_NOT_FOCUSED
}
from
'
vs/workbench/parts/terminal/common/terminal
'
;
...
...
@@ -28,6 +27,7 @@ import { getMultiSelectedResources } from 'vs/workbench/parts/files/browser/file
import
{
CommandsRegistry
}
from
'
vs/platform/commands/common/commands
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
distinct
}
from
'
vs/base/common/arrays
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
if
(
env
.
isWindows
)
{
registerSingleton
(
ITerminalService
,
WinTerminalService
);
...
...
@@ -81,7 +81,7 @@ CommandsRegistry.registerCommand({
id
:
OPEN_IN_TERMINAL_COMMAND_ID
,
handler
:
(
accessor
,
resource
:
uri
)
=>
{
const
configurationService
=
accessor
.
get
(
IConfigurationService
);
const
editorService
=
accessor
.
get
(
I
Workbench
EditorService
);
const
editorService
=
accessor
.
get
(
I
Next
EditorService
);
const
fileService
=
accessor
.
get
(
IFileService
);
const
integratedTerminalService
=
accessor
.
get
(
IIntegratedTerminalService
);
const
terminalService
=
accessor
.
get
(
ITerminalService
);
...
...
src/vs/workbench/parts/extensions/browser/extensionsActions.ts
浏览文件 @
08f1beb9
...
...
@@ -22,7 +22,6 @@ import { areSameExtensions } from 'vs/platform/extensionManagement/common/extens
import
{
IInstantiationService
,
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ToggleViewletAction
}
from
'
vs/workbench/browser/viewlet
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
Query
}
from
'
vs/workbench/parts/extensions/common/extensionQuery
'
;
import
{
IFileService
,
IContent
}
from
'
vs/platform/files/common/files
'
;
import
{
IWorkspaceContextService
,
WorkbenchState
,
IWorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
...
...
@@ -47,6 +46,7 @@ import { IOpenerService } from 'vs/platform/opener/common/opener';
import
{
mnemonicButtonLabel
}
from
'
vs/base/common/labels
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IQuickOpenService
,
IPickOpenEntry
}
from
'
vs/platform/quickOpen/common/quickOpen
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
const
promptDownloadManually
=
(
extension
:
IExtension
,
message
:
string
,
instantiationService
:
IInstantiationService
,
notificationService
:
INotificationService
,
openerService
:
IOpenerService
)
=>
{
notificationService
.
prompt
(
Severity
.
Error
,
message
,
[{
...
...
@@ -957,7 +957,7 @@ export class OpenExtensionsViewletAction extends ToggleViewletAction {
id
:
string
,
label
:
string
,
@
IViewletService
viewletService
:
IViewletService
,
@
I
WorkbenchEditorService
editorService
:
IWorkbench
EditorService
@
I
NextEditorService
editorService
:
INext
EditorService
)
{
super
(
id
,
label
,
VIEWLET_ID
,
viewletService
,
editorService
);
}
...
...
@@ -1486,7 +1486,7 @@ export abstract class AbstractConfigureRecommendedExtensionsAction extends Actio
label
:
string
,
@
IWorkspaceContextService
protected
contextService
:
IWorkspaceContextService
,
@
IFileService
private
fileService
:
IFileService
,
@
I
WorkbenchEditorService
private
editorService
:
IWorkbench
EditorService
,
@
I
NextEditorService
private
editorService
:
INext
EditorService
,
@
IJSONEditingService
private
jsonEditingService
:
IJSONEditingService
,
@
ITextModelService
private
textModelResolverService
:
ITextModelService
)
{
...
...
@@ -1577,7 +1577,7 @@ export class ConfigureWorkspaceRecommendedExtensionsAction extends AbstractConfi
label
:
string
,
@
IFileService
fileService
:
IFileService
,
@
IWorkspaceContextService
contextService
:
IWorkspaceContextService
,
@
I
WorkbenchEditorService
editorService
:
IWorkbench
EditorService
,
@
I
NextEditorService
editorService
:
INext
EditorService
,
@
IJSONEditingService
jsonEditingService
:
IJSONEditingService
,
@
ITextModelService
textModelResolverService
:
ITextModelService
)
{
...
...
@@ -1618,7 +1618,7 @@ export class ConfigureWorkspaceFolderRecommendedExtensionsAction extends Abstrac
label
:
string
,
@
IFileService
fileService
:
IFileService
,
@
IWorkspaceContextService
contextService
:
IWorkspaceContextService
,
@
I
WorkbenchEditorService
editorService
:
IWorkbench
EditorService
,
@
I
NextEditorService
editorService
:
INext
EditorService
,
@
IJSONEditingService
jsonEditingService
:
IJSONEditingService
,
@
ITextModelService
textModelResolverService
:
ITextModelService
,
@
ICommandService
private
commandService
:
ICommandService
...
...
src/vs/workbench/parts/files/browser/editors/binaryFileEditor.ts
浏览文件 @
08f1beb9
...
...
@@ -9,13 +9,13 @@ import { BaseBinaryResourceEditor } from 'vs/workbench/browser/parts/editor/bina
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
EditorInput
,
EditorOptions
}
from
'
vs/workbench/common/editor
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
FileEditorInput
}
from
'
vs/workbench/parts/files/common/editors/fileEditorInput
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
BINARY_FILE_EDITOR_ID
}
from
'
vs/workbench/parts/files/common/files
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
/**
* An implementation of editor for binary files like images.
...
...
@@ -29,7 +29,7 @@ export class BinaryFileEditor extends BaseBinaryResourceEditor {
@
IThemeService
themeService
:
IThemeService
,
@
IFileService
fileService
:
IFileService
,
@
IWindowsService
private
windowsService
:
IWindowsService
,
@
I
WorkbenchEditorService
private
editorService
:
IWorkbench
EditorService
@
I
NextEditorService
private
editorService
:
INext
EditorService
)
{
super
(
BinaryFileEditor
.
ID
,
...
...
@@ -46,7 +46,7 @@ export class BinaryFileEditor extends BaseBinaryResourceEditor {
private
openInternal
(
input
:
EditorInput
,
options
:
EditorOptions
):
void
{
if
(
input
instanceof
FileEditorInput
)
{
input
.
setForceOpenAsText
();
this
.
editorService
.
openEditor
(
input
,
options
,
this
.
group
).
done
(
null
,
onUnexpectedError
);
this
.
editorService
.
openEditor
(
input
,
options
,
this
.
group
).
then
(
undefined
,
onUnexpectedError
);
}
}
...
...
src/vs/workbench/parts/files/browser/editors/fileEditorTracker.ts
浏览文件 @
08f1beb9
...
...
@@ -10,13 +10,11 @@ import * as errors from 'vs/base/common/errors';
import
URI
from
'
vs/base/common/uri
'
;
import
*
as
paths
from
'
vs/base/common/paths
'
;
import
{
IEditorViewState
}
from
'
vs/editor/common/editorCommon
'
;
import
{
toResource
,
SideBySideEditorInput
,
I
EditorGroup
,
I
WorkbenchEditorConfiguration
}
from
'
vs/workbench/common/editor
'
;
import
{
toResource
,
SideBySideEditorInput
,
IWorkbenchEditorConfiguration
}
from
'
vs/workbench/common/editor
'
;
import
{
ITextFileService
,
ITextFileEditorModel
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
FileOperationEvent
,
FileOperation
,
IFileService
,
FileChangeType
,
FileChangesEvent
}
from
'
vs/platform/files/common/files
'
;
import
{
FileEditorInput
}
from
'
vs/workbench/parts/files/common/editors/fileEditorInput
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
distinct
}
from
'
vs/base/common/arrays
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
...
...
@@ -29,6 +27,8 @@ import { isCodeEditor } from 'vs/editor/browser/editorBrowser';
import
{
SideBySideEditor
}
from
'
vs/workbench/browser/parts/editor/sideBySideEditor
'
;
import
{
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
BINARY_FILE_EDITOR_ID
}
from
'
vs/workbench/parts/files/common/files
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
import
{
INextEditorGroupsService
,
INextEditorGroup
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
export
class
FileEditorTracker
implements
IWorkbenchContribution
{
...
...
@@ -39,10 +39,10 @@ export class FileEditorTracker implements IWorkbenchContribution {
private
activeOutOfWorkspaceWatchers
:
ResourceMap
<
URI
>
;
constructor
(
@
I
WorkbenchEditorService
private
editorService
:
IWorkbench
EditorService
,
@
I
NextEditorService
private
editorService
:
INext
EditorService
,
@
ITextFileService
private
textFileService
:
ITextFileService
,
@
ILifecycleService
private
lifecycleService
:
ILifecycleService
,
@
I
EditorGroupService
private
editorGroupService
:
IEditorGroup
Service
,
@
I
NextEditorGroupsService
private
editorGroupService
:
INextEditorGroups
Service
,
@
IFileService
private
fileService
:
IFileService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
...
...
@@ -67,7 +67,7 @@ export class FileEditorTracker implements IWorkbenchContribution {
this
.
toUnbind
.
push
(
this
.
fileService
.
onFileChanges
(
e
=>
this
.
onFileChanges
(
e
)));
// Editor changing
this
.
toUnbind
.
push
(
this
.
editor
GroupService
.
onEditorsChanged
(()
=>
this
.
onEditorsChanged
()));
this
.
toUnbind
.
push
(
this
.
editor
Service
.
onDidVisibleEditorsChange
(()
=>
this
.
handleOutOfWorkspaceWatchers
()));
// Update visible editors when focus is gained
this
.
toUnbind
.
push
(
this
.
windowService
.
onDidChangeFocus
(
e
=>
this
.
onWindowFocusChange
(
e
)));
...
...
@@ -94,9 +94,9 @@ export class FileEditorTracker implements IWorkbenchContribution {
// are visible in any editor. since this is a fast operation in the case nothing has changed,
// we tolerate the additional work.
distinct
(
this
.
editorService
.
getVisibleEditors
()
.
map
(
editor
=>
{
const
resource
=
toResource
(
editor
.
i
nput
,
{
supportSideBySide
:
true
});
this
.
editorService
.
visibleEditors
.
map
(
editor
Input
=>
{
const
resource
=
toResource
(
editor
I
nput
,
{
supportSideBySide
:
true
});
return
resource
?
this
.
textFileService
.
models
.
get
(
resource
)
:
void
0
;
})
.
filter
(
model
=>
model
&&
!
model
.
isDirty
()),
...
...
@@ -189,9 +189,8 @@ export class FileEditorTracker implements IWorkbenchContribution {
private
getOpenedFileEditors
(
dirtyState
:
boolean
):
FileEditorInput
[]
{
const
editors
:
FileEditorInput
[]
=
[];
const
stacks
=
this
.
editorGroupService
.
getStacksModel
();
stacks
.
groups
.
forEach
(
group
=>
{
group
.
getEditors
().
forEach
(
editor
=>
{
this
.
editorGroupService
.
groups
.
forEach
(
group
=>
{
group
.
editors
.
forEach
(
editor
=>
{
if
(
editor
instanceof
FileEditorInput
)
{
if
(
!!
editor
.
isDirty
()
===
dirtyState
)
{
editors
.
push
(
editor
);
...
...
@@ -219,9 +218,8 @@ export class FileEditorTracker implements IWorkbenchContribution {
}
private
handleMovedFileInOpenedEditors
(
oldResource
:
URI
,
newResource
:
URI
):
void
{
const
stacks
=
this
.
editorGroupService
.
getStacksModel
();
stacks
.
groups
.
forEach
(
group
=>
{
group
.
getEditors
().
forEach
(
input
=>
{
this
.
editorGroupService
.
groups
.
forEach
(
group
=>
{
group
.
editors
.
forEach
(
input
=>
{
if
(
input
instanceof
FileEditorInput
)
{
const
resource
=
input
.
getResource
();
...
...
@@ -241,11 +239,11 @@ export class FileEditorTracker implements IWorkbenchContribution {
options
:
{
preserveFocus
:
true
,
pinned
:
group
.
isPinned
(
input
),
index
:
group
.
indexOf
(
input
),
index
:
group
.
getIndexOfEditor
(
input
),
inactive
:
!
group
.
isActive
(
input
),
viewState
:
this
.
getViewStateFor
(
oldResource
,
group
)
}
},
stacks
.
positionOfGroup
(
group
)).
done
(
null
,
errors
.
onUnexpectedError
);
},
group
).
then
(
undefined
,
errors
.
onUnexpectedError
);
}
}
});
...
...
@@ -269,13 +267,12 @@ export class FileEditorTracker implements IWorkbenchContribution {
return
path
.
indexOf
(
candidate
);
}
private
getViewStateFor
(
resource
:
URI
,
group
:
IEditorGroup
):
IEditorViewState
|
undefined
{
const
stacks
=
this
.
editorGroupService
.
getStacksModel
();
const
editors
=
this
.
editorService
.
getVisibleEditors
();
private
getViewStateFor
(
resource
:
URI
,
group
:
INextEditorGroup
):
IEditorViewState
|
undefined
{
const
editors
=
this
.
editorService
.
visibleControls
;
for
(
let
i
=
0
;
i
<
editors
.
length
;
i
++
)
{
const
editor
=
editors
[
i
];
if
(
editor
&&
editor
.
input
&&
editor
.
group
===
stacks
.
positionOfGroup
(
group
)
)
{
if
(
editor
&&
editor
.
input
&&
editor
.
group
===
group
.
id
)
{
const
editorResource
=
editor
.
input
.
getResource
();
if
(
editorResource
&&
resource
.
toString
()
===
editorResource
.
toString
())
{
const
control
=
editor
.
getControl
();
...
...
@@ -299,7 +296,7 @@ export class FileEditorTracker implements IWorkbenchContribution {
}
private
handleUpdatesToVisibleBinaryEditors
(
e
:
FileChangesEvent
):
void
{
const
editors
=
this
.
editorService
.
getVisibleEditors
()
;
const
editors
=
this
.
editorService
.
visibleControls
;
editors
.
forEach
(
editor
=>
{
const
resource
=
toResource
(
editor
.
input
,
{
supportSideBySide
:
true
});
...
...
@@ -313,7 +310,7 @@ export class FileEditorTracker implements IWorkbenchContribution {
// Binary editor that should reload from event
if
(
resource
&&
isBinaryEditor
&&
(
e
.
contains
(
resource
,
FileChangeType
.
UPDATED
)
||
e
.
contains
(
resource
,
FileChangeType
.
ADDED
)))
{
this
.
editorService
.
openEditor
(
editor
.
input
,
{
forceOpen
:
true
,
preserveFocus
:
true
},
editor
.
group
).
done
(
null
,
errors
.
onUnexpectedError
);
this
.
editorService
.
openEditor
(
editor
.
input
,
{
forceOpen
:
true
,
preserveFocus
:
true
},
editor
.
group
).
then
(
null
,
errors
.
onUnexpectedError
);
}
});
}
...
...
@@ -341,14 +338,10 @@ export class FileEditorTracker implements IWorkbenchContribution {
}
}
private
onEditorsChanged
():
void
{
this
.
handleOutOfWorkspaceWatchers
();
}
private
handleOutOfWorkspaceWatchers
():
void
{
const
visibleOutOfWorkspacePaths
=
new
ResourceMap
<
URI
>
();
this
.
editorService
.
getVisibleEditors
().
map
(
editor
=>
{
return
toResource
(
editor
.
i
nput
,
{
supportSideBySide
:
true
});
this
.
editorService
.
visibleEditors
.
map
(
editorInput
=>
{
return
toResource
(
editor
I
nput
,
{
supportSideBySide
:
true
});
}).
filter
(
resource
=>
{
return
!!
resource
&&
this
.
fileService
.
canHandleResource
(
resource
)
&&
!
this
.
contextService
.
isInsideWorkspace
(
resource
);
}).
forEach
(
resource
=>
{
...
...
src/vs/workbench/parts/files/browser/editors/textFileEditor.ts
浏览文件 @
08f1beb9
...
...
@@ -27,7 +27,6 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
IPreferencesService
}
from
'
vs/workbench/services/preferences/common/preferences
'
;
import
{
PreferencesEditor
}
from
'
vs/workbench/parts/preferences/browser/preferencesEditor
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
...
...
@@ -49,15 +48,14 @@ export class TextFileEditor extends BaseTextEditor {
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
,
@
IStorageService
storageService
:
IStorageService
,
@
ITextResourceConfigurationService
configurationService
:
ITextResourceConfigurationService
,
@
INextEditorService
private
editorService
:
INextEditorService
,
@
INextEditorService
editorService
:
INextEditorService
,
@
IThemeService
themeService
:
IThemeService
,
@
I
EditorGroupService
editorGroupService
:
IEditorGroup
Service
,
@
I
NextEditorGroupsService
editorGroupService
:
INextEditorGroups
Service
,
@
ITextFileService
textFileService
:
ITextFileService
,
@
IWindowsService
private
windowsService
:
IWindowsService
,
@
IPreferencesService
private
preferencesService
:
IPreferencesService
,
@
INextEditorGroupsService
nextEditorGroupService
:
INextEditorGroupsService
@
IPreferencesService
private
preferencesService
:
IPreferencesService
)
{
super
(
TextFileEditor
.
ID
,
telemetryService
,
instantiationService
,
storageService
,
configurationService
,
themeService
,
textFileService
,
editor
GroupService
,
nextE
ditorGroupService
);
super
(
TextFileEditor
.
ID
,
telemetryService
,
instantiationService
,
storageService
,
configurationService
,
themeService
,
textFileService
,
editor
Service
,
e
ditorGroupService
);
// Clear view state for deleted files
this
.
toUnbind
.
push
(
this
.
fileService
.
onFileChanges
(
e
=>
this
.
onFilesChanged
(
e
)));
...
...
src/vs/workbench/parts/files/browser/files.ts
浏览文件 @
08f1beb9
...
...
@@ -7,15 +7,15 @@
import
URI
from
'
vs/base/common/uri
'
;
import
{
IListService
}
from
'
vs/platform/list/browser/listService
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
ExplorerItem
,
OpenEditor
}
from
'
vs/workbench/parts/files/common/explorerModel
'
;
import
{
toResource
}
from
'
vs/workbench/common/editor
'
;
import
{
Tree
}
from
'
vs/base/parts/tree/browser/treeImpl
'
;
import
{
List
}
from
'
vs/base/browser/ui/list/listWidget
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
// Commands can get exeucted from a command pallete, from a context menu or from some list using a keybinding
// To cover all these cases we need to properly compute the resource on which the command is being executed
export
function
getResourceForCommand
(
resource
:
URI
|
object
,
listService
:
IListService
,
editorService
:
I
Workbench
EditorService
):
URI
{
export
function
getResourceForCommand
(
resource
:
URI
|
object
,
listService
:
IListService
,
editorService
:
I
Next
EditorService
):
URI
{
if
(
URI
.
isUri
(
resource
))
{
return
resource
;
}
...
...
@@ -39,10 +39,10 @@ export function getResourceForCommand(resource: URI | object, listService: IList
}
}
return
toResource
(
editorService
.
getActiveEditorInput
()
,
{
supportSideBySide
:
true
});
return
toResource
(
editorService
.
activeEditor
,
{
supportSideBySide
:
true
});
}
export
function
getMultiSelectedResources
(
resource
:
URI
|
object
,
listService
:
IListService
,
editorService
:
I
Workbench
EditorService
):
URI
[]
{
export
function
getMultiSelectedResources
(
resource
:
URI
|
object
,
listService
:
IListService
,
editorService
:
I
Next
EditorService
):
URI
[]
{
const
list
=
listService
.
lastFocusedList
;
if
(
list
&&
list
.
isDOMFocused
())
{
// Explorer
...
...
src/vs/workbench/parts/files/common/dirtyFilesTracker.ts
浏览文件 @
08f1beb9
...
...
@@ -13,35 +13,32 @@ import { TextFileModelChangeEvent, ITextFileService, AutoSaveMode, ModelState }
import
{
platform
,
Platform
}
from
'
vs/base/common/platform
'
;
import
{
Position
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IEditorStacksModel
}
from
'
vs/workbench/common/editor
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IActivityService
,
NumberBadge
}
from
'
vs/workbench/services/activity/common/activity
'
;
import
{
IUntitledEditorService
}
from
'
vs/workbench/services/untitled/common/untitledEditorService
'
;
import
*
as
arrays
from
'
vs/base/common/arrays
'
;
import
{
INextEditorGroupsService
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
export
class
DirtyFilesTracker
implements
IWorkbenchContribution
{
private
isDocumentedEdited
:
boolean
;
private
toUnbind
:
IDisposable
[];
private
lastDirtyCount
:
number
;
private
stacks
:
IEditorStacksModel
;
private
badgeHandle
:
IDisposable
;
constructor
(
@
ITextFileService
private
textFileService
:
ITextFileService
,
@
ILifecycleService
private
lifecycleService
:
ILifecycleService
,
@
I
EditorGroupService
editorGroupService
:
IEditorGroup
Service
,
@
I
WorkbenchEditorService
private
editorService
:
IWorkbench
EditorService
,
@
I
NextEditorGroupsService
privateeditorGroupService
:
INextEditorGroups
Service
,
@
I
NextEditorService
private
editorService
:
INext
EditorService
,
@
IActivityService
private
activityService
:
IActivityService
,
@
IWindowService
private
windowService
:
IWindowService
,
@
IUntitledEditorService
private
untitledEditorService
:
IUntitledEditorService
)
{
this
.
toUnbind
=
[];
this
.
isDocumentedEdited
=
false
;
this
.
stacks
=
editorGroupService
.
getStacksModel
();
this
.
registerListeners
();
}
...
...
@@ -88,24 +85,21 @@ export class DirtyFilesTracker implements IWorkbenchContribution {
const
shouldOpen
=
model
&&
model
.
isDirty
()
&&
!
model
.
hasState
(
ModelState
.
PENDING_SAVE
);
// Only if not open already
return
shouldOpen
&&
!
this
.
stacks
.
isOpen
(
e
.
resource
);
return
shouldOpen
&&
!
this
.
editorService
.
isOpen
({
resource
:
e
.
resource
}
);
}).
map
(
e
=>
e
.
resource
),
r
=>
r
.
toString
()));
}
private
doOpenDirtyResources
(
resources
:
URI
[]):
void
{
const
activeEditor
=
this
.
editorService
.
getActiveEditor
()
;
const
activeEditor
=
this
.
editorService
.
activeControl
;
const
activePosition
=
activeEditor
?
activeEditor
.
group
:
Position
.
ONE
;
// Open
this
.
editorService
.
openEditors
(
resources
.
map
(
resource
=>
{
return
{
input
:
{
resource
,
options
:
{
inactive
:
true
,
pinned
:
true
,
preserveFocus
:
true
}
},
position
:
activePosition
resource
,
options
:
{
inactive
:
true
,
pinned
:
true
,
preserveFocus
:
true
}
};
})
).
done
(
null
,
errors
.
onUnexpectedError
);
})
,
activePosition
).
then
(
undefined
,
errors
.
onUnexpectedError
);
}
private
onTextFilesSaved
(
e
:
TextFileModelChangeEvent
[]):
void
{
...
...
src/vs/workbench/parts/files/electron-browser/fileActions.ts
浏览文件 @
08f1beb9
...
...
@@ -30,9 +30,7 @@ import { ExplorerItem, Model, NewStatPlaceholder } from 'vs/workbench/parts/file
import
{
ExplorerView
}
from
'
vs/workbench/parts/files/electron-browser/views/explorerView
'
;
import
{
ExplorerViewlet
}
from
'
vs/workbench/parts/files/electron-browser/explorerViewlet
'
;
import
{
IUntitledEditorService
}
from
'
vs/workbench/services/untitled/common/untitledEditorService
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
CollapseAction
}
from
'
vs/workbench/browser/viewlet
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
IQuickOpenService
}
from
'
vs/platform/quickOpen/common/quickOpen
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
IInstantiationService
,
ServicesAccessor
,
IConstructorSignature2
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -52,6 +50,7 @@ import { RawContextKey, IContextKeyService } from 'vs/platform/contextkey/common
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
IDialogService
,
IConfirmationResult
,
IConfirmation
,
getConfirmMessage
}
from
'
vs/platform/dialogs/common/dialogs
'
;
import
{
INotificationService
,
Severity
}
from
'
vs/platform/notification/common/notification
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
export
interface
IEditableData
{
action
:
IAction
;
...
...
@@ -482,7 +481,7 @@ export class GlobalNewUntitledFileAction extends Action {
constructor
(
id
:
string
,
label
:
string
,
@
I
WorkbenchEditorService
private
editorService
:
IWorkbench
EditorService
@
I
NextEditorService
private
editorService
:
INext
EditorService
)
{
super
(
id
,
label
);
}
...
...
@@ -513,7 +512,7 @@ class CreateFileAction extends BaseCreateAction {
constructor
(
element
:
ExplorerItem
,
@
IFileService
fileService
:
IFileService
,
@
I
WorkbenchEditorService
private
editorService
:
IWorkbench
EditorService
,
@
I
NextEditorService
private
editorService
:
INext
EditorService
,
@
INotificationService
notificationService
:
INotificationService
,
@
ITextFileService
textFileService
:
ITextFileService
)
{
...
...
@@ -791,7 +790,7 @@ export class AddFilesAction extends BaseFileAction {
element
:
ExplorerItem
,
clazz
:
string
,
@
IFileService
fileService
:
IFileService
,
@
I
WorkbenchEditorService
private
editorService
:
IWorkbench
EditorService
,
@
I
NextEditorService
private
editorService
:
INext
EditorService
,
@
IDialogService
private
dialogService
:
IDialogService
,
@
INotificationService
notificationService
:
INotificationService
,
@
ITextFileService
textFileService
:
ITextFileService
...
...
@@ -946,7 +945,7 @@ class PasteFileAction extends BaseFileAction {
@
IFileService
fileService
:
IFileService
,
@
INotificationService
notificationService
:
INotificationService
,
@
ITextFileService
textFileService
:
ITextFileService
,
@
I
WorkbenchEditorService
private
editorService
:
IWorkbench
EditorService
@
I
NextEditorService
private
editorService
:
INext
EditorService
)
{
super
(
PasteFileAction
.
ID
,
PASTE_FILE_LABEL
,
fileService
,
notificationService
,
textFileService
);
...
...
@@ -1009,7 +1008,7 @@ export class DuplicateFileAction extends BaseFileAction {
fileToDuplicate
:
ExplorerItem
,
target
:
ExplorerItem
,
@
IFileService
fileService
:
IFileService
,
@
I
WorkbenchEditorService
private
editorService
:
IWorkbench
EditorService
,
@
I
NextEditorService
private
editorService
:
INext
EditorService
,
@
INotificationService
notificationService
:
INotificationService
,
@
ITextFileService
textFileService
:
ITextFileService
)
{
...
...
@@ -1089,20 +1088,19 @@ export class GlobalCompareResourcesAction extends Action {
id
:
string
,
label
:
string
,
@
IQuickOpenService
private
quickOpenService
:
IQuickOpenService
,
@
I
WorkbenchEditorService
private
editorService
:
IWorkbench
EditorService
,
@
I
NextEditorService
private
editorService
:
INext
EditorService
,
@
INotificationService
private
notificationService
:
INotificationService
,
@
IEditorGroupService
private
editorGroupService
:
IEditorGroupService
)
{
super
(
id
,
label
);
}
public
run
():
TPromise
<
any
>
{
const
activeInput
=
this
.
editorService
.
getActiveEditorInput
()
;
const
activeInput
=
this
.
editorService
.
activeEditor
;
const
activeResource
=
activeInput
?
activeInput
.
getResource
()
:
void
0
;
if
(
activeResource
)
{
// Compare with next editor that opens
const
unbind
=
once
(
this
.
editor
GroupService
.
onEditorOpening
)(
e
=>
{
const
unbind
=
once
(
this
.
editor
Service
.
onWillOpenEditor
)(
e
=>
{
const
resource
=
e
.
editor
.
getResource
();
if
(
resource
)
{
e
.
prevent
(()
=>
{
...
...
@@ -1284,7 +1282,7 @@ export class ShowActiveFileInExplorer extends Action {
constructor
(
id
:
string
,
label
:
string
,
@
I
WorkbenchEditorService
private
editorService
:
IWorkbench
EditorService
,
@
I
NextEditorService
private
editorService
:
INext
EditorService
,
@
INotificationService
private
notificationService
:
INotificationService
,
@
ICommandService
private
commandService
:
ICommandService
)
{
...
...
@@ -1292,7 +1290,7 @@ export class ShowActiveFileInExplorer extends Action {
}
public
run
():
TPromise
<
any
>
{
const
resource
=
toResource
(
this
.
editorService
.
getActiveEditorInput
()
,
{
supportSideBySide
:
true
});
const
resource
=
toResource
(
this
.
editorService
.
activeEditor
,
{
supportSideBySide
:
true
});
if
(
resource
)
{
this
.
commandService
.
executeCommand
(
REVEAL_IN_EXPLORER_COMMAND_ID
,
resource
);
}
else
{
...
...
@@ -1363,14 +1361,14 @@ export class ShowOpenedFileInNewWindow extends Action {
id
:
string
,
label
:
string
,
@
IWindowsService
private
windowsService
:
IWindowsService
,
@
I
WorkbenchEditorService
private
editorService
:
IWorkbench
EditorService
,
@
I
NextEditorService
private
editorService
:
INext
EditorService
,
@
INotificationService
private
notificationService
:
INotificationService
,
)
{
super
(
id
,
label
);
}
public
run
():
TPromise
<
any
>
{
const
fileResource
=
toResource
(
this
.
editorService
.
getActiveEditorInput
()
,
{
supportSideBySide
:
true
,
filter
:
Schemas
.
file
/* todo@remote */
});
const
fileResource
=
toResource
(
this
.
editorService
.
activeEditor
,
{
supportSideBySide
:
true
,
filter
:
Schemas
.
file
/* todo@remote */
});
if
(
fileResource
)
{
this
.
windowsService
.
openWindow
([
fileResource
.
fsPath
],
{
forceNewWindow
:
true
,
forceOpenWorkspaceAsFile
:
true
});
}
else
{
...
...
@@ -1474,7 +1472,7 @@ export class CompareWithClipboardAction extends Action {
constructor
(
id
:
string
,
label
:
string
,
@
I
WorkbenchEditorService
private
editorService
:
IWorkbench
EditorService
,
@
I
NextEditorService
private
editorService
:
INext
EditorService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
ITextModelService
private
textModelService
:
ITextModelService
,
@
IFileService
private
fileService
:
IFileService
...
...
@@ -1485,7 +1483,7 @@ export class CompareWithClipboardAction extends Action {
}
public
run
():
TPromise
<
any
>
{
const
resource
:
URI
=
toResource
(
this
.
editorService
.
getActiveEditorInput
()
,
{
supportSideBySide
:
true
});
const
resource
:
URI
=
toResource
(
this
.
editorService
.
activeEditor
,
{
supportSideBySide
:
true
});
if
(
resource
&&
(
this
.
fileService
.
canHandleResource
(
resource
)
||
resource
.
scheme
===
Schemas
.
untitled
))
{
if
(
!
this
.
registrationDisposal
)
{
const
provider
=
this
.
instantiationService
.
createInstance
(
ClipboardContentProvider
);
...
...
src/vs/workbench/parts/files/electron-browser/fileCommands.ts
浏览文件 @
08f1beb9
...
...
@@ -10,7 +10,6 @@ import * as paths from 'vs/base/common/paths';
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
*
as
labels
from
'
vs/base/common/labels
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
toResource
,
IEditorCommandsContext
}
from
'
vs/workbench/common/editor
'
;
import
{
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
ServicesAccessor
,
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -19,7 +18,6 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
import
{
ExplorerFocusCondition
,
FileOnDiskContentProvider
,
VIEWLET_ID
}
from
'
vs/workbench/parts/files/common/files
'
;
import
{
ExplorerViewlet
}
from
'
vs/workbench/parts/files/electron-browser/explorerViewlet
'
;
import
{
IClipboardService
}
from
'
vs/platform/clipboard/common/clipboardService
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
toErrorMessage
}
from
'
vs/base/common/errorMessage
'
;
import
{
IListService
}
from
'
vs/platform/list/browser/listService
'
;
...
...
@@ -42,6 +40,8 @@ import { getMultiSelectedEditorContexts } from 'vs/workbench/browser/parts/edito
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
import
{
INextEditorService
,
SIDE_GROUP
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
import
{
INextEditorGroupsService
,
GroupDirection
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
// Commands
...
...
@@ -81,8 +81,8 @@ export const openWindowCommand = (accessor: ServicesAccessor, paths: string[], f
windowsService
.
openWindow
(
paths
,
{
forceNewWindow
});
};
function
save
(
resource
:
URI
,
isSaveAs
:
boolean
,
editorService
:
I
Workbench
EditorService
,
fileService
:
IFileService
,
untitledEditorService
:
IUntitledEditorService
,
textFileService
:
ITextFileService
,
editorGroupService
:
I
EditorGroup
Service
):
TPromise
<
any
>
{
function
save
(
resource
:
URI
,
isSaveAs
:
boolean
,
editorService
:
I
Next
EditorService
,
fileService
:
IFileService
,
untitledEditorService
:
IUntitledEditorService
,
textFileService
:
ITextFileService
,
editorGroupService
:
I
NextEditorGroups
Service
):
TPromise
<
any
>
{
if
(
resource
&&
(
fileService
.
canHandleResource
(
resource
)
||
resource
.
scheme
===
Schemas
.
untitled
))
{
...
...
@@ -97,7 +97,7 @@ function save(resource: URI, isSaveAs: boolean, editorService: IWorkbenchEditorS
}
let
viewStateOfSource
:
IEditorViewState
;
const
activeEditor
=
editorService
.
getActiveEditor
()
;
const
activeEditor
=
editorService
.
activeControl
;
const
editor
=
getCodeEditor
(
activeEditor
);
if
(
editor
)
{
const
activeResource
=
toResource
(
activeEditor
.
input
,
{
supportSideBySide
:
true
});
...
...
@@ -136,19 +136,21 @@ function save(resource: URI, isSaveAs: boolean, editorService: IWorkbenchEditorS
viewState
:
viewStateOfSource
}
};
console
.
log
(
replaceWith
);
return
editorService
.
replaceEditors
([{
toReplace
:
{
resource
:
resource
},
replaceWith
}]).
then
(()
=>
true
);
// TODO@Isidor
// return editorService.replaceEditors([{
// toReplace: { resource: resource },
// replaceWith
// }]).then(() => true);
});
}
// Pin the active editor if we are saving it
const
editor
=
editorService
.
getActiveEditor
()
;
const
editor
=
editorService
.
activeControl
;
const
activeEditorResource
=
editor
&&
editor
.
input
&&
editor
.
input
.
getResource
();
if
(
activeEditorResource
&&
activeEditorResource
.
toString
()
===
resource
.
toString
())
{
editorGroupService
.
pinEditor
(
editor
.
group
,
editor
.
input
);
editorGroupService
.
getGroup
(
editor
.
group
).
pinEditor
(
editor
.
input
);
}
// Just save
...
...
@@ -158,10 +160,8 @@ function save(resource: URI, isSaveAs: boolean, editorService: IWorkbenchEditorS
return
TPromise
.
as
(
false
);
}
function
saveAll
(
saveAllArguments
:
any
,
editorService
:
IWorkbenchEditorService
,
untitledEditorService
:
IUntitledEditorService
,
textFileService
:
ITextFileService
,
editorGroupService
:
IEditorGroupService
):
TPromise
<
any
>
{
const
stacks
=
editorGroupService
.
getStacksModel
();
function
saveAll
(
saveAllArguments
:
any
,
editorService
:
INextEditorService
,
untitledEditorService
:
IUntitledEditorService
,
textFileService
:
ITextFileService
,
editorGroupService
:
INextEditorGroupsService
):
TPromise
<
any
>
{
// Store some properties per untitled file to restore later after save is completed
const
mapUntitledToProperties
:
{
[
resource
:
string
]:
{
encoding
:
string
;
indexInGroups
:
number
[];
activeInGroups
:
boolean
[]
}
}
=
Object
.
create
(
null
);
...
...
@@ -171,7 +171,7 @@ function saveAll(saveAllArguments: any, editorService: IWorkbenchEditorService,
const
encoding
=
untitledEditorService
.
getEncoding
(
resource
);
// For each group
stacks
.
groups
.
forEach
((
group
,
groupIndex
)
=>
{
editorGroupService
.
groups
.
forEach
((
group
,
groupIndex
)
=>
{
// Find out if editor is active in group
const
activeEditor
=
group
.
activeEditor
;
...
...
@@ -180,7 +180,7 @@ function saveAll(saveAllArguments: any, editorService: IWorkbenchEditorService,
// Find index of editor in group
indexInGroups
[
groupIndex
]
=
-
1
;
group
.
getEditors
()
.
forEach
((
editor
,
editorIndex
)
=>
{
group
.
editors
.
forEach
((
editor
,
editorIndex
)
=>
{
const
editorResource
=
toResource
(
editor
,
{
supportSideBySide
:
true
});
if
(
editorResource
&&
editorResource
.
toString
()
===
resource
.
toString
())
{
indexInGroups
[
groupIndex
]
=
editorIndex
;
...
...
@@ -227,10 +227,10 @@ function saveAll(saveAllArguments: any, editorService: IWorkbenchEditorService,
}
});
});
if
(
untitledToReopen
.
length
)
{
return
editorService
.
openEditors
(
untitledToReopen
).
then
(()
=>
true
);
}
// TODO@Isidor
//
if (untitledToReopen.length) {
//
return editorService.openEditors(untitledToReopen).then(() => true);
//
}
return
void
0
;
});
...
...
@@ -241,7 +241,7 @@ function saveAll(saveAllArguments: any, editorService: IWorkbenchEditorService,
CommandsRegistry
.
registerCommand
({
id
:
REVERT_FILE_COMMAND_ID
,
handler
:
(
accessor
,
resource
:
URI
|
object
)
=>
{
const
editorService
=
accessor
.
get
(
I
Workbench
EditorService
);
const
editorService
=
accessor
.
get
(
I
Next
EditorService
);
const
textFileService
=
accessor
.
get
(
ITextFileService
);
const
notificationService
=
accessor
.
get
(
INotificationService
);
const
resources
=
getMultiSelectedResources
(
resource
,
accessor
.
get
(
IListService
),
editorService
)
...
...
@@ -265,14 +265,13 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
primary
:
KeyMod
.
WinCtrl
|
KeyCode
.
Enter
},
id
:
OPEN_TO_SIDE_COMMAND_ID
,
handler
:
(
accessor
,
resource
:
URI
|
object
)
=>
{
const
editorService
=
accessor
.
get
(
I
Workbench
EditorService
);
const
editorGroupService
=
accessor
.
get
(
I
EditorGroup
Service
);
const
editorService
=
accessor
.
get
(
I
Next
EditorService
);
const
editorGroupService
=
accessor
.
get
(
I
NextEditorGroups
Service
);
const
listService
=
accessor
.
get
(
IListService
);
const
fileService
=
accessor
.
get
(
IFileService
);
const
tree
=
listService
.
lastFocusedList
;
const
resources
=
getMultiSelectedResources
(
resource
,
listService
,
editorService
);
const
stacks
=
editorGroupService
.
getStacksModel
();
const
activeGroup
=
stacks
.
activeGroup
;
const
activeGroup
=
editorGroupService
.
activeGroup
;
// Remove highlight
if
(
tree
instanceof
Tree
)
{
...
...
@@ -283,15 +282,13 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
if
(
resources
.
length
)
{
return
fileService
.
resolveFiles
(
resources
.
map
(
resource
=>
({
resource
}))).
then
(
resolved
=>
{
const
editors
=
resolved
.
filter
(
r
=>
r
.
success
&&
!
r
.
stat
.
isDirectory
).
map
(
r
=>
({
input
:
{
resource
:
r
.
stat
.
resource
,
options
:
{
preserveFocus
:
false
}
}
resource
:
r
.
stat
.
resource
,
options
:
{
preserveFocus
:
false
}
}));
return
editorService
.
openEditors
(
editors
,
true
).
then
(()
=>
{
return
editorService
.
openEditors
(
editors
,
SIDE_GROUP
).
then
(()
=>
{
if
(
activeGroup
)
{
editorGroupService
.
focusGroup
(
stacks
.
positionOfGroup
(
activeGroup
)
+
1
);
editorGroupService
.
focusGroup
(
editorGroupService
.
findNeighbourGroup
(
activeGroup
,
GroupDirection
.
RIGHT
)
);
}
});
});
...
...
@@ -316,7 +313,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
textModelService
.
registerTextModelContentProvider
(
COMPARE_WITH_SAVED_SCHEMA
,
provider
);
}
const
editorService
=
accessor
.
get
(
I
Workbench
EditorService
);
const
editorService
=
accessor
.
get
(
I
Next
EditorService
);
const
uri
=
getResourceForCommand
(
resource
,
accessor
.
get
(
IListService
),
editorService
);
if
(
uri
&&
uri
.
scheme
===
Schemas
.
file
/* only files on disk supported for now */
)
{
...
...
@@ -343,7 +340,7 @@ CommandsRegistry.registerCommand({
tree
.
domFocus
();
}
globalResourceToCompare
=
getResourceForCommand
(
resource
,
listService
,
accessor
.
get
(
I
Workbench
EditorService
));
globalResourceToCompare
=
getResourceForCommand
(
resource
,
listService
,
accessor
.
get
(
I
Next
EditorService
));
if
(
!
resourceSelectedForCompareContext
)
{
resourceSelectedForCompareContext
=
ResourceSelectedForCompareContext
.
bindTo
(
accessor
.
get
(
IContextKeyService
));
}
...
...
@@ -354,7 +351,7 @@ CommandsRegistry.registerCommand({
CommandsRegistry
.
registerCommand
({
id
:
COMPARE_SELECTED_COMMAND_ID
,
handler
:
(
accessor
,
resource
:
URI
|
object
)
=>
{
const
editorService
=
accessor
.
get
(
I
Workbench
EditorService
);
const
editorService
=
accessor
.
get
(
I
Next
EditorService
);
const
resources
=
getMultiSelectedResources
(
resource
,
accessor
.
get
(
IListService
),
editorService
);
if
(
resources
.
length
===
2
)
{
...
...
@@ -371,7 +368,7 @@ CommandsRegistry.registerCommand({
CommandsRegistry
.
registerCommand
({
id
:
COMPARE_RESOURCE_COMMAND_ID
,
handler
:
(
accessor
,
resource
:
URI
|
object
)
=>
{
const
editorService
=
accessor
.
get
(
I
Workbench
EditorService
);
const
editorService
=
accessor
.
get
(
I
Next
EditorService
);
const
listService
=
accessor
.
get
(
IListService
);
const
tree
=
listService
.
lastFocusedList
;
...
...
@@ -405,7 +402,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
primary
:
KeyMod
.
Shift
|
KeyMod
.
Alt
|
KeyCode
.
KEY_R
},
handler
:
(
accessor
:
ServicesAccessor
,
resource
:
URI
|
object
)
=>
{
const
resources
=
getMultiSelectedResources
(
resource
,
accessor
.
get
(
IListService
),
accessor
.
get
(
I
Workbench
EditorService
));
const
resources
=
getMultiSelectedResources
(
resource
,
accessor
.
get
(
IListService
),
accessor
.
get
(
I
Next
EditorService
));
revealResourcesInOS
(
resources
,
accessor
.
get
(
IWindowsService
),
accessor
.
get
(
INotificationService
),
accessor
.
get
(
IWorkspaceContextService
));
}
});
...
...
@@ -415,8 +412,8 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
primary
:
KeyChord
(
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_K
,
KeyCode
.
KEY_R
),
id
:
'
workbench.action.files.revealActiveFileInWindows
'
,
handler
:
(
accessor
:
ServicesAccessor
)
=>
{
const
editorService
=
accessor
.
get
(
I
Workbench
EditorService
);
const
activeInput
=
editorService
.
getActiveEditorInput
()
;
const
editorService
=
accessor
.
get
(
I
Next
EditorService
);
const
activeInput
=
editorService
.
activeEditor
;
const
resources
=
activeInput
&&
activeInput
.
getResource
()
?
[
activeInput
.
getResource
()]
:
[];
revealResourcesInOS
(
resources
,
accessor
.
get
(
IWindowsService
),
accessor
.
get
(
INotificationService
),
accessor
.
get
(
IWorkspaceContextService
));
}
...
...
@@ -440,7 +437,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
},
id
:
COPY_PATH_COMMAND_ID
,
handler
:
(
accessor
,
resource
:
URI
|
object
)
=>
{
const
resources
=
getMultiSelectedResources
(
resource
,
accessor
.
get
(
IListService
),
accessor
.
get
(
I
Workbench
EditorService
));
const
resources
=
getMultiSelectedResources
(
resource
,
accessor
.
get
(
IListService
),
accessor
.
get
(
I
Next
EditorService
));
resourcesToClipboard
(
resources
,
accessor
.
get
(
IClipboardService
),
accessor
.
get
(
INotificationService
));
}
});
...
...
@@ -451,8 +448,8 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
primary
:
KeyChord
(
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_K
,
KeyCode
.
KEY_P
),
id
:
'
workbench.action.files.copyPathOfActiveFile
'
,
handler
:
(
accessor
)
=>
{
const
editorService
=
accessor
.
get
(
I
Workbench
EditorService
);
const
activeInput
=
editorService
.
getActiveEditorInput
()
;
const
editorService
=
accessor
.
get
(
I
Next
EditorService
);
const
activeInput
=
editorService
.
activeEditor
;
const
resources
=
activeInput
&&
activeInput
.
getResource
()
?
[
activeInput
.
getResource
()]
:
[];
resourcesToClipboard
(
resources
,
accessor
.
get
(
IClipboardService
),
accessor
.
get
(
INotificationService
));
}
...
...
@@ -463,7 +460,7 @@ CommandsRegistry.registerCommand({
handler
:
(
accessor
,
resource
:
URI
|
object
)
=>
{
const
viewletService
=
accessor
.
get
(
IViewletService
);
const
contextService
=
accessor
.
get
(
IWorkspaceContextService
);
const
uri
=
getResourceForCommand
(
resource
,
accessor
.
get
(
IListService
),
accessor
.
get
(
I
Workbench
EditorService
));
const
uri
=
getResourceForCommand
(
resource
,
accessor
.
get
(
IListService
),
accessor
.
get
(
I
Next
EditorService
));
viewletService
.
openViewlet
(
VIEWLET_ID
,
false
).
then
((
viewlet
:
ExplorerViewlet
)
=>
{
const
isInsideWorkspace
=
contextService
.
isInsideWorkspace
(
uri
);
...
...
@@ -489,15 +486,15 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
when
:
undefined
,
primary
:
KeyMod
.
CtrlCmd
|
KeyMod
.
Shift
|
KeyCode
.
KEY_S
,
handler
:
(
accessor
,
resourceOrObject
:
URI
|
object
|
{
from
:
string
})
=>
{
const
editorService
=
accessor
.
get
(
I
Workbench
EditorService
);
const
editorService
=
accessor
.
get
(
I
Next
EditorService
);
let
resource
:
URI
=
undefined
;
if
(
resourceOrObject
&&
'
from
'
in
resourceOrObject
&&
resourceOrObject
.
from
===
'
menu
'
)
{
resource
=
toResource
(
editorService
.
getActiveEditorInput
()
);
resource
=
toResource
(
editorService
.
activeEditor
);
}
else
{
resource
=
getResourceForCommand
(
resourceOrObject
,
accessor
.
get
(
IListService
),
editorService
);
}
return
save
(
resource
,
true
,
editorService
,
accessor
.
get
(
IFileService
),
accessor
.
get
(
IUntitledEditorService
),
accessor
.
get
(
ITextFileService
),
accessor
.
get
(
I
EditorGroup
Service
));
return
save
(
resource
,
true
,
editorService
,
accessor
.
get
(
IFileService
),
accessor
.
get
(
IUntitledEditorService
),
accessor
.
get
(
ITextFileService
),
accessor
.
get
(
I
NextEditorGroups
Service
));
}
});
...
...
@@ -507,29 +504,29 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_S
,
id
:
SAVE_FILE_COMMAND_ID
,
handler
:
(
accessor
,
resource
:
URI
|
object
)
=>
{
const
editorService
=
accessor
.
get
(
I
Workbench
EditorService
);
const
editorService
=
accessor
.
get
(
I
Next
EditorService
);
const
resources
=
getMultiSelectedResources
(
resource
,
accessor
.
get
(
IListService
),
editorService
);
if
(
resources
.
length
===
1
)
{
// If only one resource is selected explictly call save since the behavior is a bit different than save all #41841
return
save
(
resources
[
0
],
false
,
editorService
,
accessor
.
get
(
IFileService
),
accessor
.
get
(
IUntitledEditorService
),
accessor
.
get
(
ITextFileService
),
accessor
.
get
(
I
EditorGroup
Service
));
return
save
(
resources
[
0
],
false
,
editorService
,
accessor
.
get
(
IFileService
),
accessor
.
get
(
IUntitledEditorService
),
accessor
.
get
(
ITextFileService
),
accessor
.
get
(
I
NextEditorGroups
Service
));
}
return
saveAll
(
resources
,
editorService
,
accessor
.
get
(
IUntitledEditorService
),
accessor
.
get
(
ITextFileService
),
accessor
.
get
(
I
EditorGroup
Service
));
return
saveAll
(
resources
,
editorService
,
accessor
.
get
(
IUntitledEditorService
),
accessor
.
get
(
ITextFileService
),
accessor
.
get
(
I
NextEditorGroups
Service
));
}
});
CommandsRegistry
.
registerCommand
({
id
:
SAVE_ALL_COMMAND_ID
,
handler
:
(
accessor
)
=>
{
return
saveAll
(
true
,
accessor
.
get
(
I
WorkbenchEditorService
),
accessor
.
get
(
IUntitledEditorService
),
accessor
.
get
(
ITextFileService
),
accessor
.
get
(
IEditorGroup
Service
));
return
saveAll
(
true
,
accessor
.
get
(
I
NextEditorService
),
accessor
.
get
(
IUntitledEditorService
),
accessor
.
get
(
ITextFileService
),
accessor
.
get
(
INextEditorGroups
Service
));
}
});
CommandsRegistry
.
registerCommand
({
id
:
SAVE_ALL_IN_GROUP_COMMAND_ID
,
handler
:
(
accessor
,
resource
:
URI
|
object
,
editorContext
:
IEditorCommandsContext
)
=>
{
const
contexts
=
getMultiSelectedEditorContexts
(
editorContext
,
accessor
.
get
(
IListService
),
accessor
.
get
(
I
EditorGroup
Service
));
const
editorGroupService
=
accessor
.
get
(
I
EditorGroup
Service
);
const
contexts
=
getMultiSelectedEditorContexts
(
editorContext
,
accessor
.
get
(
IListService
),
accessor
.
get
(
I
NextEditorGroups
Service
));
const
editorGroupService
=
accessor
.
get
(
I
NextEditorGroups
Service
);
let
saveAllArg
:
any
;
if
(
!
contexts
.
length
)
{
saveAllArg
=
true
;
...
...
@@ -537,8 +534,8 @@ CommandsRegistry.registerCommand({
const
fileService
=
accessor
.
get
(
IFileService
);
saveAllArg
=
[];
contexts
.
forEach
(
context
=>
{
const
editorGroup
=
editorGroupService
.
get
StacksModel
().
get
Group
(
context
.
groupId
);
editorGroup
.
getEditors
()
.
forEach
(
editor
=>
{
const
editorGroup
=
editorGroupService
.
getGroup
(
context
.
groupId
);
editorGroup
.
editors
.
forEach
(
editor
=>
{
const
resource
=
toResource
(
editor
,
{
supportSideBySide
:
true
});
if
(
resource
&&
(
resource
.
scheme
===
Schemas
.
untitled
||
fileService
.
canHandleResource
(
resource
)))
{
saveAllArg
.
push
(
resource
);
...
...
@@ -547,14 +544,14 @@ CommandsRegistry.registerCommand({
});
}
return
saveAll
(
saveAllArg
,
accessor
.
get
(
I
WorkbenchEditorService
),
accessor
.
get
(
IUntitledEditorService
),
accessor
.
get
(
ITextFileService
),
accessor
.
get
(
IEditorGroup
Service
));
return
saveAll
(
saveAllArg
,
accessor
.
get
(
I
NextEditorService
),
accessor
.
get
(
IUntitledEditorService
),
accessor
.
get
(
ITextFileService
),
accessor
.
get
(
INextEditorGroups
Service
));
}
});
CommandsRegistry
.
registerCommand
({
id
:
SAVE_FILES_COMMAND_ID
,
handler
:
(
accessor
)
=>
{
return
saveAll
(
false
,
accessor
.
get
(
I
WorkbenchEditorService
),
accessor
.
get
(
IUntitledEditorService
),
accessor
.
get
(
ITextFileService
),
accessor
.
get
(
IEditorGroup
Service
));
return
saveAll
(
false
,
accessor
.
get
(
I
NextEditorService
),
accessor
.
get
(
IUntitledEditorService
),
accessor
.
get
(
ITextFileService
),
accessor
.
get
(
INextEditorGroups
Service
));
}
});
...
...
@@ -564,7 +561,7 @@ CommandsRegistry.registerCommand({
const
workspaceEditingService
=
accessor
.
get
(
IWorkspaceEditingService
);
const
contextService
=
accessor
.
get
(
IWorkspaceContextService
);
const
workspace
=
contextService
.
getWorkspace
();
const
resources
=
getMultiSelectedResources
(
resource
,
accessor
.
get
(
IListService
),
accessor
.
get
(
I
Workbench
EditorService
)).
filter
(
r
=>
const
resources
=
getMultiSelectedResources
(
resource
,
accessor
.
get
(
IListService
),
accessor
.
get
(
I
Next
EditorService
)).
filter
(
r
=>
// Need to verify resources are workspaces since multi selection can trigger this command on some non workspace resources
workspace
.
folders
.
some
(
f
=>
f
.
uri
.
toString
()
===
r
.
toString
())
);
...
...
src/vs/workbench/parts/files/electron-browser/files.contribution.ts
浏览文件 @
08f1beb9
...
...
@@ -25,7 +25,6 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
SyncDescriptor
}
from
'
vs/platform/instantiation/common/descriptors
'
;
import
{
IKeybindings
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
KeyMod
,
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
{
DirtyFilesTracker
}
from
'
vs/workbench/parts/files/common/dirtyFilesTracker
'
;
...
...
@@ -33,6 +32,7 @@ import { ExplorerViewlet, ExplorerViewletViewsContribution } from 'vs/workbench/
import
{
IEditorRegistry
,
EditorDescriptor
,
Extensions
as
EditorExtensions
}
from
'
vs/workbench/browser/editor
'
;
import
{
DataUriEditorInput
}
from
'
vs/workbench/common/editor/dataUriEditorInput
'
;
import
{
LifecyclePhase
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
// Viewlet Action
export
class
OpenExplorerViewletAction
extends
ToggleViewletAction
{
...
...
@@ -43,7 +43,7 @@ export class OpenExplorerViewletAction extends ToggleViewletAction {
id
:
string
,
label
:
string
,
@
IViewletService
viewletService
:
IViewletService
,
@
I
WorkbenchEditorService
editorService
:
IWorkbench
EditorService
@
I
NextEditorService
editorService
:
INext
EditorService
)
{
super
(
id
,
label
,
VIEWLET_ID
,
viewletService
,
editorService
);
}
...
...
@@ -136,7 +136,7 @@ class FileEditorInputFactory implements IEditorInputFactory {
const
resource
=
!!
fileInput
.
resourceJSON
?
URI
.
revive
(
fileInput
.
resourceJSON
)
:
URI
.
parse
(
fileInput
.
resource
);
const
encoding
=
fileInput
.
encoding
;
return
accessor
.
get
(
I
Workbench
EditorService
).
createInput
({
resource
,
encoding
})
as
FileEditorInput
;
return
accessor
.
get
(
I
Next
EditorService
).
createInput
({
resource
,
encoding
})
as
FileEditorInput
;
});
}
}
...
...
src/vs/workbench/parts/files/electron-browser/saveErrorHandler.ts
浏览文件 @
08f1beb9
...
...
@@ -12,7 +12,6 @@ import * as paths from 'vs/base/common/paths';
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
FileOperationError
,
FileOperationResult
}
from
'
vs/platform/files/common/files
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
ITextFileService
,
ISaveErrorHandler
,
ITextFileEditorModel
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
ServicesAccessor
,
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
...
...
@@ -20,7 +19,6 @@ import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import
{
TextFileEditorModel
}
from
'
vs/workbench/services/textfile/common/textFileEditorModel
'
;
import
{
ITextModelService
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
ResourceMap
}
from
'
vs/base/common/map
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
DiffEditorInput
}
from
'
vs/workbench/common/editor/diffEditorInput
'
;
import
{
ResourceEditorInput
}
from
'
vs/workbench/common/editor/resourceEditorInput
'
;
import
{
IContextKeyService
,
IContextKey
,
RawContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
...
...
@@ -35,6 +33,7 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
import
{
ExecuteCommandAction
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
once
}
from
'
vs/base/common/event
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
export
const
CONFLICT_RESOLUTION_CONTEXT
=
'
saveConflictResolutionContext
'
;
export
const
CONFLICT_RESOLUTION_SCHEME
=
'
conflictResolution
'
;
...
...
@@ -53,9 +52,8 @@ export class SaveErrorHandler implements ISaveErrorHandler, IWorkbenchContributi
constructor
(
@
INotificationService
private
notificationService
:
INotificationService
,
@
ITextFileService
private
textFileService
:
ITextFileService
,
@
IEditorGroupService
private
editorGroupService
:
IEditorGroupService
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
I
WorkbenchEditorService
private
editorService
:
IWorkbench
EditorService
,
@
I
NextEditorService
private
editorService
:
INext
EditorService
,
@
ITextModelService
textModelService
:
ITextModelService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IStorageService
private
storageService
:
IStorageService
...
...
@@ -79,19 +77,19 @@ export class SaveErrorHandler implements ISaveErrorHandler, IWorkbenchContributi
private
registerListeners
():
void
{
this
.
toUnbind
.
push
(
this
.
textFileService
.
models
.
onModelSaved
(
e
=>
this
.
onFileSavedOrReverted
(
e
.
resource
)));
this
.
toUnbind
.
push
(
this
.
textFileService
.
models
.
onModelReverted
(
e
=>
this
.
onFileSavedOrReverted
(
e
.
resource
)));
this
.
toUnbind
.
push
(
this
.
editor
GroupService
.
onEditorsChanged
(()
=>
this
.
onEditorsChanged
()));
this
.
toUnbind
.
push
(
this
.
editor
Service
.
onDidActiveEditorChange
(()
=>
this
.
onEditorsChanged
()));
}
private
onEditorsChanged
():
void
{
let
isActiveEditorSaveConflictResolution
=
false
;
let
activeConflictResolutionResource
:
URI
;
const
active
Editor
=
this
.
editorService
.
getActiveEditor
()
;
if
(
active
Editor
&&
activeEditor
.
input
instanceof
DiffEditorInput
&&
activeEditor
.
input
.
originalInput
instanceof
ResourceEditorInput
&&
activeEditor
.
i
nput
.
modifiedInput
instanceof
FileEditorInput
)
{
const
resource
=
active
Editor
.
i
nput
.
originalInput
.
getResource
();
const
active
Input
=
this
.
editorService
.
activeEditor
;
if
(
active
Input
instanceof
DiffEditorInput
&&
activeInput
.
originalInput
instanceof
ResourceEditorInput
&&
activeI
nput
.
modifiedInput
instanceof
FileEditorInput
)
{
const
resource
=
active
I
nput
.
originalInput
.
getResource
();
if
(
resource
&&
resource
.
scheme
===
CONFLICT_RESOLUTION_SCHEME
)
{
isActiveEditorSaveConflictResolution
=
true
;
activeConflictResolutionResource
=
active
Editor
.
i
nput
.
modifiedInput
.
getResource
();
activeConflictResolutionResource
=
active
I
nput
.
modifiedInput
.
getResource
();
}
}
...
...
@@ -232,7 +230,7 @@ class ResolveSaveConflictAction extends Action {
constructor
(
private
model
:
ITextFileEditorModel
,
@
I
WorkbenchEditorService
private
editorService
:
IWorkbench
EditorService
,
@
I
NextEditorService
private
editorService
:
INext
EditorService
,
@
INotificationService
private
notificationService
:
INotificationService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IStorageService
private
storageService
:
IStorageService
,
...
...
@@ -313,11 +311,11 @@ class OverwriteReadonlyAction extends Action {
}
export
const
acceptLocalChangesCommand
=
(
accessor
:
ServicesAccessor
,
resource
:
URI
)
=>
{
const
editorService
=
accessor
.
get
(
I
Workbench
EditorService
);
const
editorService
=
accessor
.
get
(
I
Next
EditorService
);
const
resolverService
=
accessor
.
get
(
ITextModelService
);
const
modelService
=
accessor
.
get
(
IModelService
);
const
editor
=
editorService
.
getActiveEditor
()
;
const
editor
=
editorService
.
activeControl
;
const
input
=
editor
.
input
;
const
position
=
editor
.
group
;
...
...
@@ -342,7 +340,7 @@ export const acceptLocalChangesCommand = (accessor: ServicesAccessor, resource:
// Clean up
input
.
dispose
();
reference
.
dispose
();
editorService
.
closeEditor
(
position
,
input
);
editorService
.
closeEditor
(
input
,
position
);
});
});
});
...
...
@@ -350,10 +348,10 @@ export const acceptLocalChangesCommand = (accessor: ServicesAccessor, resource:
};
export
const
revertLocalChangesCommand
=
(
accessor
:
ServicesAccessor
,
resource
:
URI
)
=>
{
const
editorService
=
accessor
.
get
(
I
Workbench
EditorService
);
const
editorService
=
accessor
.
get
(
I
Next
EditorService
);
const
resolverService
=
accessor
.
get
(
ITextModelService
);
const
editor
=
editorService
.
getActiveEditor
()
;
const
editor
=
editorService
.
activeControl
;
const
input
=
editor
.
input
;
const
position
=
editor
.
group
;
...
...
@@ -371,7 +369,7 @@ export const revertLocalChangesCommand = (accessor: ServicesAccessor, resource:
// Clean up
input
.
dispose
();
reference
.
dispose
();
editorService
.
closeEditor
(
position
,
input
);
editorService
.
closeEditor
(
input
,
position
);
});
});
});
...
...
src/vs/workbench/parts/files/electron-browser/views/explorerView.ts
浏览文件 @
08f1beb9
...
...
@@ -20,12 +20,10 @@ import { RefreshViewExplorerAction, NewFolderAction, NewFileAction } from 'vs/wo
import
{
FileDragAndDrop
,
FileFilter
,
FileSorter
,
FileController
,
FileRenderer
,
FileDataSource
,
FileViewletState
,
FileAccessibilityProvider
}
from
'
vs/workbench/parts/files/electron-browser/views/explorerViewer
'
;
import
{
toResource
}
from
'
vs/workbench/common/editor
'
;
import
{
DiffEditorInput
}
from
'
vs/workbench/common/editor/diffEditorInput
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
*
as
DOM
from
'
vs/base/browser/dom
'
;
import
{
CollapseAction
}
from
'
vs/workbench/browser/viewlet
'
;
import
{
IViewletViewOptions
,
IViewOptions
,
TreeViewsViewletPanel
,
FileIconThemableWorkbenchTree
}
from
'
vs/workbench/browser/parts/views/viewsViewlet
'
;
import
{
ExplorerItem
,
Model
}
from
'
vs/workbench/parts/files/common/explorerModel
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IPartService
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
ExplorerDecorationsProvider
}
from
'
vs/workbench/parts/files/electron-browser/views/explorerDecorationsProvider
'
;
import
{
IWorkspaceContextService
,
WorkbenchState
,
IWorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
...
...
@@ -43,6 +41,7 @@ import { WorkbenchTree } from 'vs/platform/list/browser/listService';
import
{
DelayedDragHandler
}
from
'
vs/base/browser/dnd
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
export
interface
IExplorerViewOptions
extends
IViewletViewOptions
{
viewletState
:
FileViewletState
;
...
...
@@ -84,10 +83,9 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView
@
INotificationService
private
notificationService
:
INotificationService
,
@
IContextMenuService
contextMenuService
:
IContextMenuService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IEditorGroupService
private
editorGroupService
:
IEditorGroupService
,
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
,
@
IProgressService
private
progressService
:
IProgressService
,
@
I
WorkbenchEditorService
private
editorService
:
IWorkbench
EditorService
,
@
I
NextEditorService
private
editorService
:
INext
EditorService
,
@
IFileService
private
fileService
:
IFileService
,
@
IPartService
private
partService
:
IPartService
,
@
IKeybindingService
keybindingService
:
IKeybindingService
,
...
...
@@ -201,7 +199,7 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView
return
this
.
doRefresh
(
targetsToExpand
).
then
(()
=>
{
// When the explorer viewer is loaded, listen to changes to the editor input
this
.
disposables
.
push
(
this
.
editor
GroupService
.
onEditorsChanged
(()
=>
this
.
revealActiveFile
()));
this
.
disposables
.
push
(
this
.
editor
Service
.
onDidActiveEditorChange
(()
=>
this
.
revealActiveFile
()));
// Also handle configuration updates
this
.
disposables
.
push
(
this
.
configurationService
.
onDidChangeConfiguration
(
e
=>
this
.
onConfigurationUpdated
(
this
.
configurationService
.
getValue
<
IFilesConfiguration
>
(),
e
)));
...
...
@@ -237,7 +235,7 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView
}
// Handle closed or untitled file (convince explorer to not reopen any file when getting visible)
const
activeInput
=
this
.
editorService
.
getActiveEditorInput
()
;
const
activeInput
=
this
.
editorService
.
activeEditor
;
if
(
!
activeInput
||
toResource
(
activeInput
,
{
supportSideBySide
:
true
,
filter
:
Schemas
.
untitled
}))
{
this
.
settings
[
ExplorerView
.
MEMENTO_LAST_ACTIVE_FILE_RESOURCE
]
=
void
0
;
clearFocus
=
true
;
...
...
@@ -347,7 +345,7 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView
}
if
(
lastActiveFileResource
&&
this
.
isCreated
&&
this
.
model
.
findClosest
(
lastActiveFileResource
))
{
this
.
editorService
.
openEditor
({
resource
:
lastActiveFileResource
,
options
:
{
revealIfVisible
:
true
}
}).
done
(
null
,
errors
.
onUnexpectedError
);
this
.
editorService
.
openEditor
({
resource
:
lastActiveFileResource
,
options
:
{
revealIfVisible
:
true
}
}).
then
(
null
,
errors
.
onUnexpectedError
);
return
refreshPromise
;
}
...
...
@@ -365,12 +363,12 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView
private
openFocusedElement
(
preserveFocus
?:
boolean
):
void
{
const
stat
:
ExplorerItem
=
this
.
explorerViewer
.
getFocus
();
if
(
stat
&&
!
stat
.
isDirectory
)
{
this
.
editorService
.
openEditor
({
resource
:
stat
.
resource
,
options
:
{
preserveFocus
,
revealIfVisible
:
true
}
}).
done
(
null
,
errors
.
onUnexpectedError
);
this
.
editorService
.
openEditor
({
resource
:
stat
.
resource
,
options
:
{
preserveFocus
,
revealIfVisible
:
true
}
}).
then
(
null
,
errors
.
onUnexpectedError
);
}
}
private
getActiveFile
():
URI
{
const
input
=
this
.
editorService
.
getActiveEditorInput
()
;
const
input
=
this
.
editorService
.
activeEditor
;
// ignore diff editor inputs (helps to get out of diffing when returning to explorer)
if
(
input
instanceof
DiffEditorInput
)
{
...
...
src/vs/workbench/parts/files/electron-browser/views/explorerViewer.ts
浏览文件 @
08f1beb9
...
...
@@ -30,7 +30,6 @@ import { DesktopDragAndDropData, ExternalElementsDragAndDropData } from 'vs/base
import
{
ClickBehavior
}
from
'
vs/base/parts/tree/browser/treeDefaults
'
;
import
{
ExplorerItem
,
NewStatPlaceholder
,
Model
}
from
'
vs/workbench/parts/files/common/explorerModel
'
;
import
{
DragMouseEvent
,
IMouseEvent
}
from
'
vs/base/browser/mouseEvent
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IPartService
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
IWorkspaceContextService
,
WorkbenchState
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IConfigurationService
,
ConfigurationTarget
}
from
'
vs/platform/configuration/common/configuration
'
;
...
...
@@ -57,6 +56,7 @@ import { IWorkspaceFolderCreationData } from 'vs/platform/workspaces/common/work
import
{
rtrim
}
from
'
vs/base/common/strings
'
;
import
{
IDialogService
,
IConfirmationResult
,
IConfirmation
,
getConfirmMessage
}
from
'
vs/platform/dialogs/common/dialogs
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
INextEditorService
,
SIDE_GROUP
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
export
class
FileDataSource
implements
IDataSource
{
constructor
(
...
...
@@ -395,7 +395,7 @@ export class FileController extends WorkbenchTreeController implements IDisposab
private
previousSelectionRangeStop
:
ExplorerItem
;
constructor
(
@
I
WorkbenchEditorService
private
editorService
:
IWorkbench
EditorService
,
@
I
NextEditorService
private
editorService
:
INext
EditorService
,
@
IContextMenuService
private
contextMenuService
:
IContextMenuService
,
@
ITelemetryService
private
telemetryService
:
ITelemetryService
,
@
IMenuService
private
menuService
:
IMenuService
,
...
...
@@ -551,7 +551,7 @@ export class FileController extends WorkbenchTreeController implements IDisposab
*/
this
.
telemetryService
.
publicLog
(
'
workbenchActionExecuted
'
,
{
id
:
'
workbench.files.openFile
'
,
from
:
'
explorer
'
});
this
.
editorService
.
openEditor
({
resource
:
stat
.
resource
,
options
},
options
.
sideBySide
).
done
(
null
,
errors
.
onUnexpectedError
);
this
.
editorService
.
openEditor
({
resource
:
stat
.
resource
,
options
},
SIDE_GROUP
).
then
(
null
,
errors
.
onUnexpectedError
);
}
}
...
...
src/vs/workbench/parts/files/test/browser/fileEditorInput.test.ts
浏览文件 @
08f1beb9
...
...
@@ -9,14 +9,14 @@ import URI from 'vs/base/common/uri';
import
{
join
}
from
'
vs/base/common/paths
'
;
import
{
FileEditorInput
}
from
'
vs/workbench/parts/files/common/editors/fileEditorInput
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
workbenchInstantiationService
,
TestTextFileService
,
TestEditorGroupService
}
from
'
vs/workbench/test/workbenchTestServices
'
;
import
{
workbenchInstantiationService
,
TestTextFileService
}
from
'
vs/workbench/test/workbenchTestServices
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
EncodingMode
,
Verbosity
}
from
'
vs/workbench/common/editor
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
FileOperationResult
,
FileOperationError
}
from
'
vs/platform/files/common/files
'
;
import
{
TextFileEditorModel
}
from
'
vs/workbench/services/textfile/common/textFileEditorModel
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
INextEditorGroupsService
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
function
toResource
(
self
,
path
)
{
return
URI
.
file
(
join
(
'
C:
\\
'
,
Buffer
.
from
(
self
.
test
.
fullTitle
()).
toString
(
'
base64
'
),
path
));
...
...
@@ -27,7 +27,7 @@ class ServiceAccessor {
@
IWorkbenchEditorService
public
editorService
:
IWorkbenchEditorService
,
@
ITextFileService
public
textFileService
:
TestTextFileService
,
@
IModelService
public
modelService
:
IModelService
,
@
I
EditorGroupService
public
editorGroupService
:
TestEditorGroup
Service
@
I
NextEditorGroupsService
public
editorGroupService
:
INextEditorGroups
Service
)
{
}
}
...
...
@@ -184,4 +184,4 @@ suite('Files - FileEditorInput', () => {
resolved
.
dispose
();
});
});
});
\ No newline at end of file
});
src/vs/workbench/parts/files/test/browser/fileEditorTracker.test.ts
浏览文件 @
08f1beb9
...
...
@@ -13,10 +13,10 @@ import { join } from 'vs/base/common/paths';
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
workbenchInstantiationService
,
TestTextFileService
,
TestFileService
}
from
'
vs/workbench/test/workbenchTestServices
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
/*FileOperation, FileOperationEvent,*/
FileChangesEvent
,
FileChangeType
,
IFileService
,
snapshotToString
}
from
'
vs/platform/files/common/files
'
;
import
{
TextFileEditorModel
}
from
'
vs/workbench/services/textfile/common/textFileEditorModel
'
;
import
{
INextEditorGroupsService
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
// import { once } from 'vs/base/common/event';
// class TestFileEditorTracker extends FileEditorTracker {
...
...
@@ -33,7 +33,7 @@ function toResource(self: any, path: string) {
class
ServiceAccessor
{
constructor
(
@
IWorkbenchEditorService
public
editorService
:
IWorkbenchEditorService
,
@
I
EditorGroupService
public
editorGroupService
:
IEditorGroup
Service
,
@
I
NextEditorGroupsService
public
editorGroupService
:
INextEditorGroups
Service
,
@
ITextFileService
public
textFileService
:
TestTextFileService
,
@
IFileService
public
fileService
:
TestFileService
)
{
...
...
src/vs/workbench/parts/output/browser/logViewer.ts
浏览文件 @
08f1beb9
...
...
@@ -11,7 +11,6 @@ import { ITextResourceConfigurationService } from 'vs/editor/common/services/res
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
AbstractTextResourceEditor
}
from
'
vs/workbench/browser/parts/editor/textResourceEditor
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ResourceEditorInput
}
from
'
vs/workbench/common/editor/resourceEditorInput
'
;
...
...
@@ -20,7 +19,7 @@ import { ITextModelService } from 'vs/editor/common/services/resolverService';
import
{
IHashService
}
from
'
vs/workbench/services/hash/common/hashService
'
;
import
{
LOG_SCHEME
}
from
'
vs/workbench/parts/output/common/output
'
;
import
{
INextEditorGroupsService
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
export
class
LogViewerInput
extends
ResourceEditorInput
{
...
...
@@ -53,11 +52,11 @@ export class LogViewer extends AbstractTextResourceEditor {
@
IConfigurationService
baseConfigurationService
:
IConfigurationService
,
@
ITextResourceConfigurationService
textResourceConfigurationService
:
ITextResourceConfigurationService
,
@
IThemeService
themeService
:
IThemeService
,
@
I
EditorGroupService
editorGroupService
:
IEditorGroup
Service
,
@
I
NextEditorGroupsService
editorGroupService
:
INextEditorGroups
Service
,
@
ITextFileService
textFileService
:
ITextFileService
,
@
INextEditor
GroupsService
nextEditorGroupService
:
INextEditorGroups
Service
@
INextEditor
Service
editorService
:
INextEditor
Service
)
{
super
(
LogViewer
.
LOG_VIEWER_EDITOR_ID
,
telemetryService
,
instantiationService
,
storageService
,
textResourceConfigurationService
,
themeService
,
editorGroupService
,
textFileService
,
nextEditorGroup
Service
);
super
(
LogViewer
.
LOG_VIEWER_EDITOR_ID
,
telemetryService
,
instantiationService
,
storageService
,
textResourceConfigurationService
,
themeService
,
editorGroupService
,
textFileService
,
editor
Service
);
}
protected
getConfigurationOverrides
():
IEditorOptions
{
...
...
src/vs/workbench/parts/output/browser/outputPanel.ts
浏览文件 @
08f1beb9
...
...
@@ -20,11 +20,11 @@ import { AbstractTextResourceEditor } from 'vs/workbench/browser/parts/editor/te
import
{
OUTPUT_PANEL_ID
,
IOutputService
,
CONTEXT_IN_OUTPUT
}
from
'
vs/workbench/parts/output/common/output
'
;
import
{
SwitchOutputAction
,
SwitchOutputActionItem
,
ClearOutputAction
,
ToggleOutputScrollLockAction
,
OpenLogOutputFile
}
from
'
vs/workbench/parts/output/browser/outputActions
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
INextEditorGroupsService
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
export
class
OutputPanel
extends
AbstractTextResourceEditor
{
private
actions
:
IAction
[];
...
...
@@ -39,11 +39,11 @@ export class OutputPanel extends AbstractTextResourceEditor {
@
IThemeService
themeService
:
IThemeService
,
@
IOutputService
private
outputService
:
IOutputService
,
@
IContextKeyService
private
contextKeyService
:
IContextKeyService
,
@
I
EditorGroupService
editorGroupService
:
IEditorGroup
Service
,
@
I
NextEditorGroupsService
editorGroupService
:
INextEditorGroups
Service
,
@
ITextFileService
textFileService
:
ITextFileService
,
@
INextEditor
GroupsService
nextEditorGroupService
:
INextEditorGroups
Service
@
INextEditor
Service
editorService
:
INextEditor
Service
)
{
super
(
OUTPUT_PANEL_ID
,
telemetryService
,
instantiationService
,
storageService
,
textResourceConfigurationService
,
themeService
,
editorGroupService
,
textFileService
,
nextEditorGroup
Service
);
super
(
OUTPUT_PANEL_ID
,
telemetryService
,
instantiationService
,
storageService
,
textResourceConfigurationService
,
themeService
,
editorGroupService
,
textFileService
,
editor
Service
);
this
.
scopedInstantiationService
=
instantiationService
;
}
...
...
src/vs/workbench/parts/preferences/browser/preferencesEditor.ts
浏览文件 @
08f1beb9
...
...
@@ -42,7 +42,6 @@ import { VSash } from 'vs/base/browser/ui/sash/sash';
import
{
Widget
}
from
'
vs/base/browser/ui/widget
'
;
import
{
IPreferencesRenderer
,
DefaultSettingsRenderer
,
UserSettingsRenderer
,
WorkspaceSettingsRenderer
,
FolderSettingsRenderer
}
from
'
vs/workbench/parts/preferences/browser/preferencesRenderers
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
IEditorRegistry
,
Extensions
as
EditorExtensions
}
from
'
vs/workbench/browser/editor
'
;
import
{
FoldingController
}
from
'
vs/editor/contrib/folding/folding
'
;
import
{
FindController
}
from
'
vs/editor/contrib/find/findController
'
;
...
...
@@ -63,6 +62,7 @@ import { PreferencesEditorInput, DefaultPreferencesEditorInput } from 'vs/workbe
import
{
PREFERENCES_EDITOR_ID
}
from
'
vs/workbench/parts/files/common/files
'
;
import
{
INextEditorGroupsService
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
export
class
PreferencesEditor
extends
BaseEditor
{
...
...
@@ -966,10 +966,10 @@ export class DefaultPreferencesEditor extends BaseTextEditor {
@
ITextResourceConfigurationService
configurationService
:
ITextResourceConfigurationService
,
@
IThemeService
themeService
:
IThemeService
,
@
ITextFileService
textFileService
:
ITextFileService
,
@
I
EditorGroupService
editorGroupService
:
IEditorGroup
Service
,
@
INextEditor
GroupsService
nextEditorGroupService
:
INextEditorGroups
Service
@
I
NextEditorGroupsService
editorGroupService
:
INextEditorGroups
Service
,
@
INextEditor
Service
editorService
:
INextEditor
Service
)
{
super
(
DefaultPreferencesEditor
.
ID
,
telemetryService
,
instantiationService
,
storageService
,
configurationService
,
themeService
,
textFileService
,
editor
GroupService
,
nextE
ditorGroupService
);
super
(
DefaultPreferencesEditor
.
ID
,
telemetryService
,
instantiationService
,
storageService
,
configurationService
,
themeService
,
textFileService
,
editor
Service
,
e
ditorGroupService
);
}
private
static
_getContributions
():
IEditorContributionCtor
[]
{
...
...
src/vs/workbench/parts/scm/electron-browser/scm.contribution.ts
浏览文件 @
08f1beb9
...
...
@@ -15,18 +15,18 @@ import { IWorkbenchActionRegistry, Extensions as WorkbenchActionExtensions } fro
import
{
KeyMod
,
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
SyncActionDescriptor
}
from
'
vs/platform/actions/common/actions
'
;
import
{
IViewletService
}
from
'
vs/workbench/services/viewlet/browser/viewlet
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
StatusUpdater
,
StatusBarController
}
from
'
./scmActivity
'
;
import
{
SCMViewlet
}
from
'
vs/workbench/parts/scm/electron-browser/scmViewlet
'
;
import
{
LifecyclePhase
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
IConfigurationRegistry
,
Extensions
as
ConfigurationExtensions
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
class
OpenSCMViewletAction
extends
ToggleViewletAction
{
static
readonly
ID
=
VIEWLET_ID
;
static
LABEL
=
localize
(
'
toggleGitViewlet
'
,
"
Show Git
"
);
constructor
(
id
:
string
,
label
:
string
,
@
IViewletService
viewletService
:
IViewletService
,
@
I
WorkbenchEditorService
editorService
:
IWorkbench
EditorService
)
{
constructor
(
id
:
string
,
label
:
string
,
@
IViewletService
viewletService
:
IViewletService
,
@
I
NextEditorService
editorService
:
INext
EditorService
)
{
super
(
id
,
label
,
VIEWLET_ID
,
viewletService
,
editorService
);
}
}
...
...
@@ -87,4 +87,4 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).regis
description
:
localize
(
'
diffGutterWidth
'
,
"
Controls the width(px) of diff decorations in gutter (added & modified).
"
)
}
}
});
\ No newline at end of file
});
src/vs/workbench/parts/search/electron-browser/search.contribution.ts
浏览文件 @
08f1beb9
...
...
@@ -46,7 +46,6 @@ import URI from 'vs/base/common/uri';
import
{
relative
}
from
'
path
'
;
import
{
dirname
}
from
'
vs/base/common/resources
'
;
import
{
ResourceContextKey
}
from
'
vs/workbench/common/resources
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
distinct
}
from
'
vs/base/common/arrays
'
;
import
{
getMultiSelectedResources
}
from
'
vs/workbench/parts/files/browser/files
'
;
...
...
@@ -59,6 +58,7 @@ import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } fr
import
{
LifecyclePhase
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
SearchViewLocationUpdater
}
from
'
vs/workbench/parts/search/browser/searchViewLocationUpdater
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
registerSingleton
(
ISearchWorkbenchService
,
SearchWorkbenchService
);
replaceContributions
();
...
...
@@ -337,7 +337,7 @@ CommandsRegistry.registerCommand({
const
viewletService
=
accessor
.
get
(
IViewletService
);
const
panelService
=
accessor
.
get
(
IPanelService
);
const
fileService
=
accessor
.
get
(
IFileService
);
const
resources
=
getMultiSelectedResources
(
resource
,
listService
,
accessor
.
get
(
I
Workbench
EditorService
));
const
resources
=
getMultiSelectedResources
(
resource
,
listService
,
accessor
.
get
(
I
Next
EditorService
));
return
openSearchView
(
viewletService
,
panelService
,
true
).
then
(
searchView
=>
{
if
(
resources
&&
resources
.
length
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录