Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
022325bf
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,发现更多精彩内容 >>
提交
022325bf
编写于
9月 12, 2017
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
much more, del, streaming, etc
上级
e9ac57ee
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
57 addition
and
43 deletion
+57
-43
src/vs/workbench/api/electron-browser/mainThreadWorkspace.ts
src/vs/workbench/api/electron-browser/mainThreadWorkspace.ts
+12
-12
src/vs/workbench/services/files/electron-browser/ftpFileSystemProvider.ts
.../services/files/electron-browser/ftpFileSystemProvider.ts
+17
-17
src/vs/workbench/services/files/electron-browser/remoteFileService.ts
...ench/services/files/electron-browser/remoteFileService.ts
+28
-14
未找到文件。
src/vs/workbench/api/electron-browser/mainThreadWorkspace.ts
浏览文件 @
022325bf
...
...
@@ -133,17 +133,17 @@ export class MainThreadWorkspace implements MainThreadWorkspaceShape {
throw
new
Error
();
}
const
emitter
=
new
Emitter
<
URI
>
();
const
provider
=
{
onDidChange
:
emitter
.
event
,
read
:
(
resource
:
URI
)
=>
{
return
this
.
_proxy
.
$resolveFile
(
handle
,
resource
);
},
write
:
(
resource
:
URI
,
value
:
string
)
=>
{
return
this
.
_proxy
.
$storeFile
(
handle
,
resource
,
value
);
},
stat
:
()
=>
null
,
readdir
:
()
=>
null
};
//
const provider = {
//
onDidChange: emitter.event,
//
read: (resource: URI) => {
//
return this._proxy.$resolveFile(handle, resource);
//
},
//
write: (resource: URI, value: string) => {
//
return this._proxy.$storeFile(handle, resource, value);
//
},
//
stat: () => null,
//
readdir: () => null
//
};
const
searchProvider
=
{
search
:
(
query
:
ISearchQuery
)
=>
{
if
(
query
.
type
!==
QueryType
.
File
)
{
...
...
@@ -159,7 +159,7 @@ export class MainThreadWorkspace implements MainThreadWorkspaceShape {
}
};
const
registrations
=
combinedDisposable
([
this
.
_fileService
.
registerProvider
(
authority
,
provider
),
//
this._fileService.registerProvider(authority, provider),
this
.
_searchService
.
registerSearchResultProvider
(
searchProvider
),
]);
this
.
_provider
.
set
(
handle
,
[
registrations
,
emitter
]);
...
...
src/vs/workbench/services/files/electron-browser/ftpFileSystemProvider.ts
浏览文件 @
022325bf
...
...
@@ -13,9 +13,10 @@ import { ninvoke } from 'vs/base/common/async';
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Readable
}
from
'
stream
'
;
import
{
join
}
from
'
path
'
;
import
{
IStat
}
from
'
vs/workbench/services/files/electron-browser/remoteFileService
'
;
import
{
IStat
,
IRemoteFileSystemProvider
}
from
'
vs/workbench/services/files/electron-browser/remoteFileService
'
;
import
{
IProgress
}
from
'
vs/platform/progress/common/progress
'
;
export
class
FtpFileSystemProvider
{
export
class
FtpFileSystemProvider
implements
IRemoteFileSystemProvider
{
private
_connection
:
JSFtp
;
...
...
@@ -23,9 +24,7 @@ export class FtpFileSystemProvider {
constructor
()
{
this
.
_connection
=
new
JSFtp
({
host
:
'
waws-prod-db3-029.ftp.azurewebsites.windows.net
'
,
user
:
'
performanto-slack-updater
\\
riejo-test
'
,
pass
:
'
Z0llikon
'
host
:
'
waws-prod-db3-029.ftp.azurewebsites.windows.net
'
});
this
.
_connection
.
keepAlive
(
1000
*
5
);
}
...
...
@@ -69,26 +68,27 @@ export class FtpFileSystemProvider {
});
}
write
(
resource
:
URI
,
content
:
string
):
TPromise
<
void
>
{
return
ninvoke
(
this
.
_connection
,
this
.
_connection
.
put
,
Buffer
.
from
(
content
,
'
utf8
'
),
resource
.
path
);
}
read
(
resource
:
URI
):
TPromise
<
string
>
{
read
(
resource
:
URI
,
progress
:
IProgress
<
Uint8Array
>
):
TPromise
<
void
>
{
return
ninvoke
<
Readable
>
(
this
.
_connection
,
this
.
_connection
.
get
,
resource
.
path
).
then
(
stream
=>
{
return
new
TPromise
<
string
>
((
resolve
,
reject
)
=>
{
let
str
=
''
;
stream
.
on
(
'
data
'
,
function
(
d
)
{
str
+=
d
.
toString
();
});
stream
.
on
(
'
close
'
,
function
(
hadErr
)
{
return
new
TPromise
<
void
>
((
resolve
,
reject
)
=>
{
stream
.
on
(
'
data
'
,
d
=>
progress
.
report
(
<
any
>
d
));
stream
.
on
(
'
close
'
,
hadErr
=>
{
if
(
hadErr
)
{
reject
(
hadErr
);
}
else
{
resolve
(
str
);
resolve
(
undefined
);
}
});
stream
.
resume
();
});
});
}
write
(
resource
:
URI
,
content
:
string
):
TPromise
<
void
>
{
return
ninvoke
(
this
.
_connection
,
this
.
_connection
.
put
,
Buffer
.
from
(
content
,
'
utf8
'
),
resource
.
path
);
}
del
(
resource
:
URI
):
TPromise
<
void
>
{
return
ninvoke
(
this
.
_connection
,
this
.
_connection
.
raw
,
'
DELE
'
,
[
resource
.
path
]);
}
}
src/vs/workbench/services/files/electron-browser/remoteFileService.ts
浏览文件 @
022325bf
...
...
@@ -24,6 +24,7 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
import
{
groupBy
,
isFalsyOrEmpty
}
from
'
vs/base/common/arrays
'
;
import
{
compare
}
from
'
vs/base/common/strings
'
;
import
{
ITextResourceConfigurationService
}
from
'
vs/editor/common/services/resourceConfiguration
'
;
import
{
IProgress
,
Progress
}
from
'
vs/platform/progress/common/progress
'
;
export
interface
IStat
{
...
...
@@ -41,7 +42,7 @@ function toIFileStat(provider: IRemoteFileSystemProvider, stat: IStat, recurse:
name
:
basename
(
stat
.
resource
.
path
),
mtime
:
stat
.
mtime
,
size
:
stat
.
size
,
etag
:
stat
.
mtime
.
toString
(
3
)
+
stat
.
size
.
toString
(
7
),
etag
:
stat
.
mtime
.
toString
(
29
)
+
stat
.
size
.
toString
(
31
),
};
if
(
!
stat
.
isDirectory
)
{
...
...
@@ -72,8 +73,9 @@ export interface IRemoteFileSystemProvider {
onDidChange
?:
Event
<
URI
>
;
stat
(
resource
:
URI
):
TPromise
<
IStat
>
;
readdir
(
resource
:
URI
):
TPromise
<
IStat
[]
>
;
read
(
resource
:
URI
,
progress
:
IProgress
<
Uint8Array
>
):
TPromise
<
void
>
;
write
(
resource
:
URI
,
content
:
string
):
TPromise
<
void
>
;
read
(
resource
:
URI
):
TPromise
<
string
>
;
del
(
resource
:
URI
):
TPromise
<
void
>
;
}
export
class
RemoteFileService
extends
FileService
{
...
...
@@ -99,9 +101,7 @@ export class RemoteFileService extends FileService {
// public rename(resource: URI, newName: string): TPromise<IFileStat, any> {
// throw new Error("Method not implemented.");
// }
// public del(resource: URI, useTrash?: boolean): TPromise<void, any> {
// throw new Error("Method not implemented.");
// }
private
readonly
_provider
=
new
Map
<
string
,
IRemoteFileSystemProvider
>
();
...
...
@@ -212,16 +212,20 @@ export class RemoteFileService extends FileService {
return
super
.
resolveStreamContent
(
resource
,
options
);
}
private
_doResolveContent
(
provider
:
IRemoteFileSystemProvider
,
resource
:
URI
):
TPromise
<
IContent
>
{
private
async
_doResolveContent
(
provider
:
IRemoteFileSystemProvider
,
resource
:
URI
):
TPromise
<
IContent
>
{
return
provider
.
stat
(
resource
).
then
(
stat
=>
{
return
provider
.
read
(
resource
).
then
(
value
=>
{
return
<
any
>
{
...
stat
,
value
,
};
});
});
const
chunks
:
Uint8Array
[]
=
[];
await
provider
.
read
(
resource
,
new
Progress
<
Uint8Array
>
(
chunk
=>
chunks
.
push
(
chunk
)));
const
stat
=
await
toIFileStat
(
provider
,
await
provider
.
stat
(
resource
),
false
);
return
{
value
:
[].
concat
(...
chunks
).
toString
(),
resource
:
stat
.
resource
,
name
:
stat
.
name
,
etag
:
stat
.
etag
,
mtime
:
stat
.
mtime
,
encoding
:
this
.
getEncoding
(
resource
)
};
}
// --- saving
...
...
@@ -252,4 +256,14 @@ export class RemoteFileService extends FileService {
},
0
);
return
result
;
}
// --- delete
del
(
resource
:
URI
,
useTrash
?:
boolean
):
TPromise
<
void
>
{
const
provider
=
this
.
_provider
.
get
(
resource
.
scheme
);
if
(
provider
)
{
return
provider
.
del
(
resource
);
}
return
super
.
del
(
resource
,
useTrash
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录