Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
7194bce5
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,发现更多精彩内容 >>
提交
7194bce5
编写于
6月 18, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - remove unused IFileService#rename() method
上级
a322ea9a
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
6 addition
and
31 deletion
+6
-31
src/vs/platform/files/common/files.ts
src/vs/platform/files/common/files.ts
+0
-6
src/vs/workbench/services/files/electron-browser/fileService.ts
.../workbench/services/files/electron-browser/fileService.ts
+0
-6
src/vs/workbench/services/files/electron-browser/remoteFileService.ts
...ench/services/files/electron-browser/remoteFileService.ts
+0
-9
src/vs/workbench/services/files/test/electron-browser/fileService.test.ts
.../services/files/test/electron-browser/fileService.test.ts
+6
-6
src/vs/workbench/test/workbenchTestServices.ts
src/vs/workbench/test/workbenchTestServices.ts
+0
-4
未找到文件。
src/vs/platform/files/common/files.ts
浏览文件 @
7194bce5
...
@@ -127,12 +127,6 @@ export interface IFileService {
...
@@ -127,12 +127,6 @@ export interface IFileService {
*/
*/
createFolder
(
resource
:
URI
):
TPromise
<
IFileStat
>
;
createFolder
(
resource
:
URI
):
TPromise
<
IFileStat
>
;
/**
* Renames the provided file to use the new name. The returned promise
* will have the stat model object as a result.
*/
rename
(
resource
:
URI
,
newName
:
string
):
TPromise
<
IFileStat
>
;
/**
/**
* Deletes the provided file. The optional useTrash parameter allows to
* Deletes the provided file. The optional useTrash parameter allows to
* move the file to trash.
* move the file to trash.
...
...
src/vs/workbench/services/files/electron-browser/fileService.ts
浏览文件 @
7194bce5
...
@@ -847,12 +847,6 @@ export class FileService implements IFileService {
...
@@ -847,12 +847,6 @@ export class FileService implements IFileService {
));
));
}
}
public
rename
(
resource
:
uri
,
newName
:
string
):
TPromise
<
IFileStat
>
{
const
newPath
=
paths
.
join
(
paths
.
dirname
(
resource
.
fsPath
),
newName
);
return
this
.
moveFile
(
resource
,
uri
.
file
(
newPath
));
}
public
moveFile
(
source
:
uri
,
target
:
uri
,
overwrite
?:
boolean
):
TPromise
<
IFileStat
>
{
public
moveFile
(
source
:
uri
,
target
:
uri
,
overwrite
?:
boolean
):
TPromise
<
IFileStat
>
{
return
this
.
moveOrCopyFile
(
source
,
target
,
false
,
overwrite
);
return
this
.
moveOrCopyFile
(
source
,
target
,
false
,
overwrite
);
}
}
...
...
src/vs/workbench/services/files/electron-browser/remoteFileService.ts
浏览文件 @
7194bce5
...
@@ -537,15 +537,6 @@ export class RemoteFileService extends FileService {
...
@@ -537,15 +537,6 @@ export class RemoteFileService extends FileService {
}
}
}
}
rename
(
resource
:
URI
,
newName
:
string
):
TPromise
<
IFileStat
,
any
>
{
if
(
resource
.
scheme
===
Schemas
.
file
)
{
return
super
.
rename
(
resource
,
newName
);
}
else
{
const
target
=
resource
.
with
({
path
:
posix
.
join
(
resource
.
path
,
'
..
'
,
newName
)
});
return
this
.
_doMoveWithInScheme
(
resource
,
target
,
false
);
}
}
moveFile
(
source
:
URI
,
target
:
URI
,
overwrite
?:
boolean
):
TPromise
<
IFileStat
>
{
moveFile
(
source
:
URI
,
target
:
URI
,
overwrite
?:
boolean
):
TPromise
<
IFileStat
>
{
if
(
source
.
scheme
!==
target
.
scheme
)
{
if
(
source
.
scheme
!==
target
.
scheme
)
{
return
this
.
_doMoveAcrossScheme
(
source
,
target
);
return
this
.
_doMoveAcrossScheme
(
source
,
target
);
...
...
src/vs/workbench/services/files/test/electron-browser/fileService.test.ts
浏览文件 @
7194bce5
...
@@ -157,7 +157,7 @@ suite('FileService', () => {
...
@@ -157,7 +157,7 @@ suite('FileService', () => {
const
resource
=
uri
.
file
(
path
.
join
(
testDir
,
'
index.html
'
));
const
resource
=
uri
.
file
(
path
.
join
(
testDir
,
'
index.html
'
));
return
service
.
resolveFile
(
resource
).
then
(
source
=>
{
return
service
.
resolveFile
(
resource
).
then
(
source
=>
{
return
service
.
rename
(
source
.
resource
,
'
other.html
'
).
then
(
renamed
=>
{
return
service
.
moveFile
(
source
.
resource
,
uri
.
file
(
path
.
join
(
path
.
dirname
(
source
.
resource
.
fsPath
),
'
other.html
'
))
).
then
(
renamed
=>
{
assert
.
equal
(
fs
.
existsSync
(
renamed
.
resource
.
fsPath
),
true
);
assert
.
equal
(
fs
.
existsSync
(
renamed
.
resource
.
fsPath
),
true
);
assert
.
equal
(
fs
.
existsSync
(
source
.
resource
.
fsPath
),
false
);
assert
.
equal
(
fs
.
existsSync
(
source
.
resource
.
fsPath
),
false
);
...
@@ -181,7 +181,7 @@ suite('FileService', () => {
...
@@ -181,7 +181,7 @@ suite('FileService', () => {
const
resource
=
uri
.
file
(
path
.
join
(
testDir
,
'
index.html
'
));
const
resource
=
uri
.
file
(
path
.
join
(
testDir
,
'
index.html
'
));
return
service
.
resolveFile
(
resource
).
then
(
source
=>
{
return
service
.
resolveFile
(
resource
).
then
(
source
=>
{
return
service
.
rename
(
source
.
resource
,
renameToPath
).
then
(
renamed
=>
{
return
service
.
moveFile
(
source
.
resource
,
uri
.
file
(
path
.
join
(
path
.
dirname
(
source
.
resource
.
fsPath
),
renameToPath
))
).
then
(
renamed
=>
{
assert
.
equal
(
fs
.
existsSync
(
renamed
.
resource
.
fsPath
),
true
);
assert
.
equal
(
fs
.
existsSync
(
renamed
.
resource
.
fsPath
),
true
);
assert
.
equal
(
fs
.
existsSync
(
source
.
resource
.
fsPath
),
false
);
assert
.
equal
(
fs
.
existsSync
(
source
.
resource
.
fsPath
),
false
);
...
@@ -202,7 +202,7 @@ suite('FileService', () => {
...
@@ -202,7 +202,7 @@ suite('FileService', () => {
const
resource
=
uri
.
file
(
path
.
join
(
testDir
,
'
deep
'
));
const
resource
=
uri
.
file
(
path
.
join
(
testDir
,
'
deep
'
));
return
service
.
resolveFile
(
resource
).
then
(
source
=>
{
return
service
.
resolveFile
(
resource
).
then
(
source
=>
{
return
service
.
rename
(
source
.
resource
,
'
deeper
'
).
then
(
renamed
=>
{
return
service
.
moveFile
(
source
.
resource
,
uri
.
file
(
path
.
join
(
path
.
dirname
(
source
.
resource
.
fsPath
),
'
deeper
'
))
).
then
(
renamed
=>
{
assert
.
equal
(
fs
.
existsSync
(
renamed
.
resource
.
fsPath
),
true
);
assert
.
equal
(
fs
.
existsSync
(
renamed
.
resource
.
fsPath
),
true
);
assert
.
equal
(
fs
.
existsSync
(
source
.
resource
.
fsPath
),
false
);
assert
.
equal
(
fs
.
existsSync
(
source
.
resource
.
fsPath
),
false
);
...
@@ -226,7 +226,7 @@ suite('FileService', () => {
...
@@ -226,7 +226,7 @@ suite('FileService', () => {
const
resource
=
uri
.
file
(
path
.
join
(
testDir
,
'
deep
'
));
const
resource
=
uri
.
file
(
path
.
join
(
testDir
,
'
deep
'
));
return
service
.
resolveFile
(
resource
).
then
(
source
=>
{
return
service
.
resolveFile
(
resource
).
then
(
source
=>
{
return
service
.
rename
(
source
.
resource
,
renameToPath
).
then
(
renamed
=>
{
return
service
.
moveFile
(
source
.
resource
,
uri
.
file
(
path
.
join
(
path
.
dirname
(
source
.
resource
.
fsPath
),
renameToPath
))
).
then
(
renamed
=>
{
assert
.
equal
(
fs
.
existsSync
(
renamed
.
resource
.
fsPath
),
true
);
assert
.
equal
(
fs
.
existsSync
(
renamed
.
resource
.
fsPath
),
true
);
assert
.
equal
(
fs
.
existsSync
(
source
.
resource
.
fsPath
),
false
);
assert
.
equal
(
fs
.
existsSync
(
source
.
resource
.
fsPath
),
false
);
...
@@ -246,7 +246,7 @@ suite('FileService', () => {
...
@@ -246,7 +246,7 @@ suite('FileService', () => {
const
resource
=
uri
.
file
(
path
.
join
(
testDir
,
'
index.html
'
));
const
resource
=
uri
.
file
(
path
.
join
(
testDir
,
'
index.html
'
));
return
service
.
resolveFile
(
resource
).
then
(
source
=>
{
return
service
.
resolveFile
(
resource
).
then
(
source
=>
{
return
service
.
rename
(
source
.
resource
,
'
INDEX.html
'
).
then
(
renamed
=>
{
return
service
.
moveFile
(
source
.
resource
,
uri
.
file
(
path
.
join
(
path
.
dirname
(
source
.
resource
.
fsPath
),
'
INDEX.html
'
))
).
then
(
renamed
=>
{
assert
.
equal
(
fs
.
existsSync
(
renamed
.
resource
.
fsPath
),
true
);
assert
.
equal
(
fs
.
existsSync
(
renamed
.
resource
.
fsPath
),
true
);
assert
.
equal
(
path
.
basename
(
renamed
.
resource
.
fsPath
),
'
INDEX.html
'
);
assert
.
equal
(
path
.
basename
(
renamed
.
resource
.
fsPath
),
'
INDEX.html
'
);
...
@@ -430,7 +430,7 @@ suite('FileService', () => {
...
@@ -430,7 +430,7 @@ suite('FileService', () => {
test
(
'
copyFile - MIX CASE
'
,
function
()
{
test
(
'
copyFile - MIX CASE
'
,
function
()
{
return
service
.
resolveFile
(
uri
.
file
(
path
.
join
(
testDir
,
'
index.html
'
))).
then
(
source
=>
{
return
service
.
resolveFile
(
uri
.
file
(
path
.
join
(
testDir
,
'
index.html
'
))).
then
(
source
=>
{
return
service
.
rename
(
source
.
resource
,
'
CONWAY.js
'
).
then
(
renamed
=>
{
// index.html => CONWAY.js
return
service
.
moveFile
(
source
.
resource
,
uri
.
file
(
path
.
join
(
path
.
dirname
(
source
.
resource
.
fsPath
),
'
CONWAY.js
'
))).
then
(
renamed
=>
{
assert
.
equal
(
fs
.
existsSync
(
renamed
.
resource
.
fsPath
),
true
);
assert
.
equal
(
fs
.
existsSync
(
renamed
.
resource
.
fsPath
),
true
);
assert
.
ok
(
fs
.
readdirSync
(
testDir
).
some
(
f
=>
f
===
'
CONWAY.js
'
));
assert
.
ok
(
fs
.
readdirSync
(
testDir
).
some
(
f
=>
f
===
'
CONWAY.js
'
));
...
...
src/vs/workbench/test/workbenchTestServices.ts
浏览文件 @
7194bce5
...
@@ -840,10 +840,6 @@ export class TestFileService implements IFileService {
...
@@ -840,10 +840,6 @@ export class TestFileService implements IFileService {
return
TPromise
.
as
(
null
);
return
TPromise
.
as
(
null
);
}
}
rename
(
resource
:
URI
,
newName
:
string
):
TPromise
<
IFileStat
>
{
return
TPromise
.
as
(
null
);
}
onDidChangeFileSystemProviderRegistrations
=
Event
.
None
;
onDidChangeFileSystemProviderRegistrations
=
Event
.
None
;
registerProvider
(
scheme
:
string
,
provider
)
{
registerProvider
(
scheme
:
string
,
provider
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录