Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
ba69d8dc
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,发现更多精彩内容 >>
提交
ba69d8dc
编写于
8月 14, 2019
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
open exter - move into opener service
上级
0921202c
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
70 addition
and
21 deletion
+70
-21
src/vs/editor/browser/services/openerService.ts
src/vs/editor/browser/services/openerService.ts
+7
-2
src/vs/platform/opener/common/opener.ts
src/vs/platform/opener/common/opener.ts
+12
-2
src/vs/workbench/api/browser/mainThreadWindow.ts
src/vs/workbench/api/browser/mainThreadWindow.ts
+4
-3
src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.ts
...rkbench/contrib/files/browser/editors/binaryFileEditor.ts
+3
-11
src/vs/workbench/services/opener/electron-browser/openerService.ts
...rkbench/services/opener/electron-browser/openerService.ts
+40
-0
src/vs/workbench/workbench.common.main.ts
src/vs/workbench/workbench.common.main.ts
+0
-3
src/vs/workbench/workbench.desktop.main.ts
src/vs/workbench/workbench.desktop.main.ts
+1
-0
src/vs/workbench/workbench.web.main.ts
src/vs/workbench/workbench.web.main.ts
+3
-0
未找到文件。
src/vs/editor/browser/services/openerService.ts
浏览文件 @
ba69d8dc
...
...
@@ -55,8 +55,7 @@ export class OpenerService implements IOpenerService {
if
(
equalsIgnoreCase
(
scheme
,
Schemas
.
http
)
||
equalsIgnoreCase
(
scheme
,
Schemas
.
https
)
||
equalsIgnoreCase
(
scheme
,
Schemas
.
mailto
))
{
// open http or default mail application
dom
.
windowOpenNoOpener
(
encodeURI
(
resource
.
toString
(
true
)));
return
Promise
.
resolve
(
true
);
return
this
.
openExternal
(
resource
);
}
else
if
(
equalsIgnoreCase
(
scheme
,
Schemas
.
command
))
{
// run command or bail out if command isn't known
...
...
@@ -100,4 +99,10 @@ export class OpenerService implements IOpenerService {
).
then
(()
=>
true
);
}
}
openExternal
(
resource
:
URI
):
Promise
<
boolean
>
{
dom
.
windowOpenNoOpener
(
encodeURI
(
resource
.
toString
(
true
)));
return
Promise
.
resolve
(
true
);
}
}
src/vs/platform/opener/common/opener.ts
浏览文件 @
ba69d8dc
...
...
@@ -9,7 +9,6 @@ import { IDisposable } from 'vs/base/common/lifecycle';
export
const
IOpenerService
=
createDecorator
<
IOpenerService
>
(
'
openerService
'
);
export
interface
IOpener
{
open
(
resource
:
URI
,
options
?:
{
openToSide
?:
boolean
}):
Promise
<
boolean
>
;
}
...
...
@@ -18,6 +17,9 @@ export interface IOpenerService {
_serviceBrand
:
any
;
/**
* Register a participant that can handle the open() call.
*/
registerOpener
(
opener
:
IOpener
):
IDisposable
;
/**
...
...
@@ -27,10 +29,18 @@ export interface IOpenerService {
* @return A promise that resolves when the opening is done.
*/
open
(
resource
:
URI
,
options
?:
{
openToSide
?:
boolean
}):
Promise
<
boolean
>
;
/**
* Opens a URL externally.
*
* @param url A resource to open externally.
*/
openExternal
(
resource
:
URI
):
Promise
<
boolean
>
;
}
export
const
NullOpenerService
:
IOpenerService
=
Object
.
freeze
({
_serviceBrand
:
undefined
,
registerOpener
()
{
return
{
dispose
()
{
}
};
},
open
()
{
return
Promise
.
resolve
(
false
);
}
open
()
{
return
Promise
.
resolve
(
false
);
},
openExternal
()
{
return
Promise
.
resolve
(
false
);
}
});
src/vs/workbench/api/browser/mainThreadWindow.ts
浏览文件 @
ba69d8dc
...
...
@@ -6,12 +6,13 @@
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
DisposableStore
}
from
'
vs/base/common/lifecycle
'
;
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
IWindowService
,
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IWindowService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/common/extHostCustomers
'
;
import
{
ExtHostContext
,
ExtHostWindowShape
,
IExtHostContext
,
MainContext
,
MainThreadWindowShape
,
IOpenUriOptions
}
from
'
../common/extHost.protocol
'
;
import
{
ITunnelService
,
RemoteTunnel
}
from
'
vs/platform/remote/common/tunnel
'
;
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
{
extractLocalHostUriMetaDataForPortMapping
}
from
'
vs/workbench/contrib/webview/common/portMapping
'
;
import
{
IOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
@
extHostNamedCustomer
(
MainContext
.
MainThreadWindow
)
export
class
MainThreadWindow
implements
MainThreadWindowShape
{
...
...
@@ -23,7 +24,7 @@ export class MainThreadWindow implements MainThreadWindowShape {
constructor
(
extHostContext
:
IExtHostContext
,
@
IWindowService
private
readonly
windowService
:
IWindowService
,
@
I
WindowsService
private
readonly
windowsService
:
IWindows
Service
,
@
I
OpenerService
private
readonly
openerService
:
IOpener
Service
,
@
ITunnelService
private
readonly
tunnelService
:
ITunnelService
,
@
IWorkbenchEnvironmentService
private
readonly
environmentService
:
IWorkbenchEnvironmentService
)
{
...
...
@@ -58,7 +59,7 @@ export class MainThreadWindow implements MainThreadWindowShape {
}
}
return
this
.
windowsService
.
openExternal
(
encodeURI
(
uri
.
toString
(
true
))
);
return
this
.
openerService
.
openExternal
(
uri
);
}
private
getOrCreateTunnel
(
remotePort
:
number
):
Promise
<
RemoteTunnel
>
|
undefined
{
...
...
src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.ts
浏览文件 @
ba69d8dc
...
...
@@ -7,16 +7,15 @@ import * as nls from 'vs/nls';
import
{
BaseBinaryResourceEditor
}
from
'
vs/workbench/browser/parts/editor/binaryEditor
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
EditorInput
,
EditorOptions
}
from
'
vs/workbench/common/editor
'
;
import
{
FileEditorInput
}
from
'
vs/workbench/contrib/files/common/editors/fileEditorInput
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
BINARY_FILE_EDITOR_ID
}
from
'
vs/workbench/contrib/files/common/files
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
/**
* An implementation of editor for binary files like images.
...
...
@@ -28,7 +27,7 @@ export class BinaryFileEditor extends BaseBinaryResourceEditor {
constructor
(
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
IThemeService
themeService
:
IThemeService
,
@
I
WindowsService
private
readonly
windowsService
:
IWindows
Service
,
@
I
OpenerService
private
readonly
openerService
:
IOpener
Service
,
@
IEditorService
private
readonly
editorService
:
IEditorService
,
@
IStorageService
storageService
:
IStorageService
,
@
IFileService
fileService
:
IFileService
,
...
...
@@ -39,7 +38,7 @@ export class BinaryFileEditor extends BaseBinaryResourceEditor {
BinaryFileEditor
.
ID
,
{
openInternal
:
(
input
,
options
)
=>
this
.
openInternal
(
input
,
options
),
openExternal
:
resource
=>
this
.
openExternal
(
resource
)
openExternal
:
resource
=>
this
.
open
erService
.
open
External
(
resource
)
},
telemetryService
,
themeService
,
...
...
@@ -58,13 +57,6 @@ export class BinaryFileEditor extends BaseBinaryResourceEditor {
}
}
private
async
openExternal
(
resource
:
URI
):
Promise
<
void
>
{
const
didOpen
=
await
this
.
windowsService
.
openExternal
(
resource
.
toString
());
if
(
!
didOpen
)
{
return
this
.
windowsService
.
showItemInFolder
(
resource
);
}
}
getTitle
():
string
|
null
{
return
this
.
input
?
this
.
input
.
getName
()
:
nls
.
localize
(
'
binaryFileEditor
'
,
"
Binary File Viewer
"
);
}
...
...
src/vs/workbench/services/opener/electron-browser/openerService.ts
0 → 100644
浏览文件 @
ba69d8dc
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
ServiceIdentifier
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
OpenerService
as
BaseOpenerService
}
from
'
vs/editor/browser/services/openerService
'
;
import
{
IWindowsService
}
from
'
vs/platform/windows/common/windows
'
;
import
{
ICommandService
}
from
'
vs/platform/commands/common/commands
'
;
import
{
ICodeEditorService
}
from
'
vs/editor/browser/services/codeEditorService
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
IOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
export
class
OpenerService
extends
BaseOpenerService
{
_serviceBrand
!
:
ServiceIdentifier
<
any
>
;
constructor
(
@
ICodeEditorService
codeEditorService
:
ICodeEditorService
,
@
ICommandService
commandService
:
ICommandService
,
@
IWindowsService
private
readonly
windowsService
:
IWindowsService
)
{
super
(
codeEditorService
,
commandService
);
}
async
openExternal
(
resource
:
URI
):
Promise
<
boolean
>
{
const
success
=
this
.
windowsService
.
openExternal
(
encodeURI
(
resource
.
toString
(
true
)));
if
(
!
success
&&
resource
.
scheme
===
Schemas
.
file
)
{
await
this
.
windowsService
.
showItemInFolder
(
resource
);
return
true
;
}
return
success
;
}
}
registerSingleton
(
IOpenerService
,
OpenerService
,
true
);
src/vs/workbench/workbench.common.main.ts
浏览文件 @
ba69d8dc
...
...
@@ -80,8 +80,6 @@ import { IExtensionGalleryService } from 'vs/platform/extensionManagement/common
import
{
ContextViewService
}
from
'
vs/platform/contextview/browser/contextViewService
'
;
import
{
IContextViewService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IListService
,
ListService
}
from
'
vs/platform/list/browser/listService
'
;
import
{
OpenerService
}
from
'
vs/editor/browser/services/openerService
'
;
import
{
IOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
import
{
IEditorWorkerService
}
from
'
vs/editor/common/services/editorWorkerService
'
;
import
{
EditorWorkerServiceImpl
}
from
'
vs/editor/common/services/editorWorkerServiceImpl
'
;
import
{
MarkerDecorationsService
}
from
'
vs/editor/common/services/markerDecorationsServiceImpl
'
;
...
...
@@ -102,7 +100,6 @@ import { DownloadService } from 'vs/platform/download/common/downloadService';
registerSingleton
(
IExtensionGalleryService
,
ExtensionGalleryService
,
true
);
registerSingleton
(
IContextViewService
,
ContextViewService
,
true
);
registerSingleton
(
IListService
,
ListService
,
true
);
registerSingleton
(
IOpenerService
,
OpenerService
,
true
);
registerSingleton
(
IEditorWorkerService
,
EditorWorkerServiceImpl
);
registerSingleton
(
IMarkerDecorationsService
,
MarkerDecorationsService
);
registerSingleton
(
IMarkerService
,
MarkerService
,
true
);
...
...
src/vs/workbench/workbench.desktop.main.ts
浏览文件 @
ba69d8dc
...
...
@@ -48,6 +48,7 @@ import 'vs/workbench/services/extensionManagement/node/extensionManagementServic
import
'
vs/workbench/services/accessibility/node/accessibilityService
'
;
import
'
vs/workbench/services/remote/node/tunnelService
'
;
import
'
vs/workbench/services/backup/node/backupFileService
'
;
import
'
vs/workbench/services/opener/electron-browser/openerService
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
IClipboardService
}
from
'
vs/platform/clipboard/common/clipboardService
'
;
...
...
src/vs/workbench/workbench.web.main.ts
浏览文件 @
ba69d8dc
...
...
@@ -54,6 +54,8 @@ import { ContextMenuService } from 'vs/platform/contextview/browser/contextMenuS
import
{
IBackupFileService
}
from
'
vs/workbench/services/backup/common/backup
'
;
import
{
BackupFileService
}
from
'
vs/workbench/services/backup/common/backupFileService
'
;
import
{
ExtensionManagementService
}
from
'
vs/workbench/services/extensionManagement/common/extensionManagementService
'
;
import
{
OpenerService
}
from
'
vs/editor/browser/services/openerService
'
;
import
{
IOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
registerSingleton
(
IRequestService
,
RequestService
,
true
);
registerSingleton
(
IExtensionManagementService
,
ExtensionManagementService
);
...
...
@@ -63,6 +65,7 @@ registerSingleton(IClipboardService, BrowserClipboardService, true);
registerSingleton
(
IAccessibilityService
,
BrowserAccessibilityService
,
true
);
registerSingleton
(
ILifecycleService
,
BrowserLifecycleService
);
registerSingleton
(
IContextMenuService
,
ContextMenuService
);
registerSingleton
(
IOpenerService
,
OpenerService
,
true
);
//#endregion
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录