Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
d6b38359
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,体验更适合开发者的 AI 搜索 >>
提交
d6b38359
编写于
4月 20, 2018
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
proposed open url api
上级
cf44fd64
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
192 addition
and
1 deletion
+192
-1
build/lib/i18n.resources.json
build/lib/i18n.resources.json
+5
-1
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+16
-0
src/vs/workbench/api/electron-browser/extensionHost.contribution.ts
...kbench/api/electron-browser/extensionHost.contribution.ts
+1
-0
src/vs/workbench/api/electron-browser/mainThreadUrls.ts
src/vs/workbench/api/electron-browser/mainThreadUrls.ts
+68
-0
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+5
-0
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+11
-0
src/vs/workbench/api/node/extHostUrls.ts
src/vs/workbench/api/node/extHostUrls.ts
+46
-0
src/vs/workbench/parts/url/electron-browser/url.contribution.ts
.../workbench/parts/url/electron-browser/url.contribution.ts
+39
-0
src/vs/workbench/workbench.main.ts
src/vs/workbench/workbench.main.ts
+1
-0
未找到文件。
build/lib/i18n.resources.json
浏览文件 @
d6b38359
...
...
@@ -130,6 +130,10 @@
"name"
:
"vs/workbench/parts/update"
,
"project"
:
"vscode-workbench"
},
{
"name"
:
"vs/workbench/parts/url"
,
"project"
:
"vscode-workbench"
},
{
"name"
:
"vs/workbench/parts/watermark"
,
"project"
:
"vscode-workbench"
...
...
@@ -215,4 +219,4 @@
"project"
:
"vscode-preferences"
}
]
}
}
\ No newline at end of file
src/vs/vscode.proposed.d.ts
浏览文件 @
d6b38359
...
...
@@ -657,4 +657,20 @@ declare module 'vscode' {
}
//#endregion
//#region URLs
export
interface
UrlHandler
{
handleUrl
(
uri
:
Uri
):
void
;
}
export
namespace
window
{
/**
* Registers a URL handler.
*/
export
function
registerUrlHandler
(
handler
:
UrlHandler
):
Disposable
;
}
//#endregion
}
src/vs/workbench/api/electron-browser/extensionHost.contribution.ts
浏览文件 @
d6b38359
...
...
@@ -49,6 +49,7 @@ import './mainThreadTerminalService';
import
'
./mainThreadTreeViews
'
;
import
'
./mainThreadLogService
'
;
import
'
./mainThreadWebview
'
;
import
'
./mainThreadUrls
'
;
import
'
./mainThreadWindow
'
;
import
'
./mainThreadWorkspace
'
;
...
...
src/vs/workbench/api/electron-browser/mainThreadUrls.ts
0 → 100644
浏览文件 @
d6b38359
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
ExtHostContext
,
IExtHostContext
,
MainContext
,
MainThreadUrlsShape
,
ExtHostUrlsShape
}
from
'
vs/workbench/api/node/extHost.protocol
'
;
import
{
extHostNamedCustomer
}
from
'
./extHostCustomers
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
IURLService
,
IURLHandler
}
from
'
vs/platform/url/common/url
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
class
ExtensionUrlHandler
implements
IURLHandler
{
constructor
(
private
readonly
proxy
:
ExtHostUrlsShape
,
private
readonly
handle
:
number
,
private
readonly
extensionId
:
string
)
{
}
handleURL
(
uri
:
URI
):
TPromise
<
boolean
>
{
if
(
uri
.
authority
!==
this
.
extensionId
)
{
return
TPromise
.
as
(
false
);
}
return
this
.
proxy
.
$handleUrl
(
this
.
handle
,
uri
).
then
(()
=>
true
);
}
}
@
extHostNamedCustomer
(
MainContext
.
MainThreadUrls
)
export
class
MainThreadUrls
implements
MainThreadUrlsShape
{
private
readonly
proxy
:
ExtHostUrlsShape
;
private
handlers
=
new
Map
<
number
,
IDisposable
>
();
constructor
(
context
:
IExtHostContext
,
@
IURLService
private
urlService
:
IURLService
)
{
this
.
proxy
=
context
.
getProxy
(
ExtHostContext
.
ExtHostUrls
);
}
$registerUrlHandler
(
handle
:
number
,
extensionId
:
string
):
TPromise
<
void
>
{
const
handler
=
new
ExtensionUrlHandler
(
this
.
proxy
,
handle
,
extensionId
);
const
disposable
=
this
.
urlService
.
registerHandler
(
handler
);
this
.
handlers
.
set
(
handle
,
disposable
);
return
TPromise
.
as
(
null
);
}
$unregisterUrlHandler
(
handle
:
number
):
TPromise
<
void
>
{
const
disposable
=
this
.
handlers
.
get
(
handle
);
if
(
!
disposable
)
{
return
TPromise
.
as
(
null
);
}
disposable
.
dispose
();
this
.
handlers
.
delete
(
handle
);
return
TPromise
.
as
(
null
);
}
dispose
():
void
{
}
}
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
d6b38359
...
...
@@ -58,6 +58,7 @@ import { OverviewRulerLane } from 'vs/editor/common/model';
import
{
ExtHostLogService
}
from
'
vs/workbench/api/node/extHostLogService
'
;
import
{
ExtHostWebviews
}
from
'
vs/workbench/api/node/extHostWebview
'
;
import
{
ExtHostSearch
}
from
'
./extHostSearch
'
;
import
{
ExtHostUrls
}
from
'
./extHostUrls
'
;
export
interface
IExtensionApiFactory
{
(
extension
:
IExtensionDescription
):
typeof
vscode
;
...
...
@@ -98,6 +99,7 @@ export function createApiFactory(
const
extHostHeapService
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostHeapService
,
new
ExtHostHeapService
());
const
extHostDecorations
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostDecorations
,
new
ExtHostDecorations
(
rpcProtocol
));
const
extHostWebviews
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostWebviews
,
new
ExtHostWebviews
(
rpcProtocol
));
const
extHostUrls
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostUrls
,
new
ExtHostUrls
(
rpcProtocol
));
const
extHostDocumentsAndEditors
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostDocumentsAndEditors
,
new
ExtHostDocumentsAndEditors
(
rpcProtocol
));
const
extHostDocuments
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostDocuments
,
new
ExtHostDocuments
(
rpcProtocol
,
extHostDocumentsAndEditors
));
const
extHostDocumentContentProviders
=
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostDocumentContentProviders
,
new
ExtHostDocumentContentProvider
(
rpcProtocol
,
extHostDocumentsAndEditors
,
extHostLogService
));
...
...
@@ -431,6 +433,9 @@ export function createApiFactory(
}),
registerWebviewPanelSerializer
:
proposedApiFunction
(
extension
,
(
viewType
:
string
,
serializer
:
vscode
.
WebviewPanelSerializer
)
=>
{
return
extHostWebviews
.
registerWebviewPanelSerializer
(
viewType
,
serializer
);
}),
registerUrlHandler
:
proposedApiFunction
(
extension
,
(
handler
:
vscode
.
UrlHandler
)
=>
{
return
extHostUrls
.
registerUrlHandler
(
extension
.
id
,
handler
);
})
};
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
d6b38359
...
...
@@ -372,6 +372,15 @@ export interface ExtHostWebviewsShape {
$serializeWebviewPanel
(
webviewHandle
:
WebviewPanelHandle
):
Thenable
<
any
>
;
}
export
interface
MainThreadUrlsShape
extends
IDisposable
{
$registerUrlHandler
(
handle
:
number
,
extensionId
:
string
):
TPromise
<
void
>
;
$unregisterUrlHandler
(
handle
:
number
):
TPromise
<
void
>
;
}
export
interface
ExtHostUrlsShape
{
$handleUrl
(
handle
:
number
,
uri
:
UriComponents
):
TPromise
<
void
>
;
}
export
interface
MainThreadWorkspaceShape
extends
IDisposable
{
$startSearch
(
includePattern
:
string
,
includeFolder
:
string
,
excludePatternOrDisregardExcludes
:
string
|
false
,
maxResults
:
number
,
requestId
:
number
):
Thenable
<
UriComponents
[]
>
;
$cancelSearch
(
requestId
:
number
):
Thenable
<
boolean
>
;
...
...
@@ -873,6 +882,7 @@ export const MainContext = {
MainThreadTelemetry
:
createMainId
<
MainThreadTelemetryShape
>
(
'
MainThreadTelemetry
'
),
MainThreadTerminalService
:
createMainId
<
MainThreadTerminalServiceShape
>
(
'
MainThreadTerminalService
'
),
MainThreadWebviews
:
createMainId
<
MainThreadWebviewsShape
>
(
'
MainThreadWebviews
'
),
MainThreadUrls
:
createMainId
<
MainThreadUrlsShape
>
(
'
MainThreadUrls
'
),
MainThreadWorkspace
:
createMainId
<
MainThreadWorkspaceShape
>
(
'
MainThreadWorkspace
'
),
MainThreadFileSystem
:
createMainId
<
MainThreadFileSystemShape
>
(
'
MainThreadFileSystem
'
),
MainThreadExtensionService
:
createMainId
<
MainThreadExtensionServiceShape
>
(
'
MainThreadExtensionService
'
),
...
...
@@ -908,5 +918,6 @@ export const ExtHostContext = {
ExtHostWorkspace
:
createExtId
<
ExtHostWorkspaceShape
>
(
'
ExtHostWorkspace
'
),
ExtHostWindow
:
createExtId
<
ExtHostWindowShape
>
(
'
ExtHostWindow
'
),
ExtHostWebviews
:
createExtId
<
ExtHostWebviewsShape
>
(
'
ExtHostWebviews
'
),
ExtHostUrls
:
createExtId
<
ExtHostUrlsShape
>
(
'
ExtHostUrls
'
),
ExtHostProgress
:
createMainId
<
ExtHostProgressShape
>
(
'
ExtHostProgress
'
)
};
src/vs/workbench/api/node/extHostUrls.ts
0 → 100644
浏览文件 @
d6b38359
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
*
as
vscode
from
'
vscode
'
;
import
{
MainContext
,
IMainContext
,
ExtHostUrlsShape
,
MainThreadUrlsShape
}
from
'
./extHost.protocol
'
;
import
URI
,
{
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
export
class
ExtHostUrls
implements
ExtHostUrlsShape
{
private
static
HandlePool
=
0
;
private
readonly
_proxy
:
MainThreadUrlsShape
;
private
handlers
=
new
Map
<
number
,
vscode
.
UrlHandler
>
();
constructor
(
mainContext
:
IMainContext
)
{
this
.
_proxy
=
mainContext
.
getProxy
(
MainContext
.
MainThreadUrls
);
}
registerUrlHandler
(
extensionId
:
string
,
handler
:
vscode
.
UrlHandler
):
vscode
.
Disposable
{
const
handle
=
ExtHostUrls
.
HandlePool
++
;
this
.
handlers
.
set
(
handle
,
handler
);
this
.
_proxy
.
$registerUrlHandler
(
handle
,
extensionId
);
return
toDisposable
(()
=>
{
this
.
handlers
.
delete
(
handle
);
this
.
_proxy
.
$unregisterUrlHandler
(
handle
);
});
}
$handleUrl
(
handle
:
number
,
uri
:
UriComponents
):
TPromise
<
void
>
{
const
handler
=
this
.
handlers
.
get
(
handle
);
if
(
!
handler
)
{
return
TPromise
.
as
(
null
);
}
handler
.
handleUrl
(
URI
.
revive
(
uri
));
return
TPromise
.
as
(
null
);
}
}
\ No newline at end of file
src/vs/workbench/parts/url/electron-browser/url.contribution.ts
0 → 100644
浏览文件 @
d6b38359
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
localize
}
from
'
vs/nls
'
;
import
{
SyncActionDescriptor
}
from
'
vs/platform/actions/common/actions
'
;
import
{
Registry
}
from
'
vs/platform/registry/common/platform
'
;
import
{
Extensions
as
ActionExtensions
,
IWorkbenchActionRegistry
}
from
'
vs/workbench/common/actions
'
;
import
{
IURLService
}
from
'
vs/platform/url/common/url
'
;
import
{
IQuickOpenService
}
from
'
vs/platform/quickOpen/common/quickOpen
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
export
class
OpenUrlAction
extends
Action
{
static
readonly
ID
=
'
workbench.action.url.openUrl
'
;
static
readonly
LABEL
=
localize
(
'
openUrl
'
,
"
Open URL
"
);
constructor
(
id
:
string
,
label
:
string
,
@
IURLService
private
urlService
:
IURLService
,
@
IQuickOpenService
private
quickOpenService
:
IQuickOpenService
,
)
{
super
(
id
,
label
);
}
async
run
():
TPromise
<
any
>
{
const
input
=
await
this
.
quickOpenService
.
input
({
prompt
:
'
URL to open
'
});
const
uri
=
URI
.
parse
(
input
);
this
.
urlService
.
open
(
uri
);
}
}
Registry
.
as
<
IWorkbenchActionRegistry
>
(
ActionExtensions
.
WorkbenchActions
)
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
OpenUrlAction
,
OpenUrlAction
.
ID
,
OpenUrlAction
.
LABEL
),
'
OpenUrl
'
,
localize
(
'
developer
'
,
"
Developer
"
));
\ No newline at end of file
src/vs/workbench/workbench.main.ts
浏览文件 @
d6b38359
...
...
@@ -68,6 +68,7 @@ import 'vs/workbench/parts/markers/electron-browser/markers.contribution';
import
'
vs/workbench/parts/html/electron-browser/html.contribution
'
;
import
'
vs/workbench/parts/url/electron-browser/url.contribution
'
;
import
'
vs/workbench/parts/webview/electron-browser/webview.contribution
'
;
import
'
vs/workbench/parts/welcome/walkThrough/electron-browser/walkThrough.contribution
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录