Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
e66065b4
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,体验更适合开发者的 AI 搜索 >>
提交
e66065b4
编写于
5月 26, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
grid - fire active/visible editor change event on statup as before
上级
963a04e2
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
51 addition
and
35 deletion
+51
-35
src/vs/workbench/browser/parts/editor/editor.ts
src/vs/workbench/browser/parts/editor/editor.ts
+14
-2
src/vs/workbench/browser/parts/editor/editorStatus.ts
src/vs/workbench/browser/parts/editor/editorStatus.ts
+0
-4
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
+2
-2
src/vs/workbench/electron-browser/window.ts
src/vs/workbench/electron-browser/window.ts
+2
-5
src/vs/workbench/electron-browser/workbench.ts
src/vs/workbench/electron-browser/workbench.ts
+1
-3
src/vs/workbench/services/editor/browser/editorService.ts
src/vs/workbench/services/editor/browser/editorService.ts
+24
-6
src/vs/workbench/services/editor/test/browser/editorService.test.ts
...kbench/services/editor/test/browser/editorService.test.ts
+3
-3
src/vs/workbench/services/group/common/editorGroupsService.ts
...vs/workbench/services/group/common/editorGroupsService.ts
+0
-5
src/vs/workbench/services/history/electron-browser/history.ts
...vs/workbench/services/history/electron-browser/history.ts
+2
-2
src/vs/workbench/test/workbenchTestServices.ts
src/vs/workbench/test/workbenchTestServices.ts
+3
-3
未找到文件。
src/vs/workbench/browser/parts/editor/editor.ts
浏览文件 @
e66065b4
...
...
@@ -8,7 +8,7 @@
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
GroupIdentifier
,
IWorkbenchEditorConfiguration
,
IWorkbenchEditorPartConfiguration
,
EditorOptions
,
TextEditorOptions
,
IEditorInput
,
IEditorIdentifier
,
IEditorCloseEvent
}
from
'
vs/workbench/common/editor
'
;
import
{
EditorGroup
}
from
'
vs/workbench/common/editor/editorGroup
'
;
import
{
IEditorGroup
,
GroupDirection
,
IAddGroupOptions
,
IMergeGroupOptions
,
GroupsOrder
}
from
'
vs/workbench/services/group/common/editorGroupsService
'
;
import
{
IEditorGroup
,
GroupDirection
,
IAddGroupOptions
,
IMergeGroupOptions
,
GroupsOrder
,
IEditorGroupsService
}
from
'
vs/workbench/services/group/common/editorGroupsService
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
Dimension
}
from
'
vs/base/browser/dom
'
;
import
{
Event
}
from
'
vs/base/common/event
'
;
...
...
@@ -136,7 +136,7 @@ export function getActiveTextEditorOptions(group: IEditorGroup, expectedActiveEd
* A sub-interface of IEditorService to hide some workbench-core specific
* events from clients.
*/
export
interface
IEditor
PartService
extends
IEditorService
{
export
interface
IEditor
ServiceImpl
extends
IEditorService
{
/**
* Emitted when an editor is closed.
...
...
@@ -147,4 +147,16 @@ export interface IEditorPartService extends IEditorService {
* Emitted when an editor failed to open.
*/
readonly
onDidOpenEditorFail
:
Event
<
IEditorIdentifier
>
;
}
/**
* A sub-interface of IEditorGroupsService to hide some workbench-core specific
* methods from clients.
*/
export
interface
IEditorGroupsServiceImpl
extends
IEditorGroupsService
{
/**
* A promise that resolves when groups have been restored.
*/
readonly
whenRestored
:
TPromise
<
void
>
;
}
\ No newline at end of file
src/vs/workbench/browser/parts/editor/editorStatus.ts
浏览文件 @
e66065b4
...
...
@@ -57,7 +57,6 @@ import { Schemas } from 'vs/base/common/network';
import
{
IAnchor
}
from
'
vs/base/browser/ui/contextview/contextview
'
;
import
{
Themable
}
from
'
vs/workbench/common/theme
'
;
import
{
IPreferencesService
}
from
'
vs/workbench/services/preferences/common/preferences
'
;
import
{
IEditorGroupsService
}
from
'
vs/workbench/services/group/common/editorGroupsService
'
;
class
SideBySideEditorEncodingSupport
implements
IEncodingSupport
{
constructor
(
private
master
:
IEncodingSupport
,
private
details
:
IEncodingSupport
)
{
}
...
...
@@ -296,7 +295,6 @@ export class EditorStatus implements IStatusbarItem {
constructor
(
@
IEditorService
private
editorService
:
IEditorService
,
@
IEditorGroupsService
private
editorGroupService
:
IEditorGroupsService
,
@
IQuickOpenService
private
quickOpenService
:
IQuickOpenService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IUntitledEditorService
private
untitledEditorService
:
IUntitledEditorService
,
...
...
@@ -371,8 +369,6 @@ export class EditorStatus implements IStatusbarItem {
TabFocus
.
onDidChangeTabFocus
(
e
=>
this
.
onTabFocusModeChange
()),
);
this
.
editorGroupService
.
whenRestored
.
then
(()
=>
this
.
updateStatusBar
());
return
combinedDisposable
(
this
.
toDispose
);
}
...
...
src/vs/workbench/browser/parts/titlebar/titlebarPart.ts
浏览文件 @
e66065b4
...
...
@@ -76,7 +76,7 @@ export class TitlebarPart extends Part implements ITitleService {
this
.
toUnbind
.
push
(
addDisposableListener
(
window
,
EventType
.
BLUR
,
()
=>
this
.
onBlur
()));
this
.
toUnbind
.
push
(
addDisposableListener
(
window
,
EventType
.
FOCUS
,
()
=>
this
.
onFocus
()));
this
.
toUnbind
.
push
(
this
.
configurationService
.
onDidChangeConfiguration
(
e
=>
this
.
onConfigurationChanged
(
e
)));
this
.
toUnbind
.
push
(
this
.
editorService
.
onDidActiveEditorChange
(()
=>
this
.
updateFromActiveEditor
()));
this
.
toUnbind
.
push
(
this
.
editorService
.
onDidActiveEditorChange
(()
=>
this
.
onActiveEditorChange
()));
this
.
toUnbind
.
push
(
this
.
contextService
.
onDidChangeWorkspaceFolders
(()
=>
this
.
setTitle
(
this
.
getWindowTitle
())));
this
.
toUnbind
.
push
(
this
.
contextService
.
onDidChangeWorkbenchState
(()
=>
this
.
setTitle
(
this
.
getWindowTitle
())));
this
.
toUnbind
.
push
(
this
.
contextService
.
onDidChangeWorkspaceName
(()
=>
this
.
setTitle
(
this
.
getWindowTitle
())));
...
...
@@ -98,7 +98,7 @@ export class TitlebarPart extends Part implements ITitleService {
}
}
private
updateFromActiveEditor
():
void
{
private
onActiveEditorChange
():
void
{
// Dispose old listeners
dispose
(
this
.
activeEditorListeners
);
...
...
src/vs/workbench/electron-browser/window.ts
浏览文件 @
e66065b4
...
...
@@ -45,7 +45,7 @@ import { IIntegrityService } from 'vs/platform/integrity/common/integrity';
import
{
AccessibilitySupport
,
isRootUser
,
isWindows
,
isMacintosh
}
from
'
vs/base/common/platform
'
;
import
product
from
'
vs/platform/node/product
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
IEditor
PartService
}
from
'
vs/workbench/browser/parts/editor/editor
'
;
import
{
IEditor
ServiceImpl
}
from
'
vs/workbench/browser/parts/editor/editor
'
;
const
TextInputActions
:
IAction
[]
=
[
new
Action
(
'
undo
'
,
nls
.
localize
(
'
undo
'
,
"
Undo
"
),
null
,
true
,
()
=>
document
.
execCommand
(
'
undo
'
)
&&
TPromise
.
as
(
true
)),
...
...
@@ -72,7 +72,7 @@ export class ElectronWindow extends Themable {
constructor
(
shellContainer
:
HTMLElement
,
@
IEditorService
private
editorService
:
IEditor
PartService
,
@
IEditorService
private
editorService
:
IEditor
ServiceImpl
,
@
IWindowsService
private
windowsService
:
IWindowsService
,
@
IWindowService
private
windowService
:
IWindowService
,
@
IWorkspaceConfigurationService
private
configurationService
:
IWorkspaceConfigurationService
,
...
...
@@ -295,9 +295,6 @@ export class ElectronWindow extends Themable {
ipc
.
send
(
'
vscode:workbenchLoaded
'
,
this
.
windowService
.
getCurrentWindowId
());
});
// Touchbar Support
this
.
updateTouchbarMenu
();
// Integrity warning
this
.
integrityService
.
isPure
().
then
(
res
=>
this
.
titleService
.
updateProperties
({
isPure
:
res
.
isPure
}));
...
...
src/vs/workbench/electron-browser/workbench.ts
浏览文件 @
e66065b4
...
...
@@ -598,8 +598,6 @@ export class Workbench extends Disposable implements IPartService {
}
};
this
.
editorGroupService
.
whenRestored
.
then
(()
=>
updateEditorContextKeys
());
this
.
_register
(
this
.
editorService
.
onDidActiveEditorChange
(()
=>
updateEditorContextKeys
()));
this
.
_register
(
this
.
editorService
.
onDidVisibleEditorsChange
(()
=>
updateEditorContextKeys
()));
this
.
_register
(
this
.
editorGroupService
.
onDidAddGroup
(()
=>
updateEditorContextKeys
()));
...
...
@@ -643,7 +641,7 @@ export class Workbench extends Disposable implements IPartService {
// Restore Editorpart
perf
.
mark
(
'
willRestoreEditors
'
);
restorePromises
.
push
(
this
.
editor
GroupService
.
whenRestored
.
then
(()
=>
{
restorePromises
.
push
(
this
.
editor
Part
.
whenRestored
.
then
(()
=>
{
return
this
.
resolveEditorsToOpen
().
then
(
inputs
=>
{
if
(
inputs
.
length
)
{
return
this
.
editorService
.
openEditors
(
inputs
);
...
...
src/vs/workbench/services/editor/browser/editorService.ts
浏览文件 @
e66065b4
...
...
@@ -30,7 +30,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import
{
Disposable
,
IDisposable
,
dispose
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
coalesce
}
from
'
vs/base/common/arrays
'
;
import
{
isCodeEditor
,
isDiffEditor
,
ICodeEditor
,
IDiffEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
IEditorGroupView
,
IEditorOpeningEvent
}
from
'
vs/workbench/browser/parts/editor/editor
'
;
import
{
IEditorGroupView
,
IEditorOpeningEvent
,
IEditorGroupsServiceImpl
}
from
'
vs/workbench/browser/parts/editor/editor
'
;
type
ICachedEditorInput
=
ResourceEditorInput
|
IFileEditorInput
|
DataUriEditorInput
;
...
...
@@ -63,7 +63,7 @@ export class EditorService extends Disposable implements IEditorService {
private
lastActiveGroupId
:
GroupIdentifier
;
constructor
(
@
IEditorGroupsService
private
editorGroupService
:
IEditorGroupsService
,
@
IEditorGroupsService
private
editorGroupService
:
IEditorGroupsService
Impl
,
@
IUntitledEditorService
private
untitledEditorService
:
IUntitledEditorService
,
@
IWorkspaceContextService
private
workspaceContextService
:
IWorkspaceContextService
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
...
...
@@ -79,11 +79,23 @@ export class EditorService extends Disposable implements IEditorService {
}
private
registerListeners
():
void
{
this
.
editorGroupService
.
whenRestored
.
then
(()
=>
this
.
editorGroupService
.
groups
.
forEach
(
group
=>
this
.
registerGroupListeners
(
group
as
IEditorGroupView
)
));
this
.
editorGroupService
.
whenRestored
.
then
(()
=>
this
.
onEditorsRestored
(
));
this
.
editorGroupService
.
onDidActiveGroupChange
(
group
=>
this
.
handleActiveEditorChange
(
group
));
this
.
editorGroupService
.
onDidAddGroup
(
group
=>
this
.
registerGroupListeners
(
group
as
IEditorGroupView
));
}
private
onEditorsRestored
():
void
{
// Register listeners to each opened group
this
.
editorGroupService
.
groups
.
forEach
(
group
=>
this
.
registerGroupListeners
(
group
as
IEditorGroupView
));
// Fire initial set of editor events if there is an active editor
if
(
this
.
activeEditor
)
{
this
.
doEmitActiveEditorChangeEvent
();
this
.
_onDidVisibleEditorsChange
.
fire
();
}
}
private
handleActiveEditorChange
(
group
:
IEditorGroup
):
void
{
if
(
group
!==
this
.
editorGroupService
.
activeGroup
)
{
return
;
// ignore if not the active group
...
...
@@ -97,8 +109,14 @@ export class EditorService extends Disposable implements IEditorService {
return
;
// ignore if the editor actually did not change
}
this
.
lastActiveGroupId
=
group
.
id
;
this
.
lastActiveEditor
=
group
.
activeEditor
;
this
.
doEmitActiveEditorChangeEvent
();
}
private
doEmitActiveEditorChangeEvent
():
void
{
const
activeGroup
=
this
.
editorGroupService
.
activeGroup
;
this
.
lastActiveGroupId
=
activeGroup
.
id
;
this
.
lastActiveEditor
=
activeGroup
.
activeEditor
;
this
.
_onDidActiveEditorChange
.
fire
();
}
...
...
@@ -580,7 +598,7 @@ export class DelegatingWorkbenchEditorService extends EditorService {
private
editorOpenHandler
:
IEditorOpenHandler
;
constructor
(
@
IEditorGroupsService
editorGroupService
:
IEditorGroupsService
,
@
IEditorGroupsService
editorGroupService
:
IEditorGroupsService
Impl
,
@
IUntitledEditorService
untitledEditorService
:
IUntitledEditorService
,
@
IWorkspaceContextService
workspaceContextService
:
IWorkspaceContextService
,
@
IInstantiationService
instantiationService
:
IInstantiationService
,
...
...
src/vs/workbench/services/editor/test/browser/editorService.test.ts
浏览文件 @
e66065b4
...
...
@@ -29,7 +29,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
import
{
FileEditorInput
}
from
'
vs/workbench/parts/files/common/editors/fileEditorInput
'
;
import
{
UntitledEditorInput
}
from
'
vs/workbench/common/editor/untitledEditorInput
'
;
import
{
DiffEditorInput
}
from
'
vs/workbench/common/editor/diffEditorInput
'
;
import
{
IEditor
PartService
}
from
'
vs/workbench/browser/parts/editor/editor
'
;
import
{
IEditor
ServiceImpl
}
from
'
vs/workbench/browser/parts/editor/editor
'
;
export
class
TestEditorControl
extends
BaseEditor
{
...
...
@@ -75,7 +75,7 @@ suite('Editor service', () => {
const
testInstantiationService
=
partInstantiator
.
createChild
(
new
ServiceCollection
([
IEditorGroupsService
,
part
]));
const
service
:
IEditor
PartService
=
testInstantiationService
.
createInstance
(
EditorService
);
const
service
:
IEditor
ServiceImpl
=
testInstantiationService
.
createInstance
(
EditorService
);
const
input
=
testInstantiationService
.
createInstance
(
TestEditorInput
,
URI
.
parse
(
'
my://resource
'
));
const
otherInput
=
testInstantiationService
.
createInstance
(
TestEditorInput
,
URI
.
parse
(
'
my://resource2
'
));
...
...
@@ -443,7 +443,7 @@ suite('Editor service', () => {
const
testInstantiationService
=
partInstantiator
.
createChild
(
new
ServiceCollection
([
IEditorGroupsService
,
part
]));
const
service
:
IEditor
PartService
=
testInstantiationService
.
createInstance
(
EditorService
);
const
service
:
IEditor
ServiceImpl
=
testInstantiationService
.
createInstance
(
EditorService
);
const
input
=
testInstantiationService
.
createInstance
(
TestEditorInput
,
URI
.
parse
(
'
my://resource
'
));
const
otherInput
=
testInstantiationService
.
createInstance
(
TestEditorInput
,
URI
.
parse
(
'
my://resource2
'
));
...
...
src/vs/workbench/services/group/common/editorGroupsService.ts
浏览文件 @
e66065b4
...
...
@@ -182,11 +182,6 @@ export interface IEditorGroupsService {
*/
readonly
orientation
:
GroupOrientation
;
/**
* A promise that resolves when groups have been restored.
*/
readonly
whenRestored
:
TPromise
<
void
>
;
/**
* Get all groups that are currently visible in the editor area optionally
* sorted by being most recent active or grid order. Will sort by creation
...
...
src/vs/workbench/services/history/electron-browser/history.ts
浏览文件 @
e66065b4
...
...
@@ -31,7 +31,7 @@ import { ICursorPositionChangedEvent } from 'vs/editor/common/controller/cursorE
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ResourceGlobMatcher
}
from
'
vs/workbench/electron-browser/resources
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
IEditor
PartService
}
from
'
vs/workbench/browser/parts/editor/editor
'
;
import
{
IEditor
ServiceImpl
}
from
'
vs/workbench/browser/parts/editor/editor
'
;
/**
* Stores the selection & view state of an editor and allows to compare it to other selection states.
...
...
@@ -125,7 +125,7 @@ export class HistoryService implements IHistoryService {
private
fileInputFactory
:
IFileInputFactory
;
constructor
(
@
IEditorService
private
editorService
:
IEditor
PartService
,
@
IEditorService
private
editorService
:
IEditor
ServiceImpl
,
@
IEditorGroupsService
private
editorGroupService
:
IEditorGroupsService
,
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
,
@
IStorageService
private
storageService
:
IStorageService
,
...
...
src/vs/workbench/test/workbenchTestServices.ts
浏览文件 @
e66065b4
...
...
@@ -15,7 +15,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import
{
NullTelemetryService
}
from
'
vs/platform/telemetry/common/telemetryUtils
'
;
import
{
StorageService
,
InMemoryLocalStorage
}
from
'
vs/platform/storage/common/storageService
'
;
import
{
ConfirmResult
,
IEditorInputWithOptions
,
CloseDirection
,
IEditorIdentifier
,
IUntitledResourceInput
,
IResourceDiffInput
,
IResourceSideBySideInput
,
IEditorInput
,
IEditor
,
IEditorCloseEvent
}
from
'
vs/workbench/common/editor
'
;
import
{
IEditorOpeningEvent
,
IEditor
PartService
,
IEditorGroupView
}
from
'
vs/workbench/browser/parts/editor/editor
'
;
import
{
IEditorOpeningEvent
,
IEditor
ServiceImpl
,
IEditorGroupView
,
IEditorGroupsServiceImpl
}
from
'
vs/workbench/browser/parts/editor/editor
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
{
IBackupFileService
}
from
'
vs/workbench/services/backup/common/backup
'
;
...
...
@@ -494,7 +494,7 @@ export class TestStorageService implements IStorageService {
}
}
export
class
TestEditorGroupsService
implements
IEditorGroupsService
{
export
class
TestEditorGroupsService
implements
IEditorGroupsService
Impl
{
_serviceBrand
:
ServiceIdentifier
<
any
>
;
constructor
(
public
groups
:
TestEditorGroup
[]
=
[])
{
}
...
...
@@ -669,7 +669,7 @@ export class TestEditorGroup implements IEditorGroupView {
layout
(
width
:
number
,
height
:
number
):
void
{
}
}
export
class
TestEditorService
implements
IEditor
PartService
{
export
class
TestEditorService
implements
IEditor
ServiceImpl
{
_serviceBrand
:
ServiceIdentifier
<
any
>
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录