Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
53fe1660
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,发现更多精彩内容 >>
提交
53fe1660
编写于
7月 20, 2019
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move download command to extension host
上级
8295e325
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
68 addition
and
8 deletion
+68
-8
src/vs/workbench/api/browser/extensionHost.contribution.ts
src/vs/workbench/api/browser/extensionHost.contribution.ts
+1
-0
src/vs/workbench/api/browser/mainThreadDownloadService.ts
src/vs/workbench/api/browser/mainThreadDownloadService.ts
+26
-0
src/vs/workbench/api/browser/mainThreadTreeViews.ts
src/vs/workbench/api/browser/mainThreadTreeViews.ts
+1
-1
src/vs/workbench/api/common/apiCommands.ts
src/vs/workbench/api/common/apiCommands.ts
+1
-7
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+9
-0
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+2
-0
src/vs/workbench/api/node/extHostDownloadService.ts
src/vs/workbench/api/node/extHostDownloadService.ts
+28
-0
未找到文件。
src/vs/workbench/api/browser/extensionHost.contribution.ts
浏览文件 @
53fe1660
...
...
@@ -48,6 +48,7 @@ import './mainThreadStorage';
import
'
./mainThreadTelemetry
'
;
import
'
./mainThreadTerminalService
'
;
import
'
./mainThreadTreeViews
'
;
import
'
./mainThreadDownloadService
'
;
import
'
./mainThreadUrls
'
;
import
'
./mainThreadWindow
'
;
import
'
./mainThreadWebview
'
;
...
...
src/vs/workbench/api/browser/mainThreadDownloadService.ts
0 → 100644
浏览文件 @
53fe1660
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
MainContext
,
IExtHostContext
,
MainThreadDownloadServiceShape
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/common/extHostCustomers
'
;
import
{
IDownloadService
}
from
'
vs/platform/download/common/download
'
;
import
{
UriComponents
,
URI
}
from
'
vs/base/common/uri
'
;
@
extHostNamedCustomer
(
MainContext
.
MainThreadDownloadService
)
export
class
MainThreadDownloadService
extends
Disposable
implements
MainThreadDownloadServiceShape
{
constructor
(
extHostContext
:
IExtHostContext
,
@
IDownloadService
private
readonly
downloadService
:
IDownloadService
)
{
super
();
}
$download
(
uri
:
UriComponents
,
to
:
UriComponents
):
Promise
<
void
>
{
return
this
.
downloadService
.
download
(
URI
.
revive
(
uri
),
URI
.
revive
(
to
));
}
}
\ No newline at end of file
src/vs/workbench/api/browser/mainThreadTreeViews.ts
浏览文件 @
53fe1660
...
...
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
ExtHostContext
,
MainThreadTreeViewsShape
,
ExtHostTreeViewsShape
,
MainContext
,
IExtHostContext
}
from
'
..
/common/extHost.protocol
'
;
import
{
ExtHostContext
,
MainThreadTreeViewsShape
,
ExtHostTreeViewsShape
,
MainContext
,
IExtHostContext
}
from
'
vs/workbench/api
/common/extHost.protocol
'
;
import
{
ITreeViewDataProvider
,
ITreeItem
,
IViewsService
,
ITreeView
,
IViewsRegistry
,
ITreeViewDescriptor
,
IRevealOptions
,
Extensions
}
from
'
vs/workbench/common/views
'
;
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/common/extHostCustomers
'
;
import
{
distinct
}
from
'
vs/base/common/arrays
'
;
...
...
src/vs/workbench/api/common/apiCommands.ts
浏览文件 @
53fe1660
...
...
@@ -12,7 +12,6 @@ import { EditorViewColumn } from 'vs/workbench/api/common/shared/editor';
import
{
EditorGroupLayout
}
from
'
vs/workbench/services/editor/common/editorGroupsService
'
;
import
{
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IOpenSettings
,
IURIToOpen
,
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IDownloadService
}
from
'
vs/platform/download/common/download
'
;
import
{
IWorkspacesService
,
hasWorkspaceFileExtension
}
from
'
vs/platform/workspaces/common/workspaces
'
;
import
{
IRecent
}
from
'
vs/platform/history/common/history
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
...
...
@@ -206,9 +205,4 @@ CommandsRegistry.registerCommand({
}
}]
}
});
CommandsRegistry
.
registerCommand
(
'
_workbench.downloadResource
'
,
function
(
accessor
:
ServicesAccessor
,
resource
:
URI
)
{
const
downloadService
=
accessor
.
get
(
IDownloadService
);
return
downloadService
.
download
(
resource
).
then
(
location
=>
URI
.
file
(
location
));
});
});
\ No newline at end of file
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
53fe1660
...
...
@@ -246,6 +246,10 @@ export interface MainThreadTreeViewsShape extends IDisposable {
$setMessage
(
treeViewId
:
string
,
message
:
string
|
IMarkdownString
):
void
;
}
export
interface
MainThreadDownloadServiceShape
extends
IDisposable
{
$download
(
uri
:
UriComponents
,
to
:
UriComponents
):
Promise
<
void
>
;
}
export
interface
MainThreadErrorsShape
extends
IDisposable
{
$onUnexpectedError
(
err
:
any
|
SerializedError
):
void
;
}
...
...
@@ -811,6 +815,9 @@ export interface ExtHostTreeViewsShape {
$setVisible
(
treeViewId
:
string
,
visible
:
boolean
):
void
;
}
export
interface
ExtHostDownloadServiceShape
{
}
export
interface
ExtHostWorkspaceShape
{
$initializeWorkspace
(
workspace
:
IWorkspaceData
|
null
):
void
;
$acceptWorkspaceData
(
workspace
:
IWorkspaceData
|
null
):
void
;
...
...
@@ -1309,6 +1316,7 @@ export const MainContext = {
MainThreadEditorInsets
:
createMainId
<
MainThreadEditorInsetsShape
>
(
'
MainThreadEditorInsets
'
),
MainThreadErrors
:
createMainId
<
MainThreadErrorsShape
>
(
'
MainThreadErrors
'
),
MainThreadTreeViews
:
createMainId
<
MainThreadTreeViewsShape
>
(
'
MainThreadTreeViews
'
),
MainThreadDownloadService
:
createMainId
<
MainThreadDownloadServiceShape
>
(
'
MainThreadDownloadService
'
),
MainThreadKeytar
:
createMainId
<
MainThreadKeytarShape
>
(
'
MainThreadKeytar
'
),
MainThreadLanguageFeatures
:
createMainId
<
MainThreadLanguageFeaturesShape
>
(
'
MainThreadLanguageFeatures
'
),
MainThreadLanguages
:
createMainId
<
MainThreadLanguagesShape
>
(
'
MainThreadLanguages
'
),
...
...
@@ -1344,6 +1352,7 @@ export const ExtHostContext = {
ExtHostDocumentSaveParticipant
:
createExtId
<
ExtHostDocumentSaveParticipantShape
>
(
'
ExtHostDocumentSaveParticipant
'
),
ExtHostEditors
:
createExtId
<
ExtHostEditorsShape
>
(
'
ExtHostEditors
'
),
ExtHostTreeViews
:
createExtId
<
ExtHostTreeViewsShape
>
(
'
ExtHostTreeViews
'
),
ExtHostDownloadService
:
createExtId
<
ExtHostDownloadServiceShape
>
(
'
ExtHostDownloadService
'
),
ExtHostFileSystem
:
createExtId
<
ExtHostFileSystemShape
>
(
'
ExtHostFileSystem
'
),
ExtHostFileSystemEventService
:
createExtId
<
ExtHostFileSystemEventServiceShape
>
(
'
ExtHostFileSystemEventService
'
),
ExtHostLanguageFeatures
:
createExtId
<
ExtHostLanguageFeaturesShape
>
(
'
ExtHostLanguageFeatures
'
),
...
...
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
53fe1660
...
...
@@ -49,6 +49,7 @@ import { ExtHostTask } from 'vs/workbench/api/node/extHostTask';
import
{
ExtHostTerminalService
}
from
'
vs/workbench/api/node/extHostTerminalService
'
;
import
{
ExtHostEditors
}
from
'
vs/workbench/api/common/extHostTextEditors
'
;
import
{
ExtHostTreeViews
}
from
'
vs/workbench/api/common/extHostTreeViews
'
;
import
{
ExtHostDownloadService
}
from
'
vs/workbench/api/node/extHostDownloadService
'
;
import
*
as
typeConverters
from
'
vs/workbench/api/common/extHostTypeConverters
'
;
import
*
as
extHostTypes
from
'
vs/workbench/api/common/extHostTypes
'
;
import
{
ExtHostUrls
}
from
'
vs/workbench/api/common/extHostUrls
'
;
...
...
@@ -114,6 +115,7 @@ export function createApiFactory(
const
extHostEditors
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostEditors
,
new
ExtHostEditors
(
rpcProtocol
,
extHostDocumentsAndEditors
));
const
extHostCommands
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostCommands
,
new
ExtHostCommands
(
rpcProtocol
,
extHostLogService
));
const
extHostTreeViews
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostTreeViews
,
new
ExtHostTreeViews
(
rpcProtocol
.
getProxy
(
MainContext
.
MainThreadTreeViews
),
extHostCommands
,
extHostLogService
));
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostDownloadService
,
new
ExtHostDownloadService
(
rpcProtocol
.
getProxy
(
MainContext
.
MainThreadDownloadService
),
extHostCommands
));
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostWorkspace
,
extHostWorkspace
);
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostConfiguration
,
extHostConfiguration
);
const
extHostEditorInsets
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostEditorInsets
,
new
ExtHostEditorInsets
(
rpcProtocol
.
getProxy
(
MainContext
.
MainThreadEditorInsets
),
extHostEditors
,
initData
.
environment
));
...
...
src/vs/workbench/api/node/extHostDownloadService.ts
0 → 100644
浏览文件 @
53fe1660
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
join
}
from
'
vs/base/common/path
'
;
import
{
tmpdir
}
from
'
os
'
;
import
{
generateUuid
}
from
'
vs/base/common/uuid
'
;
import
{
ExtHostCommands
}
from
'
vs/workbench/api/common/extHostCommands
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
MainThreadDownloadServiceShape
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
export
class
ExtHostDownloadService
extends
Disposable
{
constructor
(
proxy
:
MainThreadDownloadServiceShape
,
commands
:
ExtHostCommands
)
{
super
();
commands
.
registerCommand
(
false
,
'
_workbench.downloadResource
'
,
async
(
resource
:
URI
):
Promise
<
any
>
=>
{
const
location
=
URI
.
file
(
join
(
tmpdir
(),
generateUuid
()));
await
proxy
.
$download
(
resource
,
location
);
return
location
;
});
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录