Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
1b293495
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 搜索 >>
提交
1b293495
编写于
12月 16, 2019
作者:
R
rzj17
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor SortOrder & SortOrderConfiguration into one enum
上级
043da28d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
16 addition
and
18 deletion
+16
-18
src/vs/workbench/contrib/files/browser/files.contribution.ts
src/vs/workbench/contrib/files/browser/files.contribution.ts
+3
-3
src/vs/workbench/contrib/files/common/explorerModel.ts
src/vs/workbench/contrib/files/common/explorerModel.ts
+2
-2
src/vs/workbench/contrib/files/common/explorerService.ts
src/vs/workbench/contrib/files/common/explorerService.ts
+4
-4
src/vs/workbench/contrib/files/common/files.ts
src/vs/workbench/contrib/files/common/files.ts
+7
-9
未找到文件。
src/vs/workbench/contrib/files/browser/files.contribution.ts
浏览文件 @
1b293495
...
...
@@ -14,7 +14,7 @@ import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/wor
import
{
IWorkbenchContributionsRegistry
,
Extensions
as
WorkbenchExtensions
,
IWorkbenchContribution
}
from
'
vs/workbench/common/contributions
'
;
import
{
IEditorInputFactory
,
EditorInput
,
IFileEditorInput
,
IEditorInputFactoryRegistry
,
Extensions
as
EditorInputExtensions
}
from
'
vs/workbench/common/editor
'
;
import
{
AutoSaveConfiguration
,
HotExitConfiguration
}
from
'
vs/platform/files/common/files
'
;
import
{
VIEWLET_ID
,
SortOrder
Configuration
,
FILE_EDITOR_INPUT_ID
,
IExplorerService
}
from
'
vs/workbench/contrib/files/common/files
'
;
import
{
VIEWLET_ID
,
SortOrder
,
FILE_EDITOR_INPUT_ID
,
IExplorerService
}
from
'
vs/workbench/contrib/files/common/files
'
;
import
{
FileEditorTracker
}
from
'
vs/workbench/contrib/files/browser/editors/fileEditorTracker
'
;
import
{
TextFileSaveErrorHandler
}
from
'
vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler
'
;
import
{
FileEditorInput
}
from
'
vs/workbench/contrib/files/common/editors/fileEditorInput
'
;
...
...
@@ -396,8 +396,8 @@ configurationRegistry.registerConfiguration({
},
'
explorer.sortOrder
'
:
{
'
type
'
:
'
string
'
,
'
enum
'
:
[
SortOrder
Configuration
.
DEFAULT
,
SortOrderConfiguration
.
MIXED
,
SortOrderConfiguration
.
FILES_FIRST
,
SortOrderConfiguration
.
TYPE
,
SortOrderConfiguration
.
MODIFIED
],
'
default
'
:
SortOrder
Configuration
.
DEFAULT
,
'
enum
'
:
[
SortOrder
.
Default
,
SortOrder
.
Mixed
,
SortOrder
.
FilesFirst
,
SortOrder
.
Type
,
SortOrder
.
Modified
],
'
default
'
:
SortOrder
.
Default
,
'
enumDescriptions
'
:
[
nls
.
localize
(
'
sortOrder.default
'
,
'
Files and folders are sorted by their names, in alphabetical order. Folders are displayed before files.
'
),
nls
.
localize
(
'
sortOrder.mixed
'
,
'
Files and folders are sorted by their names, in alphabetical order. Files are interwoven with folders.
'
),
...
...
src/vs/workbench/contrib/files/common/explorerModel.ts
浏览文件 @
1b293495
...
...
@@ -14,7 +14,7 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
memoize
}
from
'
vs/base/common/decorators
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
IExplorerService
}
from
'
vs/workbench/contrib/files/common/files
'
;
import
{
IExplorerService
,
SortOrder
}
from
'
vs/workbench/contrib/files/common/files
'
;
import
{
joinPath
,
isEqualOrParent
,
basenameOrAuthority
}
from
'
vs/base/common/resources
'
;
export
class
ExplorerModel
implements
IDisposable
{
...
...
@@ -263,7 +263,7 @@ export class ExplorerItem {
if
(
!
this
.
_isDirectoryResolved
)
{
// Resolve metadata only when the mtime is needed since this can be expensive
// Mtime is only used when the sort order is 'modified'
const
resolveMetadata
=
explorerService
.
sortOrder
===
'
modified
'
;
const
resolveMetadata
=
explorerService
.
sortOrder
===
SortOrder
.
Modified
;
try
{
const
stat
=
await
fileService
.
resolve
(
this
.
resource
,
{
resolveSingleChildDescendants
:
true
,
resolveMetadata
});
const
resolved
=
ExplorerItem
.
create
(
explorerService
,
fileService
,
stat
,
this
);
...
...
src/vs/workbench/contrib/files/common/explorerService.ts
浏览文件 @
1b293495
...
...
@@ -6,7 +6,7 @@
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
IExplorerService
,
IFilesConfiguration
,
SortOrder
,
SortOrderConfiguration
,
IContextProvider
}
from
'
vs/workbench/contrib/files/common/files
'
;
import
{
IExplorerService
,
IFilesConfiguration
,
SortOrder
,
IContextProvider
}
from
'
vs/workbench/contrib/files/common/files
'
;
import
{
ExplorerItem
,
ExplorerModel
}
from
'
vs/workbench/contrib/files/common/explorerModel
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
FileOperationEvent
,
FileOperation
,
IFileStat
,
IFileService
,
FileChangesEvent
,
FILES_EXCLUDE_CONFIG
,
FileChangeType
,
IResolveFileOptions
,
FileSystemProviderCapabilities
}
from
'
vs/platform/files/common/files
'
;
...
...
@@ -187,7 +187,7 @@ export class ExplorerService implements IExplorerService {
}
// Stat needs to be resolved first and then revealed
const
options
:
IResolveFileOptions
=
{
resolveTo
:
[
resource
],
resolveMetadata
:
this
.
sortOrder
===
'
modified
'
};
const
options
:
IResolveFileOptions
=
{
resolveTo
:
[
resource
],
resolveMetadata
:
this
.
sortOrder
===
SortOrder
.
Modified
};
const
workspaceFolder
=
this
.
contextService
.
getWorkspaceFolder
(
resource
);
if
(
workspaceFolder
===
null
)
{
return
Promise
.
resolve
(
undefined
);
...
...
@@ -361,7 +361,7 @@ export class ExplorerService implements IExplorerService {
}
// Handle updated files/folders if we sort by modified
if
(
this
.
_sortOrder
===
SortOrder
Configuration
.
MODIFIED
)
{
if
(
this
.
_sortOrder
===
SortOrder
.
Modified
)
{
const
updated
=
e
.
getUpdated
();
// Check updated: Refresh if updated file/folder part of resolved root
...
...
@@ -387,7 +387,7 @@ export class ExplorerService implements IExplorerService {
private
filterToViewRelevantEvents
(
e
:
FileChangesEvent
):
FileChangesEvent
{
return
new
FileChangesEvent
(
e
.
changes
.
filter
(
change
=>
{
if
(
change
.
type
===
FileChangeType
.
UPDATED
&&
this
.
_sortOrder
!==
SortOrder
Configuration
.
MODIFIED
)
{
if
(
change
.
type
===
FileChangeType
.
UPDATED
&&
this
.
_sortOrder
!==
SortOrder
.
Modified
)
{
return
false
;
// we only are about updated if we sort by modified time
}
...
...
src/vs/workbench/contrib/files/common/files.ts
浏览文件 @
1b293495
...
...
@@ -133,15 +133,13 @@ export interface IFileResource {
isDirectory
?:
boolean
;
}
export
const
SortOrderConfiguration
=
{
DEFAULT
:
'
default
'
,
MIXED
:
'
mixed
'
,
FILES_FIRST
:
'
filesFirst
'
,
TYPE
:
'
type
'
,
MODIFIED
:
'
modified
'
};
export
type
SortOrder
=
'
default
'
|
'
mixed
'
|
'
filesFirst
'
|
'
type
'
|
'
modified
'
;
export
const
enum
SortOrder
{
Default
=
'
default
'
,
Mixed
=
'
mixed
'
,
FilesFirst
=
'
filesFirst
'
,
Type
=
'
type
'
,
Modified
=
'
modified
'
}
export
class
TextFileContentProvider
extends
Disposable
implements
ITextModelContentProvider
{
private
readonly
fileWatcherDisposable
=
this
.
_register
(
new
MutableDisposable
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录