Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
15177f20
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,发现更多精彩内容 >>
提交
15177f20
编写于
11月 19, 2018
作者:
C
Christof Marti
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use file system service (#31450)
上级
6b524707
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
54 addition
and
26 deletion
+54
-26
src/vs/platform/files/common/files.ts
src/vs/platform/files/common/files.ts
+6
-0
src/vs/workbench/parts/welcome/page/electron-browser/welcomePage.ts
...kbench/parts/welcome/page/electron-browser/welcomePage.ts
+29
-26
src/vs/workbench/services/files/electron-browser/fileService.ts
.../workbench/services/files/electron-browser/fileService.ts
+5
-0
src/vs/workbench/services/files/electron-browser/remoteFileService.ts
...ench/services/files/electron-browser/remoteFileService.ts
+10
-0
src/vs/workbench/test/workbenchTestServices.ts
src/vs/workbench/test/workbenchTestServices.ts
+4
-0
未找到文件。
src/vs/platform/files/common/files.ts
浏览文件 @
15177f20
...
...
@@ -125,6 +125,12 @@ export interface IFileService {
*/
createFile
(
resource
:
URI
,
content
?:
string
,
options
?:
ICreateFileOptions
):
TPromise
<
IFileStat
>
;
/**
* Reads a folder's content with the given path. The returned promise
* will have the list of children as a result.
*/
readFolder
(
resource
:
URI
):
TPromise
<
string
[]
>
;
/**
* Creates a new folder with the given path. The returned promise
* will have the stat model object as a result.
...
...
src/vs/workbench/parts/welcome/page/electron-browser/welcomePage.ts
浏览文件 @
15177f20
...
...
@@ -5,8 +5,8 @@
import
'
vs/css!./welcomePage
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
*
as
path
from
'
path
'
;
import
{
readdir
}
from
'
vs/base/node/extfs
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
*
as
arrays
from
'
vs/base/common/arrays
'
;
import
{
WalkThroughInput
}
from
'
vs/workbench/parts/welcome/walkThrough/node/walkThroughInput
'
;
...
...
@@ -27,7 +27,7 @@ import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
import
{
getInstalledExtensions
,
IExtensionStatus
,
onExtensionChanged
,
isKeymapExtension
}
from
'
vs/workbench/parts/extensions/electron-browser/extensionsUtils
'
;
import
{
IExtensionEnablementService
,
IExtensionManagementService
,
IExtensionGalleryService
,
IExtensionTipsService
,
EnablementState
,
LocalExtensionType
}
from
'
vs/platform/extensionManagement/common/extensionManagement
'
;
import
{
used
}
from
'
vs/workbench/parts/welcome/page/electron-browser/vs_code_welcome_page
'
;
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
ILifecycleService
,
StartupKind
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
tildify
,
getBaseLabel
}
from
'
vs/base/common/labels
'
;
import
{
registerThemingParticipant
}
from
'
vs/platform/theme/common/themeService
'
;
...
...
@@ -41,6 +41,7 @@ import { INotificationService, Severity } from 'vs/platform/notification/common/
import
{
TimeoutTimer
}
from
'
vs/base/common/async
'
;
import
{
areSameExtensions
}
from
'
vs/platform/extensionManagement/common/extensionManagementUtil
'
;
import
{
ILabelService
}
from
'
vs/platform/label/common/label
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
used
();
...
...
@@ -55,44 +56,46 @@ export class WelcomePageContribution implements IWorkbenchContribution {
@
IConfigurationService
configurationService
:
IConfigurationService
,
@
IEditorService
editorService
:
IEditorService
,
@
IBackupFileService
backupFileService
:
IBackupFileService
,
@
IFileService
fileService
:
IFileService
,
@
IWorkspaceContextService
contextService
:
IWorkspaceContextService
,
@
ILifecycleService
lifecycleService
:
ILifecycleService
,
@
ICommandService
private
commandService
:
ICommandService
,
)
{
const
enabled
=
isWelcomePageEnabled
(
configurationService
,
contextService
);
if
(
enabled
/* && lifecycleService.startupKind !== StartupKind.ReloadedWindow */
)
{
if
(
enabled
&&
lifecycleService
.
startupKind
!==
StartupKind
.
ReloadedWindow
)
{
backupFileService
.
hasBackups
().
then
(
hasBackups
=>
{
const
activeEditor
=
editorService
.
activeEditor
;
if
(
!
activeEditor
&&
!
hasBackups
)
{
const
openWithReadme
=
configurationService
.
getValue
(
configurationKey
)
===
'
readme
'
;
if
(
openWithReadme
)
{
let
foldersChecked
=
0
;
let
readmeOpened
=
false
;
const
workSpaceFolders
=
contextService
.
getWorkspace
().
folders
.
map
(
el
=>
el
.
uri
);
for
(
const
workSpaceFolder
of
workSpaceFolders
)
{
readdir
(
workSpaceFolder
.
path
,
(
err
,
files
)
=>
{
foldersChecked
++
;
if
(
err
)
{
onUnexpectedError
(
err
);
}
else
if
(
!
readmeOpened
)
{
for
(
const
content
of
files
)
{
if
(
content
.
toLowerCase
().
lastIndexOf
(
'
readme
'
,
0
)
===
0
)
{
readmeOpened
=
true
;
const
readmeLocation
=
path
.
join
(
workSpaceFolder
.
path
,
content
);
if
(
readmeLocation
.
toLowerCase
().
slice
(
readmeLocation
.
length
-
3
)
===
'
.md
'
)
{
this
.
commandService
.
executeCommand
(
'
markdown.showPreview
'
,
URI
.
file
(
readmeLocation
));
}
else
{
editorService
.
openEditor
({
resource
:
URI
.
file
(
readmeLocation
)
});
}
}
return
Promise
.
all
(
contextService
.
getWorkspace
().
folders
.
map
(
folder
=>
{
const
folderUri
=
folder
.
uri
;
return
fileService
.
readFolder
(
folderUri
)
.
then
(
files
=>
{
const
file
=
arrays
.
find
(
files
.
sort
(),
file
=>
strings
.
startsWith
(
file
.
toLowerCase
(),
'
readme
'
));
if
(
file
)
{
return
folderUri
.
with
({
path
:
path
.
posix
.
join
(
folderUri
.
path
,
file
)
});
}
return
undefined
;
},
onUnexpectedError
);
})).
then
(
results
=>
results
.
filter
(
result
=>
!!
result
))
.
then
<
any
>
(
readmes
=>
{
if
(
!
editorService
.
activeEditor
)
{
if
(
readmes
.
length
)
{
const
isMarkDown
=
(
readme
:
URI
)
=>
strings
.
endsWith
(
readme
.
path
.
toLowerCase
(),
'
.md
'
);
return
Promise
.
all
([
this
.
commandService
.
executeCommand
(
'
markdown.showPreview
'
,
null
,
readmes
.
filter
(
isMarkDown
),
{
locked
:
true
}),
editorService
.
openEditors
(
readmes
.
filter
(
readme
=>
!
isMarkDown
(
readme
))
.
map
(
readme
=>
({
resource
:
readme
}))),
]);
}
else
{
return
instantiationService
.
createInstance
(
WelcomePage
).
openEditor
();
}
}
if
(
!
readmeOpened
&&
foldersChecked
===
workSpaceFolders
.
length
)
{
return
instantiationService
.
createInstance
(
WelcomePage
).
openEditor
();
}
return
undefined
;
});
}
}
else
{
return
instantiationService
.
createInstance
(
WelcomePage
).
openEditor
();
}
...
...
src/vs/workbench/services/files/electron-browser/fileService.ts
浏览文件 @
15177f20
...
...
@@ -751,6 +751,11 @@ export class FileService extends Disposable implements IFileService {
});
}
readFolder
(
resource
:
uri
):
TPromise
<
string
[]
>
{
const
absolutePath
=
this
.
toAbsolutePath
(
resource
);
return
pfs
.
readdir
(
absolutePath
);
}
createFolder
(
resource
:
uri
):
TPromise
<
IFileStat
>
{
// 1.) Create folder
...
...
src/vs/workbench/services/files/electron-browser/remoteFileService.ts
浏览文件 @
15177f20
...
...
@@ -520,6 +520,16 @@ export class RemoteFileService extends FileService {
}
}
readFolder
(
resource
:
URI
):
TPromise
<
string
[]
>
{
if
(
resource
.
scheme
===
Schemas
.
file
)
{
return
super
.
readFolder
(
resource
);
}
else
{
return
this
.
_withProvider
(
resource
).
then
(
provider
=>
{
return
provider
.
readdir
(
resource
);
}).
then
(
list
=>
list
.
map
(
l
=>
l
[
0
]));
}
}
createFolder
(
resource
:
URI
):
TPromise
<
IFileStat
>
{
if
(
resource
.
scheme
===
Schemas
.
file
)
{
return
super
.
createFolder
(
resource
);
...
...
src/vs/workbench/test/workbenchTestServices.ts
浏览文件 @
15177f20
...
...
@@ -874,6 +874,10 @@ export class TestFileService implements IFileService {
return
TPromise
.
as
(
null
);
}
readFolder
(
_resource
:
URI
)
{
return
TPromise
.
as
([]);
}
createFolder
(
_resource
:
URI
):
TPromise
<
IFileStat
>
{
return
TPromise
.
as
(
null
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录