Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
1d30452c
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,发现更多精彩内容 >>
提交
1d30452c
编写于
5月 18, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
grid - add and use IEditorService.editors
上级
6bb20cb3
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
49 addition
and
44 deletion
+49
-44
src/vs/workbench/parts/backup/common/backupRestorer.ts
src/vs/workbench/parts/backup/common/backupRestorer.ts
+1
-3
src/vs/workbench/parts/files/browser/editors/fileEditorTracker.ts
...orkbench/parts/files/browser/editors/fileEditorTracker.ts
+16
-18
src/vs/workbench/parts/files/common/dirtyFilesTracker.ts
src/vs/workbench/parts/files/common/dirtyFilesTracker.ts
+1
-1
src/vs/workbench/parts/files/test/browser/fileEditorInput.test.ts
...orkbench/parts/files/test/browser/fileEditorInput.test.ts
+1
-3
src/vs/workbench/parts/outline/electron-browser/outlinePanel.ts
.../workbench/parts/outline/electron-browser/outlinePanel.ts
+0
-2
src/vs/workbench/parts/search/browser/openFileHandler.ts
src/vs/workbench/parts/search/browser/openFileHandler.ts
+3
-4
src/vs/workbench/parts/search/browser/searchView.ts
src/vs/workbench/parts/search/browser/searchView.ts
+1
-3
src/vs/workbench/parts/search/common/search.ts
src/vs/workbench/parts/search/common/search.ts
+7
-10
src/vs/workbench/services/editor/browser/nextEditorService.ts
...vs/workbench/services/editor/browser/nextEditorService.ts
+9
-0
src/vs/workbench/services/editor/common/nextEditorService.ts
src/vs/workbench/services/editor/common/nextEditorService.ts
+5
-0
src/vs/workbench/services/editor/test/browser/nextEditorService.test.ts
...ch/services/editor/test/browser/nextEditorService.test.ts
+4
-0
src/vs/workbench/test/workbenchTestServices.ts
src/vs/workbench/test/workbenchTestServices.ts
+1
-0
未找到文件。
src/vs/workbench/parts/backup/common/backupRestorer.ts
浏览文件 @
1d30452c
...
...
@@ -11,7 +11,6 @@ import { IUntitledEditorService } from 'vs/workbench/services/untitled/common/un
import
{
IWorkbenchContribution
}
from
'
vs/workbench/common/contributions
'
;
import
*
as
errors
from
'
vs/base/common/errors
'
;
import
{
IBackupFileService
}
from
'
vs/workbench/services/backup/common/backup
'
;
import
{
INextEditorGroupsService
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
import
{
IResourceInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
ITextFileService
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
...
...
@@ -29,7 +28,6 @@ export class BackupRestorer implements IWorkbenchContribution {
@
INextEditorService
private
editorService
:
INextEditorService
,
@
IBackupFileService
private
backupFileService
:
IBackupFileService
,
@
ITextFileService
private
textFileService
:
ITextFileService
,
@
INextEditorGroupsService
private
editorGroupService
:
INextEditorGroupsService
,
@
ILifecycleService
private
lifecycleService
:
ILifecycleService
,
@
IFileService
private
fileService
:
IFileService
)
{
...
...
@@ -82,7 +80,7 @@ export class BackupRestorer implements IWorkbenchContribution {
}
private
doOpenEditors
(
resources
:
URI
[]):
TPromise
<
void
>
{
const
hasOpenedEditors
=
this
.
editor
GroupService
.
count
>
0
;
const
hasOpenedEditors
=
this
.
editor
Service
.
visibleEditors
.
length
>
0
;
const
inputs
=
resources
.
map
((
resource
,
index
)
=>
this
.
resolveInput
(
resource
,
index
,
hasOpenedEditors
));
// Open all remaining backups as editors and resolve them to load their backups
...
...
src/vs/workbench/parts/files/browser/editors/fileEditorTracker.ts
浏览文件 @
1d30452c
...
...
@@ -189,29 +189,27 @@ export class FileEditorTracker implements IWorkbenchContribution {
private
getOpenedFileEditors
(
dirtyState
:
boolean
):
FileEditorInput
[]
{
const
editors
:
FileEditorInput
[]
=
[];
this
.
editorGroupService
.
groups
.
forEach
(
group
=>
{
group
.
editors
.
forEach
(
editor
=>
{
if
(
editor
instanceof
FileEditorInput
)
{
if
(
!!
editor
.
isDirty
()
===
dirtyState
)
{
editors
.
push
(
editor
);
}
}
else
if
(
editor
instanceof
SideBySideEditorInput
)
{
const
master
=
editor
.
master
;
const
details
=
editor
.
details
;
this
.
editorService
.
editors
.
forEach
(
editor
=>
{
if
(
editor
instanceof
FileEditorInput
)
{
if
(
!!
editor
.
isDirty
()
===
dirtyState
)
{
editors
.
push
(
editor
);
}
}
else
if
(
editor
instanceof
SideBySideEditorInput
)
{
const
master
=
editor
.
master
;
const
details
=
editor
.
details
;
if
(
master
instanceof
FileEditorInput
)
{
if
(
!!
master
.
isDirty
()
===
dirtyState
)
{
editors
.
push
(
master
);
}
if
(
master
instanceof
FileEditorInput
)
{
if
(
!!
master
.
isDirty
()
===
dirtyState
)
{
editors
.
push
(
master
);
}
}
if
(
details
instanceof
FileEditorInput
)
{
if
(
!!
details
.
isDirty
()
===
dirtyState
)
{
editors
.
push
(
details
);
}
if
(
details
instanceof
FileEditorInput
)
{
if
(
!!
details
.
isDirty
()
===
dirtyState
)
{
editors
.
push
(
details
);
}
}
}
);
}
});
return
editors
;
...
...
src/vs/workbench/parts/files/common/dirtyFilesTracker.ts
浏览文件 @
1d30452c
...
...
@@ -90,7 +90,7 @@ export class DirtyFilesTracker implements IWorkbenchContribution {
private
doOpenDirtyResources
(
resources
:
URI
[]):
void
{
const
activeEditor
=
this
.
editorService
.
activeControl
;
const
activeGroup
=
activeEditor
?
activeEditor
.
group
:
this
.
editorGroupService
.
activeGroup
.
id
;
const
activeGroup
=
activeEditor
?
activeEditor
.
group
:
this
.
editorGroupService
.
activeGroup
;
// Open
this
.
editorService
.
openEditors
(
resources
.
map
(
resource
=>
{
...
...
src/vs/workbench/parts/files/test/browser/fileEditorInput.test.ts
浏览文件 @
1d30452c
...
...
@@ -16,7 +16,6 @@ import { ITextFileService } from 'vs/workbench/services/textfile/common/textfile
import
{
FileOperationResult
,
FileOperationError
}
from
'
vs/platform/files/common/files
'
;
import
{
TextFileEditorModel
}
from
'
vs/workbench/services/textfile/common/textFileEditorModel
'
;
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
));
...
...
@@ -26,8 +25,7 @@ class ServiceAccessor {
constructor
(
@
INextEditorService
public
editorService
:
INextEditorService
,
@
ITextFileService
public
textFileService
:
TestTextFileService
,
@
IModelService
public
modelService
:
IModelService
,
@
INextEditorGroupsService
public
editorGroupService
:
INextEditorGroupsService
@
IModelService
public
modelService
:
IModelService
)
{
}
}
...
...
src/vs/workbench/parts/outline/electron-browser/outlinePanel.ts
浏览文件 @
1d30452c
...
...
@@ -36,7 +36,6 @@ import { IThemeService } from 'vs/platform/theme/common/themeService';
import
{
IViewOptions
,
ViewsViewletPanel
}
from
'
vs/workbench/browser/parts/views/viewsViewlet
'
;
import
{
CollapseAction
}
from
'
vs/workbench/browser/viewlet
'
;
import
{
INextEditorService
,
SIDE_GROUP
,
ACTIVE_GROUP
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
import
{
INextEditorGroupsService
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
import
{
OutlineElement
,
OutlineModel
,
TreeElement
}
from
'
./outlineModel
'
;
import
{
OutlineController
,
OutlineDataSource
,
OutlineItemComparator
,
OutlineItemCompareType
,
OutlineItemFilter
,
OutlineRenderer
,
OutlineTreeState
}
from
'
./outlineTree
'
;
import
{
StandardMouseEvent
}
from
'
vs/base/browser/mouseEvent
'
;
...
...
@@ -74,7 +73,6 @@ class RequestOracle {
constructor
(
private
readonly
_callback
:
(
editor
:
ICodeEditor
,
change
:
IModelContentChangedEvent
)
=>
any
,
private
readonly
_featureRegistry
:
LanguageFeatureRegistry
<
any
>
,
@
INextEditorGroupsService
editorGroupService
:
INextEditorGroupsService
,
@
INextEditorService
private
readonly
_editorService
:
INextEditorService
,
)
{
_editorService
.
onDidActiveEditorChange
(
this
.
_update
,
this
,
this
.
_disposables
);
...
...
src/vs/workbench/parts/search/browser/openFileHandler.ts
浏览文件 @
1d30452c
...
...
@@ -23,7 +23,6 @@ import { QuickOpenEntry, QuickOpenModel } from 'vs/base/parts/quickopen/browser/
import
{
QuickOpenHandler
,
EditorQuickOpenEntry
}
from
'
vs/workbench/browser/quickopen
'
;
import
{
QueryBuilder
}
from
'
vs/workbench/parts/search/common/queryBuilder
'
;
import
{
EditorInput
,
IWorkbenchEditorConfiguration
}
from
'
vs/workbench/common/editor
'
;
import
{
INextEditorGroupsService
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
import
{
IResourceInput
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -118,7 +117,7 @@ export class OpenFileHandler extends QuickOpenHandler {
private
cacheState
:
CacheState
;
constructor
(
@
INextEditor
GroupsService
private
editorGroupService
:
INextEditorGroups
Service
,
@
INextEditor
Service
private
editorService
:
INextEditor
Service
,
@
IInstantiationService
private
instantiationService
:
IInstantiationService
,
@
IWorkbenchThemeService
private
themeService
:
IWorkbenchThemeService
,
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
,
...
...
@@ -151,7 +150,7 @@ export class OpenFileHandler extends QuickOpenHandler {
private
doFindResults
(
searchValue
:
string
,
cacheKey
?:
string
,
maxSortedResults
?:
number
):
TPromise
<
FileQuickOpenModel
>
{
const
query
:
IQueryOptions
=
{
extraFileResources
:
getOutOfWorkspaceEditorResources
(
this
.
editor
Group
Service
,
this
.
contextService
),
extraFileResources
:
getOutOfWorkspaceEditorResources
(
this
.
editorService
,
this
.
contextService
),
filePattern
:
searchValue
,
cacheKey
:
cacheKey
};
...
...
@@ -193,7 +192,7 @@ export class OpenFileHandler extends QuickOpenHandler {
private
cacheQuery
(
cacheKey
:
string
):
ISearchQuery
{
const
options
:
IQueryOptions
=
{
extraFileResources
:
getOutOfWorkspaceEditorResources
(
this
.
editor
Group
Service
,
this
.
contextService
),
extraFileResources
:
getOutOfWorkspaceEditorResources
(
this
.
editorService
,
this
.
contextService
),
filePattern
:
''
,
cacheKey
:
cacheKey
,
maxResults
:
0
,
...
...
src/vs/workbench/parts/search/browser/searchView.ts
浏览文件 @
1d30452c
...
...
@@ -24,7 +24,6 @@ import { FindInput } from 'vs/base/browser/ui/findinput/findInput';
import
{
ITree
,
IFocusEvent
}
from
'
vs/base/parts/tree/browser/tree
'
;
import
{
Scope
}
from
'
vs/workbench/common/memento
'
;
import
{
IPreferencesService
}
from
'
vs/workbench/services/preferences/common/preferences
'
;
import
{
INextEditorGroupsService
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
import
{
FileChangeType
,
FileChangesEvent
,
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
Match
,
FileMatch
,
SearchModel
,
FileMatchOrMatch
,
IChangeEvent
,
ISearchWorkbenchService
,
FolderMatch
}
from
'
vs/workbench/parts/search/common/searchModel
'
;
import
{
QueryBuilder
}
from
'
vs/workbench/parts/search/common/queryBuilder
'
;
...
...
@@ -118,7 +117,6 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
IFileService
private
fileService
:
IFileService
,
@
INextEditorService
private
editorService
:
INextEditorService
,
@
INextEditorGroupsService
private
editorGroupService
:
INextEditorGroupsService
,
@
IProgressService
private
progressService
:
IProgressService
,
@
INotificationService
private
notificationService
:
INotificationService
,
@
IDialogService
private
dialogService
:
IDialogService
,
...
...
@@ -1068,7 +1066,7 @@ export class SearchView extends Viewlet implements IViewlet, IPanel {
const
includePattern
=
this
.
inputPatternIncludes
.
getValue
();
const
options
:
IQueryOptions
=
{
extraFileResources
:
getOutOfWorkspaceEditorResources
(
this
.
editor
Group
Service
,
this
.
contextService
),
extraFileResources
:
getOutOfWorkspaceEditorResources
(
this
.
editorService
,
this
.
contextService
),
maxResults
:
SearchView
.
MAX_TEXT_RESULTS
,
disregardIgnoreFiles
:
!
useExcludesAndIgnoreFiles
,
disregardExcludeSettings
:
!
useExcludesAndIgnoreFiles
,
...
...
src/vs/workbench/parts/search/common/search.ts
浏览文件 @
1d30452c
...
...
@@ -10,10 +10,10 @@ import { onUnexpectedError } from 'vs/base/common/errors';
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
ISearchConfiguration
,
ISearchConfigurationProperties
}
from
'
vs/platform/search/common/search
'
;
import
{
SymbolInformation
}
from
'
vs/editor/common/modes
'
;
import
{
INextEditorGroupsService
}
from
'
vs/workbench/services/group/common/nextEditorGroupsService
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
toResource
}
from
'
vs/workbench/common/editor
'
;
import
{
INextEditorService
}
from
'
vs/workbench/services/editor/common/nextEditorService
'
;
export
interface
IWorkspaceSymbolProvider
{
provideWorkspaceSymbols
(
search
:
string
):
TPromise
<
SymbolInformation
[]
>
;
...
...
@@ -76,17 +76,14 @@ export interface IWorkbenchSearchConfiguration extends ISearchConfiguration {
/**
* Helper to return all opened editors with resources not belonging to the currently opened workspace.
*/
export
function
getOutOfWorkspaceEditorResources
(
editor
GroupService
:
INextEditorGroups
Service
,
contextService
:
IWorkspaceContextService
):
URI
[]
{
export
function
getOutOfWorkspaceEditorResources
(
editor
Service
:
INextEditor
Service
,
contextService
:
IWorkspaceContextService
):
URI
[]
{
const
resources
:
URI
[]
=
[];
editorGroupService
.
groups
.
forEach
(
group
=>
{
const
editors
=
group
.
editors
;
editors
.
forEach
(
editor
=>
{
const
resource
=
toResource
(
editor
,
{
supportSideBySide
:
true
});
if
(
resource
&&
!
contextService
.
isInsideWorkspace
(
resource
))
{
resources
.
push
(
resource
);
}
});
editorService
.
editors
.
forEach
(
editor
=>
{
const
resource
=
toResource
(
editor
,
{
supportSideBySide
:
true
});
if
(
resource
&&
!
contextService
.
isInsideWorkspace
(
resource
))
{
resources
.
push
(
resource
);
}
});
return
resources
;
...
...
src/vs/workbench/services/editor/browser/nextEditorService.ts
浏览文件 @
1d30452c
...
...
@@ -152,6 +152,15 @@ export class NextEditorService extends Disposable implements INextEditorService
return
void
0
;
}
get
editors
():
IEditorInput
[]
{
const
editors
:
IEditorInput
[]
=
[];
this
.
nextEditorGroupsService
.
groups
.
forEach
(
group
=>
{
editors
.
push
(...
group
.
editors
);
});
return
editors
;
}
get
activeEditor
():
IEditorInput
{
const
activeGroup
=
this
.
nextEditorGroupsService
.
activeGroup
;
...
...
src/vs/workbench/services/editor/common/nextEditorService.ts
浏览文件 @
1d30452c
...
...
@@ -77,6 +77,11 @@ export interface INextEditorService {
*/
readonly
activeTextEditorControl
:
ITextEditor
;
/**
* All editors that are opened.
*/
readonly
editors
:
ReadonlyArray
<
IEditorInput
>
;
/**
* The currently active editor if any.
*/
...
...
src/vs/workbench/services/editor/test/browser/nextEditorService.test.ts
浏览文件 @
1d30452c
...
...
@@ -290,6 +290,10 @@ suite('Editor service (editor2)', () => {
// Open input
return
service
.
openEditor
(
input
,
{
pinned
:
true
}).
then
(
editor
=>
{
return
service
.
openEditor
(
input
,
{
pinned
:
true
},
rightGroup
).
then
(
editor
=>
{
const
editors
=
service
.
editors
;
assert
.
equal
(
editors
.
length
,
2
);
assert
.
equal
(
editors
[
0
],
input
);
assert
.
equal
(
editors
[
1
],
input
);
// Close input
return
rootGroup
.
closeEditor
(
input
).
then
(()
=>
{
...
...
src/vs/workbench/test/workbenchTestServices.ts
浏览文件 @
1d30452c
...
...
@@ -865,6 +865,7 @@ export class TestNextEditorService implements INextEditorService {
activeControl
:
IEditor
;
activeTextEditorControl
:
any
;
activeEditor
:
IEditorInput
;
editors
:
ReadonlyArray
<
IEditorInput
>
=
[];
visibleControls
:
ReadonlyArray
<
IEditor
>
=
[];
visibleTextEditorControls
=
[];
visibleEditors
:
ReadonlyArray
<
IEditorInput
>
=
[];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录