Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
1c6e2f95
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1c6e2f95
编写于
5月 09, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
grid - adopt some next editor services in quick open
上级
82b09e61
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
82 addition
and
69 deletion
+82
-69
src/vs/workbench/browser/parts/editor2/nextEditorActions.ts
src/vs/workbench/browser/parts/editor2/nextEditorActions.ts
+2
-2
src/vs/workbench/browser/parts/quickopen/quickOpenController.ts
.../workbench/browser/parts/quickopen/quickOpenController.ts
+9
-9
src/vs/workbench/browser/quickopen.ts
src/vs/workbench/browser/quickopen.ts
+4
-5
src/vs/workbench/parts/quickopen/browser/gotoLineHandler.ts
src/vs/workbench/parts/quickopen/browser/gotoLineHandler.ts
+27
-30
src/vs/workbench/parts/search/browser/openFileHandler.ts
src/vs/workbench/parts/search/browser/openFileHandler.ts
+2
-2
src/vs/workbench/parts/search/browser/openSymbolHandler.ts
src/vs/workbench/parts/search/browser/openSymbolHandler.ts
+2
-2
src/vs/workbench/services/editor/browser/nextEditorService.ts
...vs/workbench/services/editor/browser/nextEditorService.ts
+19
-10
src/vs/workbench/services/editor/common/nextEditorService.ts
src/vs/workbench/services/editor/common/nextEditorService.ts
+17
-9
未找到文件。
src/vs/workbench/browser/parts/editor2/nextEditorActions.ts
浏览文件 @
1c6e2f95
...
...
@@ -14,7 +14,7 @@ import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/edi
import
{
EditorInput
}
from
'
vs/workbench/common/editor
'
;
import
{
join
,
dirname
}
from
'
vs/base/common/paths
'
;
import
{
isWindows
}
from
'
vs/base/common/platform
'
;
import
{
INextEditorService
,
SIDE_
BY_SIDE
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
import
{
INextEditorService
,
SIDE_
GROUP
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
function
getVSCodeBaseFolder
():
string
{
let
workingDir
=
process
.
cwd
();
...
...
@@ -138,7 +138,7 @@ export class GridOpenOneEditorSideBySideAction extends Action {
run
():
TPromise
<
any
>
{
const
path
=
join
(
getVSCodeBaseFolder
(),
'
src/vs/workbench/browser/parts/editor/editor.contribution.ts
'
);
this
.
editorService
.
openEditor
(
this
.
legacyEditorService
.
createInput
({
resource
:
URI
.
file
(
path
)
})
as
EditorInput
,
null
,
SIDE_
BY_SIDE
);
this
.
editorService
.
openEditor
(
this
.
legacyEditorService
.
createInput
({
resource
:
URI
.
file
(
path
)
})
as
EditorInput
,
null
,
SIDE_
GROUP
);
return
TPromise
.
as
(
void
0
);
}
...
...
src/vs/workbench/browser/parts/quickopen/quickOpenController.ts
浏览文件 @
1c6e2f95
...
...
@@ -34,7 +34,6 @@ import { Event, Emitter } from 'vs/base/common/event';
import
{
IPartService
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
QuickOpenHandler
,
QuickOpenHandlerDescriptor
,
IQuickOpenRegistry
,
Extensions
,
EditorQuickOpenEntry
,
CLOSE_ON_FOCUS_LOST_CONFIG
}
from
'
vs/workbench/browser/quickopen
'
;
import
*
as
errors
from
'
vs/base/common/errors
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IPickOpenEntry
,
IFilePickOpenEntry
,
IQuickOpenService
,
IPickOptions
,
IShowOptions
,
IPickOpenItem
}
from
'
vs/platform/quickOpen/common/quickOpen
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -56,6 +55,7 @@ import { Schemas } from 'vs/base/common/network';
import
Severity
from
'
vs/base/common/severity
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
Dimension
,
addClass
}
from
'
vs/base/browser/dom
'
;
import
{
INextEditorService
,
ACTIVE_GROUP
,
SIDE_GROUP
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
const
HELP_PREFIX
=
'
?
'
;
...
...
@@ -101,7 +101,7 @@ export class QuickOpenController extends Component implements IQuickOpenService
private
editorHistoryHandler
:
EditorHistoryHandler
;
constructor
(
@
I
WorkbenchEditorService
private
editorService
:
IWorkbench
EditorService
,
@
I
NextEditorService
private
editorService
:
INext
EditorService
,
@
INotificationService
private
notificationService
:
INotificationService
,
@
IContextKeyService
private
contextKeyService
:
IContextKeyService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
...
...
@@ -514,7 +514,7 @@ export class QuickOpenController extends Component implements IQuickOpenService
if
(
!
quickNavigateConfiguration
)
{
autoFocus
=
{
autoFocusFirstEntry
:
true
};
}
else
{
const
visibleEditorCount
=
this
.
editorService
.
getVisibleEditors
()
.
length
;
const
visibleEditorCount
=
this
.
editorService
.
visibleEditors
.
length
;
autoFocus
=
{
autoFocusFirstEntry
:
visibleEditorCount
===
0
,
autoFocusSecondEntry
:
visibleEditorCount
!==
0
};
}
}
...
...
@@ -635,9 +635,9 @@ export class QuickOpenController extends Component implements IQuickOpenService
private
restoreFocus
():
void
{
// Try to focus active editor
const
editor
=
this
.
editorService
.
getActiveEditor
()
;
if
(
editor
)
{
editor
.
focus
();
const
editor
Control
=
this
.
editorService
.
activeControl
;
if
(
editor
Control
)
{
editor
Control
.
focus
();
}
}
...
...
@@ -1184,7 +1184,7 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
constructor
(
input
:
IEditorInput
|
IResourceInput
,
@
I
WorkbenchEditorService
editorService
:
IWorkbench
EditorService
,
@
I
NextEditorService
editorService
:
INext
EditorService
,
@
IModeService
private
modeService
:
IModeService
,
@
IModelService
private
modelService
:
IModelService
,
@
ITextFileService
private
textFileService
:
ITextFileService
,
...
...
@@ -1251,9 +1251,9 @@ export class EditorHistoryEntry extends EditorQuickOpenEntry {
const
pinned
=
!
this
.
configurationService
.
getValue
<
IWorkbenchEditorConfiguration
>
().
workbench
.
editor
.
enablePreviewFromQuickOpen
||
context
.
keymods
.
alt
;
if
(
this
.
input
instanceof
EditorInput
)
{
this
.
editorService
.
openEditor
(
this
.
input
,
{
pinned
},
sideBySide
).
done
(
null
,
errors
.
onUnexpectedError
);
this
.
editorService
.
openEditor
(
this
.
input
,
{
pinned
},
sideBySide
?
SIDE_GROUP
:
ACTIVE_GROUP
);
}
else
{
this
.
editorService
.
openEditor
({
resource
:
(
this
.
input
as
IResourceInput
).
resource
,
options
:
{
pinned
}
},
sideBySide
);
this
.
editorService
.
openEditor
({
resource
:
(
this
.
input
as
IResourceInput
).
resource
,
options
:
{
pinned
}
},
sideBySide
?
SIDE_GROUP
:
ACTIVE_GROUP
);
}
return
true
;
...
...
src/vs/workbench/browser/quickopen.ts
浏览文件 @
1c6e2f95
...
...
@@ -10,16 +10,15 @@ import * as objects from 'vs/base/common/objects';
import
*
as
arrays
from
'
vs/base/common/arrays
'
;
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
*
as
types
from
'
vs/base/common/types
'
;
import
*
as
errors
from
'
vs/base/common/errors
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
Mode
,
IEntryRunContext
,
IAutoFocus
,
IModel
,
IQuickNavigateConfiguration
}
from
'
vs/base/parts/quickopen/common/quickOpen
'
;
import
{
QuickOpenEntry
,
QuickOpenEntryGroup
}
from
'
vs/base/parts/quickopen/browser/quickOpenModel
'
;
import
{
EditorOptions
,
EditorInput
}
from
'
vs/workbench/common/editor
'
;
import
{
IResourceInput
,
IEditorInput
,
IEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IQuickOpenService
}
from
'
vs/platform/quickOpen/common/quickOpen
'
;
import
{
IConstructorSignature0
,
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
INextEditorService
,
SIDE_GROUP
,
ACTIVE_GROUP
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
export
const
CLOSE_ON_FOCUS_LOST_CONFIG
=
'
workbench.quickOpen.closeOnFocusLost
'
;
...
...
@@ -246,7 +245,7 @@ export interface IEditorQuickOpenEntry {
*/
export
class
EditorQuickOpenEntry
extends
QuickOpenEntry
implements
IEditorQuickOpenEntry
{
constructor
(
private
_editorService
:
I
Workbench
EditorService
)
{
constructor
(
private
_editorService
:
I
Next
EditorService
)
{
super
();
}
...
...
@@ -284,7 +283,7 @@ export class EditorQuickOpenEntry extends QuickOpenEntry implements IEditorQuick
opts
=
EditorOptions
.
create
(
openOptions
);
}
this
.
editorService
.
openEditor
(
input
,
opts
,
sideBySide
).
done
(
null
,
errors
.
onUnexpectedError
);
this
.
editorService
.
openEditor
(
input
,
opts
,
sideBySide
?
SIDE_GROUP
:
ACTIVE_GROUP
);
}
else
{
const
resourceInput
=
<
IResourceInput
>
input
;
...
...
@@ -292,7 +291,7 @@ export class EditorQuickOpenEntry extends QuickOpenEntry implements IEditorQuick
resourceInput
.
options
=
objects
.
assign
(
resourceInput
.
options
||
Object
.
create
(
null
),
openOptions
);
}
this
.
editorService
.
openEditor
(
resourceInput
,
sideBySide
).
done
(
null
,
errors
.
onUnexpectedError
);
this
.
editorService
.
openEditor
(
resourceInput
,
sideBySide
?
SIDE_GROUP
:
ACTIVE_GROUP
);
}
}
...
...
src/vs/workbench/parts/quickopen/browser/gotoLineHandler.ts
浏览文件 @
1c6e2f95
...
...
@@ -7,12 +7,11 @@
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
*
as
types
from
'
vs/base/common/types
'
;
import
*
as
errors
from
'
vs/base/common/errors
'
;
import
{
IEntryRunContext
,
Mode
,
IAutoFocus
}
from
'
vs/base/parts/quickopen/common/quickOpen
'
;
import
{
QuickOpenModel
}
from
'
vs/base/parts/quickopen/browser/quickOpenModel
'
;
import
{
QuickOpenHandler
,
EditorQuickOpenEntry
,
QuickOpenAction
}
from
'
vs/workbench/browser/quickopen
'
;
import
{
IEditor
,
IEditorViewState
,
IDiffEditorModel
,
ScrollType
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IModelDecorationsChangeAccessor
,
OverviewRulerLane
,
IModelDeltaDecoration
,
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
OverviewRulerLane
,
IModelDeltaDecoration
,
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
Position
,
IEditorInput
,
ITextEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IQuickOpenService
}
from
'
vs/platform/quickOpen/common/quickOpen
'
;
...
...
@@ -21,6 +20,7 @@ import { IRange } from 'vs/editor/common/core/range';
import
{
overviewRulerRangeHighlight
}
from
'
vs/editor/common/view/editorColorRegistry
'
;
import
{
themeColorFromId
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IEditorOptions
,
RenderLineNumbersType
}
from
'
vs/editor/common/config/editorOptions
'
;
import
{
INextEditorService
,
SIDE_GROUP
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
export
const
GOTO_LINE_PREFIX
=
'
:
'
;
...
...
@@ -75,7 +75,7 @@ class GotoLineEntry extends EditorQuickOpenEntry {
private
column
:
number
;
private
handler
:
GotoLineHandler
;
constructor
(
line
:
string
,
editorService
:
I
Workbench
EditorService
,
handler
:
GotoLineHandler
)
{
constructor
(
line
:
string
,
editorService
:
I
Next
EditorService
,
handler
:
GotoLineHandler
)
{
super
(
editorService
);
this
.
parseInput
(
line
);
...
...
@@ -109,9 +109,9 @@ class GotoLineEntry extends EditorQuickOpenEntry {
}
private
getMaxLineNumber
():
number
{
const
editor
=
this
.
editorService
.
getActiveEditor
()
;
const
editorControl
=
<
IEditor
>
editor
.
getControl
();
let
model
=
editorControl
.
getModel
();
const
codeEditor
=
this
.
editorService
.
activeTextEditorControl
;
let
model
=
codeEditor
.
getModel
();
if
(
model
&&
(
<
IDiffEditorModel
>
model
).
modified
&&
(
<
IDiffEditorModel
>
model
).
original
)
{
model
=
(
<
IDiffEditorModel
>
model
).
modified
;
// Support for diff editor models
}
...
...
@@ -128,7 +128,7 @@ class GotoLineEntry extends EditorQuickOpenEntry {
}
public
getInput
():
IEditorInput
{
return
this
.
editorService
.
getActiveEditorInput
()
;
return
this
.
editorService
.
activeEditor
;
}
public
getOptions
(
pinned
?:
boolean
):
ITextEditorOptions
{
...
...
@@ -148,16 +148,15 @@ class GotoLineEntry extends EditorQuickOpenEntry {
// Check for sideBySide use
const
sideBySide
=
context
.
keymods
.
ctrlCmd
;
if
(
sideBySide
)
{
this
.
editorService
.
openEditor
(
this
.
getInput
(),
this
.
getOptions
(
context
.
keymods
.
alt
),
true
).
done
(
null
,
errors
.
onUnexpectedError
);
this
.
editorService
.
openEditor
(
this
.
getInput
(),
this
.
getOptions
(
context
.
keymods
.
alt
),
SIDE_GROUP
);
}
// Apply selection and focus
const
range
=
this
.
toSelection
();
const
activeEditor
=
this
.
editorService
.
getActiveEditor
();
if
(
activeEditor
)
{
const
editor
=
<
IEditor
>
activeEditor
.
getControl
();
editor
.
setSelection
(
range
);
editor
.
revealRangeInCenter
(
range
,
ScrollType
.
Smooth
);
const
codeEditor
=
this
.
editorService
.
activeTextEditorControl
;
if
(
codeEditor
)
{
codeEditor
.
setSelection
(
range
);
codeEditor
.
revealRangeInCenter
(
range
,
ScrollType
.
Smooth
);
}
return
true
;
...
...
@@ -174,14 +173,13 @@ class GotoLineEntry extends EditorQuickOpenEntry {
// Select Line Position
const
range
=
this
.
toSelection
();
const
activeEditor
=
this
.
editorService
.
getActiveEditor
();
if
(
activeEditor
)
{
const
editorControl
=
<
IEditor
>
activeEditor
.
getControl
();
editorControl
.
revealRangeInCenter
(
range
,
ScrollType
.
Smooth
);
const
codeEditor
=
this
.
editorService
.
activeTextEditorControl
;
if
(
codeEditor
)
{
codeEditor
.
revealRangeInCenter
(
range
,
ScrollType
.
Smooth
);
// Decorate if possible
if
(
types
.
isFunction
(
editorControl
.
changeDecorations
))
{
this
.
handler
.
decorateOutline
(
range
,
editorControl
,
activeEditor
.
position
);
if
(
types
.
isFunction
(
codeEditor
.
changeDecorations
))
{
this
.
handler
.
decorateOutline
(
range
,
codeEditor
,
0
/* TODO@grid activeEditor.position */
);
}
}
...
...
@@ -211,7 +209,7 @@ export class GotoLineHandler extends QuickOpenHandler {
private
rangeHighlightDecorationId
:
IEditorLineDecoration
;
private
lastKnownEditorViewState
:
IEditorViewState
;
constructor
(@
I
WorkbenchEditorService
private
editorService
:
IWorkbench
EditorService
)
{
constructor
(@
I
NextEditorService
private
editorService
:
INext
EditorService
)
{
super
();
}
...
...
@@ -224,21 +222,21 @@ export class GotoLineHandler extends QuickOpenHandler {
// Remember view state to be able to restore on cancel
if
(
!
this
.
lastKnownEditorViewState
)
{
const
editor
=
this
.
editorService
.
getActiveEditor
()
;
this
.
lastKnownEditorViewState
=
(
<
IEditor
>
editor
.
getControl
())
.
saveViewState
();
const
codeEditor
=
this
.
editorService
.
activeTextEditorControl
;
this
.
lastKnownEditorViewState
=
codeEditor
.
saveViewState
();
}
return
TPromise
.
as
(
new
QuickOpenModel
([
new
GotoLineEntry
(
searchValue
,
this
.
editorService
,
this
)]));
}
public
canRun
():
boolean
|
string
{
const
canRun
=
getCodeEditor
(
this
.
editorService
.
getActiveEditor
())
!==
nul
l
;
const
canRun
=
!!
this
.
editorService
.
activeTextEditorContro
l
;
return
canRun
?
true
:
nls
.
localize
(
'
cannotRunGotoLine
'
,
"
Open a text file first to go to a line
"
);
}
public
decorateOutline
(
range
:
IRange
,
editor
:
IEditor
,
position
:
Position
):
void
{
editor
.
changeDecorations
(
(
changeAccessor
:
IModelDecorationsChangeAccessor
)
=>
{
editor
.
changeDecorations
(
changeAccessor
=>
{
const
deleteDecorations
:
string
[]
=
[];
if
(
this
.
rangeHighlightDecorationId
)
{
...
...
@@ -284,10 +282,10 @@ export class GotoLineHandler extends QuickOpenHandler {
public
clearDecorations
():
void
{
if
(
this
.
rangeHighlightDecorationId
)
{
this
.
editorService
.
getVisibleEditors
().
forEach
((
editor
)
=>
{
this
.
editorService
.
visibleControls
.
forEach
(
editor
=>
{
if
(
editor
.
position
===
this
.
rangeHighlightDecorationId
.
position
)
{
const
editorControl
=
<
IEditor
>
editor
.
getControl
();
editorControl
.
changeDecorations
(
(
changeAccessor
:
IModelDecorationsChangeAccessor
)
=>
{
editorControl
.
changeDecorations
(
changeAccessor
=>
{
changeAccessor
.
deltaDecorations
([
this
.
rangeHighlightDecorationId
.
lineDecorationId
,
this
.
rangeHighlightDecorationId
.
rangeHighlightId
...
...
@@ -307,10 +305,9 @@ export class GotoLineHandler extends QuickOpenHandler {
// Restore selection if canceled
if
(
canceled
&&
this
.
lastKnownEditorViewState
)
{
const
activeEditor
=
this
.
editorService
.
getActiveEditor
();
if
(
activeEditor
)
{
const
editor
=
<
IEditor
>
activeEditor
.
getControl
();
editor
.
restoreViewState
(
this
.
lastKnownEditorViewState
);
const
codeEditor
=
this
.
editorService
.
activeTextEditorControl
;
if
(
codeEditor
)
{
codeEditor
.
restoreViewState
(
this
.
lastKnownEditorViewState
);
}
}
...
...
src/vs/workbench/parts/search/browser/openFileHandler.ts
浏览文件 @
1c6e2f95
...
...
@@ -25,7 +25,6 @@ import { QueryBuilder } from 'vs/workbench/parts/search/common/queryBuilder';
import
{
EditorInput
,
IWorkbenchEditorConfiguration
}
from
'
vs/workbench/common/editor
'
;
import
{
IEditorGroupService
}
from
'
vs/workbench/services/group/common/groupService
'
;
import
{
IResourceInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IQueryOptions
,
ISearchService
,
ISearchStats
,
ISearchQuery
}
from
'
vs/platform/search/common/search
'
;
...
...
@@ -33,6 +32,7 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
IRange
}
from
'
vs/editor/common/core/range
'
;
import
{
getOutOfWorkspaceEditorResources
}
from
'
vs/workbench/parts/search/common/search
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
export
class
FileQuickOpenModel
extends
QuickOpenModel
{
...
...
@@ -49,7 +49,7 @@ export class FileEntry extends EditorQuickOpenEntry {
private
name
:
string
,
private
description
:
string
,
private
icon
:
string
,
@
I
WorkbenchEditorService
editorService
:
IWorkbench
EditorService
,
@
I
NextEditorService
editorService
:
INext
EditorService
,
@
IModeService
private
modeService
:
IModeService
,
@
IModelService
private
modelService
:
IModelService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
,
...
...
src/vs/workbench/parts/search/browser/openSymbolHandler.ts
浏览文件 @
1c6e2f95
...
...
@@ -19,13 +19,13 @@ import { EditorInput, IWorkbenchEditorConfiguration } from 'vs/workbench/common/
import
*
as
labels
from
'
vs/base/common/labels
'
;
import
{
SymbolInformation
,
symbolKindToCssClass
}
from
'
vs/editor/common/modes
'
;
import
{
IResourceInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IWorkspaceSymbolProvider
,
getWorkspaceSymbols
}
from
'
vs/workbench/parts/search/common/search
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
basename
}
from
'
vs/base/common/paths
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
class
SymbolEntry
extends
EditorQuickOpenEntry
{
...
...
@@ -36,7 +36,7 @@ class SymbolEntry extends EditorQuickOpenEntry {
private
_provider
:
IWorkspaceSymbolProvider
,
@
IConfigurationService
private
readonly
_configurationService
:
IConfigurationService
,
@
IWorkspaceContextService
private
readonly
_contextService
:
IWorkspaceContextService
,
@
I
WorkbenchEditorService
editorService
:
IWorkbench
EditorService
,
@
I
NextEditorService
editorService
:
INext
EditorService
,
@
IEnvironmentService
private
readonly
_environmentService
:
IEnvironmentService
)
{
super
(
editorService
);
...
...
src/vs/workbench/services/editor/browser/nextEditorService.ts
浏览文件 @
1c6e2f95
...
...
@@ -25,7 +25,7 @@ import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
import
{
localize
}
from
'
vs/nls
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
INextEditorGroupsService
,
INextEditorGroup
,
GroupDirection
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
import
{
INextEditorService
,
IResourceEditor
,
SIDE_BY_SIDE_TYPE
,
SIDE_BY_SIDE
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
import
{
INextEditorService
,
IResourceEditor
,
ACTIVE_GROUP_TYPE
,
SIDE_GROUP_TYPE
,
SIDE_GROUP
,
ACTIVE_GROUP
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
Disposable
,
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
coalesce
}
from
'
vs/base/common/arrays
'
;
...
...
@@ -161,15 +161,19 @@ export class NextEditorService extends Disposable implements INextEditorService
return
coalesce
(
this
.
nextEditorGroupsService
.
groups
.
map
(
group
=>
group
.
activeControl
));
}
get
visibleTextEditorControls
():
ICodeEditor
[]
{
return
this
.
visibleControls
.
map
(
control
=>
control
.
getControl
()
as
ICodeEditor
).
filter
(
widget
=>
isCodeEditor
(
widget
));
}
get
visibleEditors
():
IEditorInput
[]
{
return
coalesce
(
this
.
nextEditorGroupsService
.
groups
.
map
(
group
=>
group
.
activeEditor
));
}
//#region openEditor()
openEditor
(
editor
:
IEditorInput
,
options
?:
IEditorOptions
,
group
?:
GroupIdentifier
|
SIDE_
BY_SIDE
_TYPE
):
Thenable
<
IEditor
>
;
openEditor
(
editor
:
IResourceEditor
,
group
?:
GroupIdentifier
|
SIDE_
BY_SIDE
_TYPE
):
Thenable
<
IEditor
>
;
openEditor
(
editor
:
IEditorInput
|
IResourceEditor
,
optionsOrGroup
?:
IEditorOptions
|
GroupIdentifier
,
group
?:
GroupIdentifier
):
Thenable
<
IEditor
>
{
openEditor
(
editor
:
IEditorInput
,
options
?:
IEditorOptions
,
group
?:
GroupIdentifier
|
SIDE_
GROUP_TYPE
|
ACTIVE_GROUP
_TYPE
):
Thenable
<
IEditor
>
;
openEditor
(
editor
:
IResourceEditor
,
group
?:
GroupIdentifier
|
SIDE_
GROUP_TYPE
|
ACTIVE_GROUP
_TYPE
):
Thenable
<
IEditor
>
;
openEditor
(
editor
:
IEditorInput
|
IResourceEditor
,
optionsOrGroup
?:
IEditorOptions
|
GroupIdentifier
|
SIDE_GROUP_TYPE
|
ACTIVE_GROUP_TYPE
,
group
?:
GroupIdentifier
):
Thenable
<
IEditor
>
{
// Typed Editor Support
if
(
editor
instanceof
EditorInput
)
{
...
...
@@ -201,11 +205,16 @@ export class NextEditorService extends Disposable implements INextEditorService
return
TPromise
.
wrap
<
IEditor
>
(
null
);
}
private
findTargetGroup
(
input
:
IEditorInput
,
options
?:
IEditorOptions
,
group
?:
GroupIdentifier
|
SIDE_
BY_SIDE
_TYPE
):
INextEditorGroup
{
private
findTargetGroup
(
input
:
IEditorInput
,
options
?:
IEditorOptions
,
group
?:
GroupIdentifier
|
SIDE_
GROUP_TYPE
|
ACTIVE_GROUP
_TYPE
):
INextEditorGroup
{
let
targetGroup
:
INextEditorGroup
;
// Group: Active Group
if
(
group
===
ACTIVE_GROUP
)
{
targetGroup
=
this
.
nextEditorGroupsService
.
activeGroup
;
}
// Group: Side by Side
if
(
group
===
SIDE_BY_SIDE
)
{
else
if
(
group
===
SIDE_GROUP
)
{
targetGroup
=
this
.
createSideBySideGroup
();
}
...
...
@@ -270,9 +279,9 @@ export class NextEditorService extends Disposable implements INextEditorService
//#region openEditors()
openEditors
(
editors
:
IEditorInputWithOptions
[],
group
?:
GroupIdentifier
|
SIDE_
BY_SIDE
_TYPE
):
Thenable
<
IEditor
[]
>
;
openEditors
(
editors
:
IResourceEditor
[],
group
?:
GroupIdentifier
|
SIDE_
BY_SIDE
_TYPE
):
Thenable
<
IEditor
[]
>
;
openEditors
(
editors
:
(
IEditorInputWithOptions
|
IResourceEditor
)[],
group
?:
GroupIdentifier
|
SIDE_
BY_SIDE
_TYPE
):
Thenable
<
IEditor
[]
>
{
openEditors
(
editors
:
IEditorInputWithOptions
[],
group
?:
GroupIdentifier
|
SIDE_
GROUP_TYPE
|
ACTIVE_GROUP
_TYPE
):
Thenable
<
IEditor
[]
>
;
openEditors
(
editors
:
IResourceEditor
[],
group
?:
GroupIdentifier
|
SIDE_
GROUP_TYPE
|
ACTIVE_GROUP
_TYPE
):
Thenable
<
IEditor
[]
>
;
openEditors
(
editors
:
(
IEditorInputWithOptions
|
IResourceEditor
)[],
group
?:
GroupIdentifier
|
SIDE_
GROUP_TYPE
|
ACTIVE_GROUP
_TYPE
):
Thenable
<
IEditor
[]
>
{
// Convert to typed editors and options
const
typedEditors
:
IEditorInputWithOptions
[]
=
[];
...
...
@@ -286,7 +295,7 @@ export class NextEditorService extends Disposable implements INextEditorService
// Find target groups to open
const
mapGroupToEditors
=
new
Map
<
INextEditorGroup
,
IEditorInputWithOptions
[]
>
();
if
(
group
===
SIDE_
BY_SIDE
)
{
if
(
group
===
SIDE_
GROUP
)
{
mapGroupToEditors
.
set
(
this
.
createSideBySideGroup
(),
typedEditors
);
}
else
{
typedEditors
.
forEach
(
typedEditor
=>
{
...
...
src/vs/workbench/services/editor/common/nextEditorService.ts
浏览文件 @
1c6e2f95
...
...
@@ -15,8 +15,11 @@ export const INextEditorService = createDecorator<INextEditorService>('nextEdito
export
type
IResourceEditor
=
IResourceInput
|
IUntitledResourceInput
|
IResourceDiffInput
|
IResourceSideBySideInput
;
export
const
SIDE_BY_SIDE
=
-
1
;
export
type
SIDE_BY_SIDE_TYPE
=
typeof
SIDE_BY_SIDE
;
export
const
ACTIVE_GROUP
=
-
1
;
export
type
ACTIVE_GROUP_TYPE
=
typeof
ACTIVE_GROUP
;
export
const
SIDE_GROUP
=
-
2
;
export
type
SIDE_GROUP_TYPE
=
typeof
SIDE_GROUP
;
export
interface
INextEditorService
{
_serviceBrand
:
ServiceIdentifier
<
any
>
;
...
...
@@ -68,6 +71,11 @@ export interface INextEditorService {
*/
readonly
visibleControls
:
ReadonlyArray
<
IEditor
>
;
/**
* All text editor controls that are currently visible across all editor groups.
*/
readonly
visibleTextEditorControls
:
ICodeEditor
[];
/**
* All editors that are currently visible across all editor groups.
*/
...
...
@@ -79,31 +87,31 @@ export interface INextEditorService {
* @param editor the editor to open
* @param options the options to use for the editor
* @param group the target group. If unspecified, the editor will open in the currently
* active group. Use `SIDE_
BY_SID
E` to open the editor in a new editor group to the side
* active group. Use `SIDE_
GROUP_TYP
E` to open the editor in a new editor group to the side
* of the currently active group.
*/
openEditor
(
editor
:
IEditorInput
,
options
?:
IEditorOptions
,
group
?:
GroupIdentifier
|
SIDE_
BY_SIDE
_TYPE
):
Thenable
<
IEditor
>
;
openEditor
(
editor
:
IEditorInput
,
options
?:
IEditorOptions
,
group
?:
GroupIdentifier
|
SIDE_
GROUP_TYPE
|
ACTIVE_GROUP
_TYPE
):
Thenable
<
IEditor
>
;
/**
* Open an editor in an editor group.
*
* @param editor the editor to open
* @param group the target group. If unspecified, the editor will open in the currently
* active group. Use `SIDE_
BY_SID
E` to open the editor in a new editor group to the side
* active group. Use `SIDE_
GROUP_TYP
E` to open the editor in a new editor group to the side
* of the currently active group.
*/
openEditor
(
editor
:
IResourceEditor
,
group
?:
GroupIdentifier
|
SIDE_
BY_SIDE
_TYPE
):
Thenable
<
IEditor
>
;
openEditor
(
editor
:
IResourceEditor
,
group
?:
GroupIdentifier
|
SIDE_
GROUP_TYPE
|
ACTIVE_GROUP
_TYPE
):
Thenable
<
IEditor
>
;
/**
* Open editors in an editor group.
*
* @param editors the editors to open with associated options
* @param group the target group. If unspecified, the editor will open in the currently
* active group. Use `SIDE_
BY_SID
E` to open the editor in a new editor group to the side
* active group. Use `SIDE_
GROUP_TYP
E` to open the editor in a new editor group to the side
* of the currently active group.
*/
openEditors
(
editors
:
IEditorInputWithOptions
[],
group
?:
GroupIdentifier
|
SIDE_
BY_SIDE
_TYPE
):
Thenable
<
IEditor
[]
>
;
openEditors
(
editors
:
IResourceEditor
[],
group
?:
GroupIdentifier
|
SIDE_
BY_SIDE
_TYPE
):
Thenable
<
IEditor
[]
>
;
openEditors
(
editors
:
IEditorInputWithOptions
[],
group
?:
GroupIdentifier
|
SIDE_
GROUP_TYPE
|
ACTIVE_GROUP
_TYPE
):
Thenable
<
IEditor
[]
>
;
openEditors
(
editors
:
IResourceEditor
[],
group
?:
GroupIdentifier
|
SIDE_
GROUP_TYPE
|
ACTIVE_GROUP
_TYPE
):
Thenable
<
IEditor
[]
>
;
/**
* Find out if the provided editor (or resource of an editor) is opened in any group.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录