Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
af0078d4
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,发现更多精彩内容 >>
未验证
提交
af0078d4
编写于
5月 25, 2021
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
editors - more EditorOptions cleanup
上级
f2b1f78a
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
59 addition
and
44 deletion
+59
-44
src/vs/platform/editor/common/editor.ts
src/vs/platform/editor/common/editor.ts
+3
-0
src/vs/workbench/common/editor.ts
src/vs/workbench/common/editor.ts
+1
-1
src/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoLineQuickAccess.ts
...rib/codeEditor/browser/quickaccess/gotoLineQuickAccess.ts
+5
-2
src/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoSymbolQuickAccess.ts
...b/codeEditor/browser/quickaccess/gotoSymbolQuickAccess.ts
+5
-2
src/vs/workbench/contrib/preferences/common/preferencesContribution.ts
...nch/contrib/preferences/common/preferencesContribution.ts
+2
-2
src/vs/workbench/contrib/search/browser/anythingQuickAccess.ts
...s/workbench/contrib/search/browser/anythingQuickAccess.ts
+6
-1
src/vs/workbench/services/editor/browser/editorOverrideService.ts
...orkbench/services/editor/browser/editorOverrideService.ts
+3
-3
src/vs/workbench/services/editor/browser/editorService.ts
src/vs/workbench/services/editor/browser/editorService.ts
+18
-17
src/vs/workbench/services/editor/common/editorGroupsService.ts
...s/workbench/services/editor/common/editorGroupsService.ts
+5
-5
src/vs/workbench/services/editor/common/editorOverrideService.ts
...workbench/services/editor/common/editorOverrideService.ts
+4
-4
src/vs/workbench/services/editor/common/editorService.ts
src/vs/workbench/services/editor/common/editorService.ts
+2
-2
src/vs/workbench/test/browser/workbenchTestServices.ts
src/vs/workbench/test/browser/workbenchTestServices.ts
+5
-5
未找到文件。
src/vs/platform/editor/common/editor.ts
浏览文件 @
af0078d4
...
...
@@ -269,14 +269,17 @@ export const enum TextEditorSelectionRevealType {
* Option to scroll vertically or horizontally as necessary and reveal a range centered vertically.
*/
Center
=
0
,
/**
* Option to scroll vertically or horizontally as necessary and reveal a range centered vertically only if it lies outside the viewport.
*/
CenterIfOutsideViewport
=
1
,
/**
* Option to scroll vertically or horizontally as necessary and reveal a range close to the top of the viewport, but not quite at the top.
*/
NearTop
=
2
,
/**
* Option to scroll vertically or horizontally as necessary and reveal a range close to the top of the viewport, but not quite at the top.
* Only if it lies outside the viewport
...
...
src/vs/workbench/common/editor.ts
浏览文件 @
af0078d4
...
...
@@ -682,7 +682,7 @@ export interface IFileEditorInput extends IEditorInput, IEncodingSupport, IModeS
export
interface
IEditorInputWithOptions
{
editor
:
IEditorInput
;
options
?:
IEditorOptions
|
ITextEditorOptions
;
options
?:
IEditorOptions
;
}
export
interface
IEditorInputWithOptionsAndGroup
extends
IEditorInputWithOptions
{
...
...
src/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoLineQuickAccess.ts
浏览文件 @
af0078d4
...
...
@@ -17,6 +17,7 @@ import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
import
{
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
KeybindingWeight
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
IQuickAccessTextEditorContext
}
from
'
vs/editor/contrib/quickAccess/editorNavigationQuickAccess
'
;
import
{
ITextEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
export
class
GotoLineQuickAccessProvider
extends
AbstractGotoLineQuickAccessProvider
{
...
...
@@ -47,11 +48,13 @@ export class GotoLineQuickAccessProvider extends AbstractGotoLineQuickAccessProv
if
((
options
.
keyMods
.
alt
||
(
this
.
configuration
.
openEditorPinned
&&
options
.
keyMods
.
ctrlCmd
)
||
options
.
forceSideBySide
)
&&
this
.
editorService
.
activeEditor
)
{
context
.
restoreViewState
?.();
// since we open to the side, restore view state in this editor
this
.
editorService
.
openEditor
(
this
.
editorService
.
activeEditor
,
{
const
editorOptions
:
ITextEditorOptions
=
{
selection
:
options
.
range
,
pinned
:
options
.
keyMods
.
ctrlCmd
||
this
.
configuration
.
openEditorPinned
,
preserveFocus
:
options
.
preserveFocus
},
SIDE_GROUP
);
};
this
.
editorService
.
openEditor
(
this
.
editorService
.
activeEditor
,
editorOptions
,
SIDE_GROUP
);
}
// Otherwise let parent handle it
...
...
src/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoSymbolQuickAccess.ts
浏览文件 @
af0078d4
...
...
@@ -28,6 +28,7 @@ import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegis
import
{
IQuickAccessTextEditorContext
}
from
'
vs/editor/contrib/quickAccess/editorNavigationQuickAccess
'
;
import
{
IOutlineService
,
OutlineTarget
}
from
'
vs/workbench/services/outline/browser/outline
'
;
import
{
isCompositeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
ITextEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
export
class
GotoSymbolQuickAccessProvider
extends
AbstractGotoSymbolQuickAccessProvider
{
...
...
@@ -73,11 +74,13 @@ export class GotoSymbolQuickAccessProvider extends AbstractGotoSymbolQuickAccess
if
((
options
.
keyMods
.
alt
||
(
this
.
configuration
.
openEditorPinned
&&
options
.
keyMods
.
ctrlCmd
)
||
options
.
forceSideBySide
)
&&
this
.
editorService
.
activeEditor
)
{
context
.
restoreViewState
?.();
// since we open to the side, restore view state in this editor
this
.
editorService
.
openEditor
(
this
.
editorService
.
activeEditor
,
{
const
editorOptions
:
ITextEditorOptions
=
{
selection
:
options
.
range
,
pinned
:
options
.
keyMods
.
ctrlCmd
||
this
.
configuration
.
openEditorPinned
,
preserveFocus
:
options
.
preserveFocus
},
SIDE_GROUP
);
};
this
.
editorService
.
openEditor
(
this
.
editorService
.
activeEditor
,
editorOptions
,
SIDE_GROUP
);
}
// Otherwise let parent handle it
...
...
src/vs/workbench/contrib/preferences/common/preferencesContribution.ts
浏览文件 @
af0078d4
...
...
@@ -13,7 +13,7 @@ import { ITextModelService } from 'vs/editor/common/services/resolverService';
import
*
as
nls
from
'
vs/nls
'
;
import
{
ConfigurationTarget
,
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ConfigurationScope
,
Extensions
,
IConfigurationRegistry
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
IEditorOptions
,
ITextEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
*
as
JSONContributionRegistry
from
'
vs/platform/jsonschemas/common/jsonContributionRegistry
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
...
...
@@ -71,7 +71,7 @@ export class PreferencesContribution implements IWorkbenchContribution {
priority
:
ContributedEditorPriority
.
builtin
,
},
{},
(
resource
:
URI
,
options
:
IEditorOptions
|
ITextEditorOptions
|
undefined
,
group
:
IEditorGroup
):
IEditorInputWithOptions
=>
{
(
resource
:
URI
,
options
:
IEditorOptions
|
undefined
,
group
:
IEditorGroup
):
IEditorInputWithOptions
=>
{
// Global User Settings File
if
(
isEqual
(
resource
,
this
.
environmentService
.
settingsResource
))
{
return
{
editor
:
this
.
preferencesService
.
getCurrentOrNewSplitJsonEditorInput
(
ConfigurationTarget
.
USER_LOCAL
,
resource
,
group
),
options
};
...
...
src/vs/workbench/contrib/search/browser/anythingQuickAccess.ts
浏览文件 @
af0078d4
...
...
@@ -144,9 +144,14 @@ export class AnythingQuickAccessProvider extends PickerQuickAccessProvider<IAnyt
async
restoreEditorViewState
():
Promise
<
void
>
{
if
(
this
.
editorViewState
)
{
const
options
:
ITextEditorOptions
=
{
viewState
:
this
.
editorViewState
.
state
,
preserveFocus
:
true
/* import to not close the picker as a result */
};
await
this
.
editorService
.
openEditor
(
this
.
editorViewState
.
editor
,
{
viewState
:
this
.
editorViewState
.
state
,
preserveFocus
:
true
/* import to not close the picker as a result */
}
,
options
,
this
.
editorViewState
.
group
);
}
...
...
src/vs/workbench/services/editor/browser/editorOverrideService.ts
浏览文件 @
af0078d4
...
...
@@ -9,7 +9,7 @@ import { Disposable, IDisposable, toDisposable } from 'vs/base/common/lifecycle'
import
{
basename
,
extname
,
isEqual
}
from
'
vs/base/common/resources
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
EditorActivation
,
EditorOverride
,
IEditorOptions
,
ITextEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
import
{
EditorActivation
,
EditorOverride
,
IEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
import
{
EditorResourceAccessor
,
IEditorInput
,
IEditorInputWithOptions
,
IEditorInputWithOptionsAndGroup
}
from
'
vs/workbench/common/editor
'
;
import
{
IEditorGroup
,
IEditorGroupsService
,
preferredSideBySideGroupDirection
}
from
'
vs/workbench/services/editor/common/editorGroupsService
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
...
...
@@ -80,7 +80,7 @@ export class EditorOverrideService extends Disposable implements IEditorOverride
}));
}
async
resolveEditorOverride
(
editor
:
IEditorInput
,
options
:
IEditorOptions
|
ITextEditorOptions
|
undefined
,
group
:
IEditorGroup
):
Promise
<
IEditorInputWithOptionsAndGroup
|
undefined
>
{
async
resolveEditorOverride
(
editor
:
IEditorInput
,
options
:
IEditorOptions
|
undefined
,
group
:
IEditorGroup
):
Promise
<
IEditorInputWithOptionsAndGroup
|
undefined
>
{
// If it was an override before we await for the extensions to activate and then proceed with overriding or else they won't be registered
if
(
this
.
cache
&&
editor
.
resource
&&
this
.
resourceMatchesCache
(
editor
.
resource
))
{
await
this
.
extensionService
.
whenInstalledExtensionsRegistered
();
...
...
@@ -292,7 +292,7 @@ export class EditorOverrideService extends Disposable implements IEditorOverride
};
}
private
async
doOverrideEditorInput
(
editor
:
IEditorInput
,
options
:
IEditorOptions
|
ITextEditorOptions
|
undefined
,
group
:
IEditorGroup
,
selectedContribution
:
ContributionPoint
):
Promise
<
IEditorInputWithOptions
|
undefined
>
{
private
async
doOverrideEditorInput
(
editor
:
IEditorInput
,
options
:
IEditorOptions
|
undefined
,
group
:
IEditorGroup
,
selectedContribution
:
ContributionPoint
):
Promise
<
IEditorInputWithOptions
|
undefined
>
{
// If no activation option is provided, populate it.
if
(
options
&&
typeof
options
.
activation
===
'
undefined
'
)
{
...
...
src/vs/workbench/services/editor/browser/editorService.ts
浏览文件 @
af0078d4
...
...
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IResourceEditorInput
,
I
TextEditorOptions
,
IEditorOptions
,
EditorActivation
,
EditorOverride
,
IResourceEditorInputIdentifier
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IResourceEditorInput
,
I
EditorOptions
,
EditorActivation
,
EditorOverride
,
IResourceEditorInputIdentifier
,
ITextEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
import
{
SideBySideEditor
,
IEditorInput
,
IEditorPane
,
GroupIdentifier
,
IFileEditorInput
,
IUntitledTextResourceEditorInput
,
IResourceDiffEditorInput
,
IEditorInputFactoryRegistry
,
EditorExtensions
,
IEditorInputWithOptions
,
isEditorInputWithOptions
,
IEditorIdentifier
,
IEditorCloseEvent
,
ITextEditorPane
,
ITextDiffEditorPane
,
IRevertOptions
,
SaveReason
,
EditorsOrder
,
isTextEditorPane
,
IWorkbenchEditorConfiguration
,
EditorResourceAccessor
,
IVisibleEditorPane
,
IEditorInputWithOptionsAndGroup
,
EditorInputCapabilities
}
from
'
vs/workbench/common/editor
'
;
import
{
EditorInput
}
from
'
vs/workbench/common/editor/editorInput
'
;
import
{
SideBySideEditorInput
}
from
'
vs/workbench/common/editor/sideBySideEditorInput
'
;
...
...
@@ -512,10 +512,10 @@ export class EditorService extends Disposable implements EditorServiceImpl {
//#region openEditor()
openEditor
(
editor
:
IEditorInput
,
options
?:
IEditorOptions
|
ITextEditorOptions
,
group
?:
OpenInEditorGroup
):
Promise
<
IEditorPane
|
undefined
>
;
openEditor
(
editor
:
IEditorInput
,
options
?:
IEditorOptions
,
group
?:
OpenInEditorGroup
):
Promise
<
IEditorPane
|
undefined
>
;
openEditor
(
editor
:
IResourceEditorInput
|
IUntitledTextResourceEditorInput
,
group
?:
OpenInEditorGroup
):
Promise
<
ITextEditorPane
|
undefined
>
;
openEditor
(
editor
:
IResourceDiffEditorInput
,
group
?:
OpenInEditorGroup
):
Promise
<
ITextDiffEditorPane
|
undefined
>
;
async
openEditor
(
editor
:
IEditorInput
|
IResourceEditorInputType
,
optionsOrGroup
?:
IEditorOptions
|
ITextEditorOptions
|
OpenInEditorGroup
,
group
?:
OpenInEditorGroup
):
Promise
<
IEditorPane
|
undefined
>
{
async
openEditor
(
editor
:
IEditorInput
|
IResourceEditorInputType
,
optionsOrGroup
?:
IEditorOptions
|
OpenInEditorGroup
,
group
?:
OpenInEditorGroup
):
Promise
<
IEditorPane
|
undefined
>
{
const
result
=
this
.
doResolveEditorOpenRequest
(
editor
,
optionsOrGroup
,
group
);
if
(
result
)
{
const
[
resolvedGroup
,
resolvedEditor
,
resolvedOptions
]
=
result
;
...
...
@@ -538,20 +538,20 @@ export class EditorService extends Disposable implements EditorServiceImpl {
return
undefined
;
}
doResolveEditorOpenRequest
(
editor
:
IEditorInput
|
IResourceEditorInputType
,
optionsOrGroup
?:
IEditorOptions
|
ITextEditorOptions
|
OpenInEditorGroup
,
group
?:
OpenInEditorGroup
):
[
IEditorGroup
,
EditorInput
,
IEditorOptions
|
undefined
]
|
undefined
{
doResolveEditorOpenRequest
(
editor
:
IEditorInput
|
IResourceEditorInputType
,
optionsOrGroup
?:
IEditorOptions
|
OpenInEditorGroup
,
group
?:
OpenInEditorGroup
):
[
IEditorGroup
,
EditorInput
,
IEditorOptions
|
undefined
]
|
undefined
{
let
resolvedGroup
:
IEditorGroup
|
undefined
;
let
candidateGroup
:
OpenInEditorGroup
|
undefined
;
let
typedEditor
:
EditorInput
|
undefined
;
let
typedO
ptions
:
IEditorOptions
|
undefined
;
let
o
ptions
:
IEditorOptions
|
undefined
;
// Typed Editor Support
if
(
editor
instanceof
EditorInput
)
{
typedEditor
=
editor
;
typedO
ptions
=
optionsOrGroup
as
IEditorOptions
;
o
ptions
=
optionsOrGroup
as
IEditorOptions
;
candidateGroup
=
group
;
resolvedGroup
=
this
.
findTargetGroup
(
typedEditor
,
typedO
ptions
,
candidateGroup
);
resolvedGroup
=
this
.
findTargetGroup
(
typedEditor
,
o
ptions
,
candidateGroup
);
}
// Untyped Text Editor Support
...
...
@@ -559,19 +559,19 @@ export class EditorService extends Disposable implements EditorServiceImpl {
const
textInput
=
editor
as
IResourceEditorInputType
;
typedEditor
=
this
.
createEditorInput
(
textInput
);
if
(
typedEditor
)
{
typedO
ptions
=
textInput
.
options
;
o
ptions
=
textInput
.
options
;
candidateGroup
=
optionsOrGroup
as
OpenInEditorGroup
;
resolvedGroup
=
this
.
findTargetGroup
(
typedEditor
,
typedO
ptions
,
candidateGroup
);
resolvedGroup
=
this
.
findTargetGroup
(
typedEditor
,
o
ptions
,
candidateGroup
);
}
}
if
(
typedEditor
&&
resolvedGroup
)
{
if
(
this
.
editorGroupService
.
activeGroup
!==
resolvedGroup
&&
// only if target group is not already active
typedOptions
&&
!
typedOptions
.
inactive
&&
// never for inactive editors
typedOptions
.
preserveFocus
&&
// only if preserveFocus
typeof
typedOptions
.
activation
!==
'
number
'
&&
// only if activation is not already defined (either true or false)
options
&&
!
options
.
inactive
&&
// never for inactive editors
options
.
preserveFocus
&&
// only if preserveFocus
typeof
options
.
activation
!==
'
number
'
&&
// only if activation is not already defined (either true or false)
candidateGroup
!==
SIDE_GROUP
// never for the SIDE_GROUP
)
{
// If the resolved group is not the active one, we typically
...
...
@@ -583,10 +583,10 @@ export class EditorService extends Disposable implements EditorServiceImpl {
// group is it is opened as `SIDE_GROUP` with `preserveFocus:true`.
// repeated Alt-clicking of files in the explorer always open
// into the same side group and not cause a group to be created each time.
typedO
ptions
.
activation
=
EditorActivation
.
ACTIVATE
;
o
ptions
.
activation
=
EditorActivation
.
ACTIVATE
;
}
return
[
resolvedGroup
,
typedEditor
,
typedO
ptions
];
return
[
resolvedGroup
,
typedEditor
,
o
ptions
];
}
return
undefined
;
...
...
@@ -1179,6 +1179,7 @@ export class EditorService extends Disposable implements EditorServiceImpl {
if
(
isTextEditorPane
(
editorPane
))
{
viewState
=
editorPane
.
getViewState
();
}
const
editorOptions
:
ITextEditorOptions
=
{
pinned
:
true
,
viewState
};
const
result
=
options
?.
saveAs
?
await
editor
.
saveAs
(
groupId
,
options
)
:
await
editor
.
save
(
groupId
,
options
);
saveResults
.
push
(
result
);
...
...
@@ -1193,7 +1194,7 @@ export class EditorService extends Disposable implements EditorServiceImpl {
if
(
!
result
.
matches
(
editor
))
{
const
targetGroups
=
editor
.
hasCapability
(
EditorInputCapabilities
.
Untitled
)
?
this
.
editorGroupService
.
groups
.
map
(
group
=>
group
.
id
)
/* untitled replaces across all groups */
:
[
groupId
];
for
(
const
group
of
targetGroups
)
{
await
this
.
replaceEditors
([{
editor
,
replacement
:
result
,
options
:
{
pinned
:
true
,
viewState
}
}],
group
);
await
this
.
replaceEditors
([{
editor
,
replacement
:
result
,
options
:
editorOptions
}],
group
);
}
}
}
...
...
@@ -1300,10 +1301,10 @@ export class DelegatingEditorService implements IEditorService {
@
IEditorService
private
editorService
:
EditorService
)
{
}
openEditor
(
editor
:
IEditorInput
,
options
?:
IEditorOptions
|
ITextEditorOptions
,
group
?:
OpenInEditorGroup
):
Promise
<
IEditorPane
|
undefined
>
;
openEditor
(
editor
:
IEditorInput
,
options
?:
IEditorOptions
,
group
?:
OpenInEditorGroup
):
Promise
<
IEditorPane
|
undefined
>
;
openEditor
(
editor
:
IResourceEditorInput
|
IUntitledTextResourceEditorInput
,
group
?:
OpenInEditorGroup
):
Promise
<
ITextEditorPane
|
undefined
>
;
openEditor
(
editor
:
IResourceDiffEditorInput
,
group
?:
OpenInEditorGroup
):
Promise
<
ITextDiffEditorPane
|
undefined
>
;
async
openEditor
(
editor
:
IEditorInput
|
IResourceEditorInputType
,
optionsOrGroup
?:
IEditorOptions
|
ITextEditorOptions
|
OpenInEditorGroup
,
group
?:
OpenInEditorGroup
):
Promise
<
IEditorPane
|
undefined
>
{
async
openEditor
(
editor
:
IEditorInput
|
IResourceEditorInputType
,
optionsOrGroup
?:
IEditorOptions
|
OpenInEditorGroup
,
group
?:
OpenInEditorGroup
):
Promise
<
IEditorPane
|
undefined
>
{
const
result
=
this
.
editorService
.
doResolveEditorOpenRequest
(
editor
,
optionsOrGroup
,
group
);
if
(
result
)
{
const
[
resolvedGroup
,
resolvedEditor
,
resolvedOptions
]
=
result
;
...
...
src/vs/workbench/services/editor/common/editorGroupsService.ts
浏览文件 @
af0078d4
...
...
@@ -6,7 +6,7 @@
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IEditorInput
,
IEditorPane
,
GroupIdentifier
,
IEditorInputWithOptions
,
CloseDirection
,
IEditorPartOptions
,
IEditorPartOptionsChangeEvent
,
EditorsOrder
,
IVisibleEditorPane
,
IEditorCloseEvent
,
IEditorMoveEvent
,
IEditorOpenEvent
}
from
'
vs/workbench/common/editor
'
;
import
{
IEditorOptions
,
ITextEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IDimension
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
...
...
@@ -101,7 +101,7 @@ export interface ICloseAllEditorsOptions {
export
interface
IEditorReplacement
{
editor
:
IEditorInput
;
replacement
:
IEditorInput
;
options
?:
IEditorOptions
|
ITextEditorOptions
;
options
?:
IEditorOptions
;
/**
* Skips asking the user for confirmation and doesn't
...
...
@@ -520,7 +520,7 @@ export interface IEditorGroup {
* @returns a promise that resolves around an IEditor instance unless
* the call failed, or the editor was not opened as active editor.
*/
openEditor
(
editor
:
IEditorInput
,
options
?:
IEditorOptions
|
ITextEditorOptions
):
Promise
<
IEditorPane
|
undefined
>
;
openEditor
(
editor
:
IEditorInput
,
options
?:
IEditorOptions
):
Promise
<
IEditorPane
|
undefined
>
;
/**
* Opens editors in this group.
...
...
@@ -557,14 +557,14 @@ export interface IEditorGroup {
/**
* Move an editor from this group either within this group or to another group.
*/
moveEditor
(
editor
:
IEditorInput
,
target
:
IEditorGroup
,
options
?:
IEditorOptions
|
ITextEditorOptions
):
void
;
moveEditor
(
editor
:
IEditorInput
,
target
:
IEditorGroup
,
options
?:
IEditorOptions
):
void
;
/**
* Copy an editor from this group to another group.
*
* Note: It is currently not supported to show the same editor more than once in the same group.
*/
copyEditor
(
editor
:
IEditorInput
,
target
:
IEditorGroup
,
options
?:
IEditorOptions
|
ITextEditorOptions
):
void
;
copyEditor
(
editor
:
IEditorInput
,
target
:
IEditorGroup
,
options
?:
IEditorOptions
):
void
;
/**
* Close an editor from the group. This may trigger a confirmation dialog if
...
...
src/vs/workbench/services/editor/common/editorOverrideService.ts
浏览文件 @
af0078d4
...
...
@@ -12,7 +12,7 @@ import { URI } from 'vs/base/common/uri';
import
{
localize
}
from
'
vs/nls
'
;
import
{
workbenchConfigurationNodeBase
}
from
'
vs/workbench/common/configuration
'
;
import
{
Extensions
as
ConfigurationExtensions
,
IConfigurationNode
,
IConfigurationRegistry
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
IEditorOptions
,
ITextEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IEditorOptions
}
from
'
vs/platform/editor/common/editor
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
IEditorInput
,
IEditorInputWithOptions
,
IEditorInputWithOptionsAndGroup
}
from
'
vs/workbench/common/editor
'
;
...
...
@@ -97,9 +97,9 @@ export type ContributedEditorInfo = {
priority
:
ContributedEditorPriority
;
};
export
type
EditorInputFactoryFunction
=
(
resource
:
URI
,
options
:
IEditorOptions
|
ITextEditorOptions
|
undefined
,
group
:
IEditorGroup
)
=>
IEditorInputWithOptions
;
export
type
EditorInputFactoryFunction
=
(
resource
:
URI
,
options
:
IEditorOptions
|
undefined
,
group
:
IEditorGroup
)
=>
IEditorInputWithOptions
;
export
type
DiffEditorInputFactoryFunction
=
(
diffEditorInput
:
DiffEditorInput
,
options
:
IEditorOptions
|
ITextEditorOptions
|
undefined
,
group
:
IEditorGroup
)
=>
IEditorInputWithOptions
;
export
type
DiffEditorInputFactoryFunction
=
(
diffEditorInput
:
DiffEditorInput
,
options
:
IEditorOptions
|
undefined
,
group
:
IEditorGroup
)
=>
IEditorInputWithOptions
;
export
interface
IEditorOverrideService
{
readonly
_serviceBrand
:
undefined
;
...
...
@@ -139,7 +139,7 @@ export interface IEditorOverrideService {
* @param group The current group
* @returns An IEditorInputWithOptionsAndGroup if there is an available override or undefined if there is not
*/
resolveEditorOverride
(
editor
:
IEditorInput
,
options
:
IEditorOptions
|
ITextEditorOptions
|
undefined
,
group
:
IEditorGroup
):
Promise
<
IEditorInputWithOptionsAndGroup
|
undefined
>
;
resolveEditorOverride
(
editor
:
IEditorInput
,
options
:
IEditorOptions
|
undefined
,
group
:
IEditorGroup
):
Promise
<
IEditorInputWithOptionsAndGroup
|
undefined
>
;
/**
* Given a resource returns all the editor ids that match that resource
...
...
src/vs/workbench/services/editor/common/editorService.ts
浏览文件 @
af0078d4
...
...
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IResourceEditorInput
,
IEditorOptions
,
I
TextEditorOptions
,
I
ResourceEditorInputIdentifier
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IResourceEditorInput
,
IEditorOptions
,
IResourceEditorInputIdentifier
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IEditorInput
,
IEditorPane
,
GroupIdentifier
,
IEditorInputWithOptions
,
IUntitledTextResourceEditorInput
,
IResourceDiffEditorInput
,
ITextEditorPane
,
ITextDiffEditorPane
,
IEditorIdentifier
,
ISaveOptions
,
IRevertOptions
,
EditorsOrder
,
IVisibleEditorPane
,
IEditorCloseEvent
}
from
'
vs/workbench/common/editor
'
;
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
IEditor
,
IDiffEditor
}
from
'
vs/editor/common/editorCommon
'
;
...
...
@@ -157,7 +157,7 @@ export interface IEditorService {
* @returns the editor that opened or `undefined` if the operation failed or the editor was not
* opened to be active.
*/
openEditor
(
editor
:
IEditorInput
,
options
?:
IEditorOptions
|
ITextEditorOptions
,
group
?:
IEditorGroup
|
GroupIdentifier
|
SIDE_GROUP_TYPE
|
ACTIVE_GROUP_TYPE
):
Promise
<
IEditorPane
|
undefined
>
;
openEditor
(
editor
:
IEditorInput
,
options
?:
IEditorOptions
,
group
?:
IEditorGroup
|
GroupIdentifier
|
SIDE_GROUP_TYPE
|
ACTIVE_GROUP_TYPE
):
Promise
<
IEditorPane
|
undefined
>
;
openEditor
(
editor
:
IResourceEditorInput
|
IUntitledTextResourceEditorInput
,
group
?:
IEditorGroup
|
GroupIdentifier
|
SIDE_GROUP_TYPE
|
ACTIVE_GROUP_TYPE
):
Promise
<
ITextEditorPane
|
undefined
>
;
openEditor
(
editor
:
IResourceDiffEditorInput
,
group
?:
IEditorGroup
|
GroupIdentifier
|
SIDE_GROUP_TYPE
|
ACTIVE_GROUP_TYPE
):
Promise
<
ITextDiffEditorPane
|
undefined
>
;
...
...
src/vs/workbench/test/browser/workbenchTestServices.ts
浏览文件 @
af0078d4
...
...
@@ -18,7 +18,7 @@ import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configur
import
{
IWorkbenchLayoutService
,
Parts
,
Position
as
PartPosition
}
from
'
vs/workbench/services/layout/browser/layoutService
'
;
import
{
TextModelResolverService
}
from
'
vs/workbench/services/textmodelResolver/common/textModelResolverService
'
;
import
{
ITextModelService
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
IEditorOptions
,
IResourceEditorInput
,
IEditorModel
,
I
TextEditorOptions
,
I
ResourceEditorInputIdentifier
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IEditorOptions
,
IResourceEditorInput
,
IEditorModel
,
IResourceEditorInputIdentifier
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IUntitledTextEditorService
,
UntitledTextEditorService
}
from
'
vs/workbench/services/untitled/common/untitledTextEditorService
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
ILifecycleService
,
BeforeShutdownEvent
,
ShutdownReason
,
StartupKind
,
LifecyclePhase
,
WillShutdownEvent
}
from
'
vs/workbench/services/lifecycle/common/lifecycle
'
;
...
...
@@ -733,8 +733,8 @@ export class TestEditorGroupView implements IEditorGroupView {
isSticky
(
_editor
:
IEditorInput
):
boolean
{
return
false
;
}
isActive
(
_editor
:
IEditorInput
):
boolean
{
return
false
;
}
contains
(
candidate
:
IEditorInput
):
boolean
{
return
false
;
}
moveEditor
(
_editor
:
IEditorInput
,
_target
:
IEditorGroup
,
_options
?:
IEditorOptions
|
ITextEditorOptions
):
void
{
}
copyEditor
(
_editor
:
IEditorInput
,
_target
:
IEditorGroup
,
_options
?:
IEditorOptions
|
ITextEditorOptions
):
void
{
}
moveEditor
(
_editor
:
IEditorInput
,
_target
:
IEditorGroup
,
_options
?:
IEditorOptions
):
void
{
}
copyEditor
(
_editor
:
IEditorInput
,
_target
:
IEditorGroup
,
_options
?:
IEditorOptions
):
void
{
}
async
closeEditor
(
_editor
?:
IEditorInput
,
options
?:
ICloseEditorOptions
):
Promise
<
void
>
{
}
async
closeEditors
(
_editors
:
IEditorInput
[]
|
ICloseEditorsFilter
,
options
?:
ICloseEditorOptions
):
Promise
<
void
>
{
}
async
closeAllEditors
(
options
?:
ICloseAllEditorsOptions
):
Promise
<
void
>
{
}
...
...
@@ -805,10 +805,10 @@ export class TestEditorService implements EditorServiceImpl {
constructor
(
private
editorGroupService
?:
IEditorGroupsService
)
{
}
getEditors
()
{
return
[];
}
findEditors
()
{
return
[]
as
any
;
}
openEditor
(
editor
:
IEditorInput
,
options
?:
IEditorOptions
|
ITextEditorOptions
,
group
?:
IEditorGroup
|
GroupIdentifier
|
SIDE_GROUP_TYPE
|
ACTIVE_GROUP_TYPE
):
Promise
<
IEditorPane
|
undefined
>
;
openEditor
(
editor
:
IEditorInput
,
options
?:
IEditorOptions
,
group
?:
IEditorGroup
|
GroupIdentifier
|
SIDE_GROUP_TYPE
|
ACTIVE_GROUP_TYPE
):
Promise
<
IEditorPane
|
undefined
>
;
openEditor
(
editor
:
IResourceEditorInput
|
IUntitledTextResourceEditorInput
,
group
?:
IEditorGroup
|
GroupIdentifier
|
SIDE_GROUP_TYPE
|
ACTIVE_GROUP_TYPE
):
Promise
<
ITextEditorPane
|
undefined
>
;
openEditor
(
editor
:
IResourceDiffEditorInput
,
group
?:
IEditorGroup
|
GroupIdentifier
|
SIDE_GROUP_TYPE
|
ACTIVE_GROUP_TYPE
):
Promise
<
ITextDiffEditorPane
|
undefined
>
;
async
openEditor
(
editor
:
IEditorInput
|
IResourceEditorInputType
,
optionsOrGroup
?:
IEditorOptions
|
I
TextEditorOptions
|
I
EditorGroup
|
GroupIdentifier
|
SIDE_GROUP_TYPE
|
ACTIVE_GROUP_TYPE
,
group
?:
IEditorGroup
|
GroupIdentifier
|
SIDE_GROUP_TYPE
|
ACTIVE_GROUP_TYPE
):
Promise
<
IEditorPane
|
undefined
>
{
async
openEditor
(
editor
:
IEditorInput
|
IResourceEditorInputType
,
optionsOrGroup
?:
IEditorOptions
|
IEditorGroup
|
GroupIdentifier
|
SIDE_GROUP_TYPE
|
ACTIVE_GROUP_TYPE
,
group
?:
IEditorGroup
|
GroupIdentifier
|
SIDE_GROUP_TYPE
|
ACTIVE_GROUP_TYPE
):
Promise
<
IEditorPane
|
undefined
>
{
throw
new
Error
(
'
not implemented
'
);
}
doResolveEditorOpenRequest
(
editor
:
IEditorInput
|
IResourceEditorInputType
):
[
IEditorGroup
,
EditorInput
,
IEditorOptions
|
undefined
]
|
undefined
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录