Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
88ba6f80
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,发现更多精彩内容 >>
提交
88ba6f80
编写于
6月 04, 2018
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove old, proposed fsp api, #50859
上级
4cacd327
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
12 addition
and
175 deletion
+12
-175
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+0
-40
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+0
-5
src/vs/workbench/api/node/extHostFileSystem.ts
src/vs/workbench/api/node/extHostFileSystem.ts
+12
-118
src/vs/workbench/api/node/extHostTypes.ts
src/vs/workbench/api/node/extHostTypes.ts
+0
-12
未找到文件。
src/vs/vscode.proposed.d.ts
浏览文件 @
88ba6f80
...
...
@@ -11,46 +11,6 @@ declare module 'vscode' {
export
function
sampleFunction
():
Thenable
<
any
>
;
}
//#region Joh: file system provider (OLD)
export
enum
DeprecatedFileChangeType
{
Updated
=
0
,
Added
=
1
,
Deleted
=
2
}
export
interface
DeprecatedFileChange
{
type
:
DeprecatedFileChangeType
;
resource
:
Uri
;
}
export
enum
DeprecatedFileType
{
File
=
0
,
Dir
=
1
,
Symlink
=
2
}
export
interface
DeprecatedFileStat
{
id
:
number
|
string
;
mtime
:
number
;
size
:
number
;
type
:
DeprecatedFileType
;
}
export
interface
DeprecatedFileSystemProvider
{
readonly
onDidChange
?:
Event
<
DeprecatedFileChange
[]
>
;
utimes
(
resource
:
Uri
,
mtime
:
number
,
atime
:
number
):
Thenable
<
DeprecatedFileStat
>
;
stat
(
resource
:
Uri
):
Thenable
<
DeprecatedFileStat
>
;
read
(
resource
:
Uri
,
offset
:
number
,
length
:
number
,
progress
:
Progress
<
Uint8Array
>
):
Thenable
<
number
>
;
write
(
resource
:
Uri
,
content
:
Uint8Array
):
Thenable
<
void
>
;
move
(
resource
:
Uri
,
target
:
Uri
):
Thenable
<
DeprecatedFileStat
>
;
mkdir
(
resource
:
Uri
):
Thenable
<
DeprecatedFileStat
>
;
readdir
(
resource
:
Uri
):
Thenable
<
[
Uri
,
DeprecatedFileStat
][]
>
;
rmdir
(
resource
:
Uri
):
Thenable
<
void
>
;
unlink
(
resource
:
Uri
):
Thenable
<
void
>
;
}
export
namespace
workspace
{
export
function
registerDeprecatedFileSystemProvider
(
scheme
:
string
,
provider
:
DeprecatedFileSystemProvider
):
Disposable
;
}
//#endregion
//#region Joh: remote, search provider
export
interface
TextSearchQuery
{
...
...
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
88ba6f80
...
...
@@ -560,9 +560,6 @@ export function createApiFactory(
registerFileSystemProvider
(
scheme
,
provider
,
options
)
{
return
extHostFileSystem
.
registerFileSystemProvider
(
scheme
,
provider
,
options
);
},
registerDeprecatedFileSystemProvider
:
proposedApiFunction
(
extension
,
(
scheme
,
provider
)
=>
{
return
extHostFileSystem
.
registerDeprecatedFileSystemProvider
(
scheme
,
provider
);
}),
registerSearchProvider
:
proposedApiFunction
(
extension
,
(
scheme
,
provider
)
=>
{
return
extHostSearch
.
registerSearchProvider
(
scheme
,
provider
);
}),
...
...
@@ -743,8 +740,6 @@ export function createApiFactory(
ConfigurationTarget
:
extHostTypes
.
ConfigurationTarget
,
RelativePattern
:
extHostTypes
.
RelativePattern
,
DeprecatedFileChangeType
:
extHostTypes
.
DeprecatedFileChangeType
,
DeprecatedFileType
:
extHostTypes
.
DeprecatedFileType
,
FileChangeType
:
extHostTypes
.
FileChangeType
,
FileType
:
files
.
FileType
,
FileSystemError
:
extHostTypes
.
FileSystemError
,
...
...
src/vs/workbench/api/node/extHostFileSystem.ts
浏览文件 @
88ba6f80
...
...
@@ -6,15 +6,13 @@
import
URI
,
{
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Event
,
mapEvent
}
from
'
vs/base/common/event
'
;
import
{
MainContext
,
IMainContext
,
ExtHostFileSystemShape
,
MainThreadFileSystemShape
,
IFileChangeDto
}
from
'
./extHost.protocol
'
;
import
*
as
vscode
from
'
vscode
'
;
import
*
as
files
from
'
vs/platform/files/common/files
'
;
import
*
as
path
from
'
path
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
{
values
}
from
'
vs/base/common/map
'
;
import
{
Range
,
DeprecatedFileType
,
DeprecatedFileChangeType
,
FileChangeType
}
from
'
vs/workbench/api/node/extHostTypes
'
;
import
{
Range
,
FileChangeType
}
from
'
vs/workbench/api/node/extHostTypes
'
;
import
{
ExtHostLanguageFeatures
}
from
'
vs/workbench/api/node/extHostLanguageFeatures
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
...
...
@@ -34,7 +32,7 @@ class FsLinkProvider implements vscode.DocumentLinkProvider {
}
}
provideDocumentLinks
(
document
:
vscode
.
TextDocument
,
token
:
vscode
.
CancellationToken
):
vscode
.
ProviderResult
<
vscode
.
DocumentLink
[]
>
{
provideDocumentLinks
(
document
:
vscode
.
TextDocument
):
vscode
.
ProviderResult
<
vscode
.
DocumentLink
[]
>
{
if
(
this
.
_schemes
.
size
===
0
)
{
return
undefined
;
}
...
...
@@ -60,106 +58,6 @@ class FsLinkProvider implements vscode.DocumentLinkProvider {
}
}
class
FileSystemProviderShim
implements
vscode
.
FileSystemProvider
{
onDidChangeFile
:
vscode
.
Event
<
vscode
.
FileChangeEvent
[]
>
;
constructor
(
private
readonly
_delegate
:
vscode
.
DeprecatedFileSystemProvider
)
{
if
(
!
this
.
_delegate
.
onDidChange
)
{
this
.
onDidChangeFile
=
Event
.
None
;
}
else
{
this
.
onDidChangeFile
=
mapEvent
(
this
.
_delegate
.
onDidChange
,
old
=>
old
.
map
(
FileSystemProviderShim
.
_modernizeFileChange
));
}
}
watch
(
uri
:
vscode
.
Uri
,
options
:
{}):
vscode
.
Disposable
{
// does nothing because in the old API there was no notion of
// watch and provider decide what file events to generate...
return
{
dispose
()
{
}
};
}
stat
(
resource
:
vscode
.
Uri
):
Thenable
<
vscode
.
FileStat
>
{
return
this
.
_delegate
.
stat
(
resource
).
then
(
stat
=>
FileSystemProviderShim
.
_modernizeFileStat
(
stat
));
}
rename
(
oldUri
:
vscode
.
Uri
,
newUri
:
vscode
.
Uri
):
Thenable
<
void
>
{
return
this
.
_delegate
.
move
(
oldUri
,
newUri
).
then
(
stat
=>
void
0
);
}
readDirectory
(
resource
:
vscode
.
Uri
):
Thenable
<
[
string
,
vscode
.
FileType
][]
>
{
return
this
.
_delegate
.
readdir
(
resource
).
then
(
tuples
=>
{
return
tuples
.
map
(
tuple
=>
<
[
string
,
vscode
.
FileType
]
>
[
path
.
posix
.
basename
(
tuple
[
0
].
path
),
FileSystemProviderShim
.
_modernizeFileStat
(
tuple
[
1
]).
type
]);
});
}
private
static
_modernizeFileStat
(
stat
:
vscode
.
DeprecatedFileStat
):
vscode
.
FileStat
{
let
{
mtime
,
size
,
type
}
=
stat
;
let
newType
:
files
.
FileType
;
// no support for bitmask, effectively no support for symlinks
switch
(
type
)
{
case
DeprecatedFileType
.
Dir
:
newType
=
files
.
FileType
.
Directory
;
break
;
case
DeprecatedFileType
.
File
:
newType
=
files
.
FileType
.
File
;
break
;
case
DeprecatedFileType
.
Symlink
:
newType
=
files
.
FileType
.
File
&
files
.
FileType
.
SymbolicLink
;
break
;
}
return
{
type
:
newType
,
ctime
:
0
,
mtime
,
size
};
}
private
static
_modernizeFileChange
(
e
:
vscode
.
DeprecatedFileChange
):
vscode
.
FileChangeEvent
{
let
{
resource
,
type
}
=
e
;
let
newType
:
vscode
.
FileChangeType
;
switch
(
type
)
{
case
DeprecatedFileChangeType
.
Updated
:
newType
=
FileChangeType
.
Changed
;
break
;
case
DeprecatedFileChangeType
.
Added
:
newType
=
FileChangeType
.
Created
;
break
;
case
DeprecatedFileChangeType
.
Deleted
:
newType
=
FileChangeType
.
Deleted
;
break
;
}
return
{
uri
:
resource
,
type
:
newType
};
}
// --- delete/create file or folder
delete
(
resource
:
vscode
.
Uri
):
Thenable
<
void
>
{
return
this
.
_delegate
.
stat
(
resource
).
then
(
stat
=>
{
if
(
stat
.
type
===
DeprecatedFileType
.
Dir
)
{
return
this
.
_delegate
.
rmdir
(
resource
);
}
else
{
return
this
.
_delegate
.
unlink
(
resource
);
}
});
}
createDirectory
(
resource
:
vscode
.
Uri
):
Thenable
<
void
>
{
return
this
.
_delegate
.
mkdir
(
resource
).
then
(
stat
=>
void
0
);
}
// --- read/write
readFile
(
resource
:
vscode
.
Uri
):
Thenable
<
Uint8Array
>
{
let
chunks
:
Buffer
[]
=
[];
return
this
.
_delegate
.
read
(
resource
,
0
,
-
1
,
{
report
(
data
)
{
chunks
.
push
(
Buffer
.
from
(
data
));
}
}).
then
(()
=>
{
return
Buffer
.
concat
(
chunks
);
});
}
writeFile
(
resource
:
vscode
.
Uri
,
content
:
Uint8Array
,
options
:
files
.
FileWriteOptions
):
Thenable
<
void
>
{
return
this
.
_delegate
.
write
(
resource
,
content
);
}
}
export
class
ExtHostFileSystem
implements
ExtHostFileSystemShape
{
private
readonly
_proxy
:
MainThreadFileSystemShape
;
...
...
@@ -185,10 +83,6 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
extHostLanguageFeatures
.
registerDocumentLinkProvider
(
'
*
'
,
this
.
_linkProvider
);
}
registerDeprecatedFileSystemProvider
(
scheme
:
string
,
provider
:
vscode
.
DeprecatedFileSystemProvider
)
{
return
this
.
registerFileSystemProvider
(
scheme
,
new
FileSystemProviderShim
(
provider
));
}
registerFileSystemProvider
(
scheme
:
string
,
provider
:
vscode
.
FileSystemProvider
,
options
:
{
isCaseSensitive
?:
boolean
}
=
{})
{
if
(
this
.
_usedSchemes
.
has
(
scheme
))
{
...
...
@@ -252,15 +146,15 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
}
$stat
(
handle
:
number
,
resource
:
UriComponents
):
TPromise
<
files
.
IStat
,
any
>
{
return
asWinJsPromise
(
token
=>
this
.
_fsProvider
.
get
(
handle
).
stat
(
URI
.
revive
(
resource
))).
then
(
ExtHostFileSystem
.
_asIStat
);
return
asWinJsPromise
(
()
=>
this
.
_fsProvider
.
get
(
handle
).
stat
(
URI
.
revive
(
resource
))).
then
(
ExtHostFileSystem
.
_asIStat
);
}
$readdir
(
handle
:
number
,
resource
:
UriComponents
):
TPromise
<
[
string
,
files
.
FileType
][],
any
>
{
return
asWinJsPromise
(
token
=>
this
.
_fsProvider
.
get
(
handle
).
readDirectory
(
URI
.
revive
(
resource
)));
return
asWinJsPromise
(
()
=>
this
.
_fsProvider
.
get
(
handle
).
readDirectory
(
URI
.
revive
(
resource
)));
}
$readFile
(
handle
:
number
,
resource
:
UriComponents
):
TPromise
<
string
>
{
return
asWinJsPromise
(
token
=>
{
return
asWinJsPromise
(
()
=>
{
return
this
.
_fsProvider
.
get
(
handle
).
readFile
(
URI
.
revive
(
resource
));
}).
then
(
data
=>
{
return
Buffer
.
isBuffer
(
data
)
?
data
.
toString
(
'
base64
'
)
:
Buffer
.
from
(
data
.
buffer
,
data
.
byteOffset
,
data
.
byteLength
).
toString
(
'
base64
'
);
...
...
@@ -268,33 +162,33 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
}
$writeFile
(
handle
:
number
,
resource
:
UriComponents
,
base64Content
:
string
,
opts
:
files
.
FileWriteOptions
):
TPromise
<
void
,
any
>
{
return
asWinJsPromise
(
token
=>
this
.
_fsProvider
.
get
(
handle
).
writeFile
(
URI
.
revive
(
resource
),
Buffer
.
from
(
base64Content
,
'
base64
'
),
opts
));
return
asWinJsPromise
(
()
=>
this
.
_fsProvider
.
get
(
handle
).
writeFile
(
URI
.
revive
(
resource
),
Buffer
.
from
(
base64Content
,
'
base64
'
),
opts
));
}
$delete
(
handle
:
number
,
resource
:
UriComponents
):
TPromise
<
void
,
any
>
{
return
asWinJsPromise
(
token
=>
this
.
_fsProvider
.
get
(
handle
).
delete
(
URI
.
revive
(
resource
),
{
recursive
:
true
}));
return
asWinJsPromise
(
()
=>
this
.
_fsProvider
.
get
(
handle
).
delete
(
URI
.
revive
(
resource
),
{
recursive
:
true
}));
}
$rename
(
handle
:
number
,
oldUri
:
UriComponents
,
newUri
:
UriComponents
,
opts
:
files
.
FileOverwriteOptions
):
TPromise
<
void
,
any
>
{
return
asWinJsPromise
(
token
=>
this
.
_fsProvider
.
get
(
handle
).
rename
(
URI
.
revive
(
oldUri
),
URI
.
revive
(
newUri
),
opts
));
return
asWinJsPromise
(
()
=>
this
.
_fsProvider
.
get
(
handle
).
rename
(
URI
.
revive
(
oldUri
),
URI
.
revive
(
newUri
),
opts
));
}
$copy
(
handle
:
number
,
oldUri
:
UriComponents
,
newUri
:
UriComponents
,
opts
:
files
.
FileOverwriteOptions
):
TPromise
<
void
,
any
>
{
return
asWinJsPromise
(
token
=>
this
.
_fsProvider
.
get
(
handle
).
copy
(
URI
.
revive
(
oldUri
),
URI
.
revive
(
newUri
),
opts
));
return
asWinJsPromise
(
()
=>
this
.
_fsProvider
.
get
(
handle
).
copy
(
URI
.
revive
(
oldUri
),
URI
.
revive
(
newUri
),
opts
));
}
$mkdir
(
handle
:
number
,
resource
:
UriComponents
):
TPromise
<
void
,
any
>
{
return
asWinJsPromise
(
token
=>
this
.
_fsProvider
.
get
(
handle
).
createDirectory
(
URI
.
revive
(
resource
)));
return
asWinJsPromise
(
()
=>
this
.
_fsProvider
.
get
(
handle
).
createDirectory
(
URI
.
revive
(
resource
)));
}
$watch
(
handle
:
number
,
session
:
number
,
resource
:
UriComponents
,
opts
:
files
.
IWatchOptions
):
void
{
asWinJsPromise
(
token
=>
{
asWinJsPromise
(
()
=>
{
let
subscription
=
this
.
_fsProvider
.
get
(
handle
).
watch
(
URI
.
revive
(
resource
),
opts
);
this
.
_watches
.
set
(
session
,
subscription
);
});
}
$unwatch
(
handle
:
number
,
session
:
number
):
void
{
$unwatch
(
session
:
number
):
void
{
let
subscription
=
this
.
_watches
.
get
(
session
);
if
(
subscription
)
{
subscription
.
dispose
();
...
...
src/vs/workbench/api/node/extHostTypes.ts
浏览文件 @
88ba6f80
...
...
@@ -1845,12 +1845,6 @@ export enum LogLevel {
}
//#region file api
// todo@remote
export
enum
DeprecatedFileChangeType
{
Updated
=
0
,
Added
=
1
,
Deleted
=
2
}
export
enum
FileChangeType
{
Changed
=
1
,
...
...
@@ -1858,12 +1852,6 @@ export enum FileChangeType {
Deleted
=
3
,
}
export
enum
DeprecatedFileType
{
File
=
0
,
Dir
=
1
,
Symlink
=
2
}
export
class
FileSystemError
extends
Error
{
static
FileExists
(
messageOrUri
?:
string
|
URI
):
FileSystemError
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录