Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
2420d4c5
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2420d4c5
编写于
8月 07, 2019
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
separate rpc and init data into separate services
上级
2cf97fc2
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
124 addition
and
119 deletion
+124
-119
src/vs/workbench/api/common/extHostCommands.ts
src/vs/workbench/api/common/extHostCommands.ts
+3
-3
src/vs/workbench/api/common/extHostConfiguration.ts
src/vs/workbench/api/common/extHostConfiguration.ts
+3
-3
src/vs/workbench/api/common/extHostDecorations.ts
src/vs/workbench/api/common/extHostDecorations.ts
+3
-3
src/vs/workbench/api/common/extHostDocumentsAndEditors.ts
src/vs/workbench/api/common/extHostDocumentsAndEditors.ts
+4
-4
src/vs/workbench/api/common/extHostInitDataService.ts
src/vs/workbench/api/common/extHostInitDataService.ts
+3
-13
src/vs/workbench/api/common/extHostOutput.ts
src/vs/workbench/api/common/extHostOutput.ts
+3
-3
src/vs/workbench/api/common/extHostWorkspace.ts
src/vs/workbench/api/common/extHostWorkspace.ts
+7
-5
src/vs/workbench/api/common/rpcService.ts
src/vs/workbench/api/common/rpcService.ts
+25
-0
src/vs/workbench/api/node/extHostExtensionService.ts
src/vs/workbench/api/node/extHostExtensionService.ts
+5
-4
src/vs/workbench/api/node/extHostOutputService.ts
src/vs/workbench/api/node/extHostOutputService.ts
+8
-4
src/vs/workbench/api/node/extHostTask.ts
src/vs/workbench/api/node/extHostTask.ts
+13
-12
src/vs/workbench/api/node/extHostTerminalService.ts
src/vs/workbench/api/node/extHostTerminalService.ts
+3
-3
src/vs/workbench/services/extensions/node/extensionHostMain.ts
...s/workbench/services/extensions/node/extensionHostMain.ts
+7
-4
src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts
...ench/test/electron-browser/api/extHostApiCommands.test.ts
+7
-11
src/vs/workbench/test/electron-browser/api/extHostCommands.test.ts
...rkbench/test/electron-browser/api/extHostCommands.test.ts
+3
-4
src/vs/workbench/test/electron-browser/api/extHostConfiguration.test.ts
...ch/test/electron-browser/api/extHostConfiguration.test.ts
+3
-6
src/vs/workbench/test/electron-browser/api/extHostDocumentSaveParticipant.test.ts
...ectron-browser/api/extHostDocumentSaveParticipant.test.ts
+2
-4
src/vs/workbench/test/electron-browser/api/extHostDocumentsAndEditors.test.ts
...t/electron-browser/api/extHostDocumentsAndEditors.test.ts
+2
-12
src/vs/workbench/test/electron-browser/api/extHostLanguageFeatures.test.ts
...test/electron-browser/api/extHostLanguageFeatures.test.ts
+3
-6
src/vs/workbench/test/electron-browser/api/extHostTextEditors.test.ts
...ench/test/electron-browser/api/extHostTextEditors.test.ts
+2
-4
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
...kbench/test/electron-browser/api/extHostTreeViews.test.ts
+2
-3
src/vs/workbench/test/electron-browser/api/extHostWorkspace.test.ts
...kbench/test/electron-browser/api/extHostWorkspace.test.ts
+8
-6
src/vs/workbench/test/electron-browser/api/testRPCProtocol.ts
...vs/workbench/test/electron-browser/api/testRPCProtocol.ts
+5
-2
未找到文件。
src/vs/workbench/api/common/extHostCommands.ts
浏览文件 @
2420d4c5
...
...
@@ -19,8 +19,8 @@ import { Position } from 'vs/editor/common/core/position';
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
DisposableStore
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IExtHostContextService
}
from
'
vs/workbench/api/common/extHostContextService
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IExtHostRpcService
}
from
'
vs/workbench/api/common/rpcService
'
;
interface
CommandHandler
{
callback
:
Function
;
...
...
@@ -46,10 +46,10 @@ export class ExtHostCommands implements ExtHostCommandsShape {
private
readonly
_argumentProcessors
:
ArgumentProcessor
[];
constructor
(
@
IExtHost
ContextService
extHostContext
:
IExtHostContext
Service
,
@
IExtHost
RpcService
extHostRpc
:
IExtHostRpc
Service
,
@
ILogService
logService
:
ILogService
)
{
this
.
_proxy
=
extHost
Context
.
r
pc
.
getProxy
(
MainContext
.
MainThreadCommands
);
this
.
_proxy
=
extHost
R
pc
.
getProxy
(
MainContext
.
MainThreadCommands
);
this
.
_onDidExecuteCommand
=
new
Emitter
<
vscode
.
CommandExecutionEvent
>
({
onFirstListenerDidAdd
:
()
=>
this
.
_proxy
.
$registerCommandListener
(),
onLastListenerRemove
:
()
=>
this
.
_proxy
.
$unregisterCommandListener
(),
...
...
src/vs/workbench/api/common/extHostConfiguration.ts
浏览文件 @
2420d4c5
...
...
@@ -18,8 +18,8 @@ import { ConfigurationScope, OVERRIDE_PROPERTY_PATTERN } from 'vs/platform/confi
import
{
isObject
}
from
'
vs/base/common/types
'
;
import
{
ExtensionIdentifier
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
Barrier
}
from
'
vs/base/common/async
'
;
import
{
IExtHostContextService
}
from
'
vs/workbench/api/common/extHostContextService
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IExtHostRpcService
}
from
'
vs/workbench/api/common/rpcService
'
;
function
lookUp
(
tree
:
any
,
key
:
string
)
{
if
(
key
)
{
...
...
@@ -50,10 +50,10 @@ export class ExtHostConfiguration implements ExtHostConfigurationShape {
private
_actual
:
ExtHostConfigProvider
|
null
;
constructor
(
@
IExtHost
ContextService
extHostContext
:
IExtHostContext
Service
,
@
IExtHost
RpcService
extHostRpc
:
IExtHostRpc
Service
,
@
IExtHostWorkspace
extHostWorkspace
:
IExtHostWorkspace
)
{
this
.
_proxy
=
extHost
Context
.
r
pc
.
getProxy
(
MainContext
.
MainThreadConfiguration
);
this
.
_proxy
=
extHost
R
pc
.
getProxy
(
MainContext
.
MainThreadConfiguration
);
this
.
_extHostWorkspace
=
extHostWorkspace
;
this
.
_barrier
=
new
Barrier
();
this
.
_actual
=
null
;
...
...
src/vs/workbench/api/common/extHostDecorations.ts
浏览文件 @
2420d4c5
...
...
@@ -11,7 +11,7 @@ import { CancellationToken } from 'vs/base/common/cancellation';
import
{
ExtensionIdentifier
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
asArray
}
from
'
vs/base/common/arrays
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IExtHost
ContextService
}
from
'
vs/workbench/api/common/extHostContext
Service
'
;
import
{
IExtHost
RpcService
}
from
'
vs/workbench/api/common/rpc
Service
'
;
interface
ProviderData
{
provider
:
vscode
.
DecorationProvider
;
...
...
@@ -27,9 +27,9 @@ export class ExtHostDecorations implements IExtHostDecorations {
private
readonly
_proxy
:
MainThreadDecorationsShape
;
constructor
(
@
IExtHost
ContextService
contextService
:
IExtHostContext
Service
,
@
IExtHost
RpcService
extHostRpc
:
IExtHostRpc
Service
,
)
{
this
.
_proxy
=
contextService
.
r
pc
.
getProxy
(
MainContext
.
MainThreadDecorations
);
this
.
_proxy
=
extHostR
pc
.
getProxy
(
MainContext
.
MainThreadDecorations
);
}
registerDecorationProvider
(
provider
:
vscode
.
DecorationProvider
,
extensionId
:
ExtensionIdentifier
):
vscode
.
Disposable
{
...
...
src/vs/workbench/api/common/extHostDocumentsAndEditors.ts
浏览文件 @
2420d4c5
...
...
@@ -12,8 +12,8 @@ import { ExtHostDocumentData } from 'vs/workbench/api/common/extHostDocumentData
import
{
ExtHostTextEditor
}
from
'
vs/workbench/api/common/extHostTextEditor
'
;
import
*
as
typeConverters
from
'
vs/workbench/api/common/extHostTypeConverters
'
;
import
{
Disposable
}
from
'
vs/workbench/api/common/extHostTypes
'
;
import
{
IExtHostContextService
}
from
'
vs/workbench/api/common/extHostContextService
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IExtHostRpcService
}
from
'
vs/workbench/api/common/rpcService
'
;
export
class
ExtHostDocumentsAndEditors
implements
ExtHostDocumentsAndEditorsShape
{
...
...
@@ -37,7 +37,7 @@ export class ExtHostDocumentsAndEditors implements ExtHostDocumentsAndEditorsSha
readonly
onDidChangeActiveTextEditor
:
Event
<
ExtHostTextEditor
|
undefined
>
=
this
.
_onDidChangeActiveTextEditor
.
event
;
constructor
(
@
IExtHost
ContextService
private
readonly
_ctx
:
IExtHostContext
Service
,
@
IExtHost
RpcService
private
readonly
_extHostRpc
:
IExtHostRpc
Service
,
)
{
}
dispose
()
{
...
...
@@ -68,7 +68,7 @@ export class ExtHostDocumentsAndEditors implements ExtHostDocumentsAndEditorsSha
assert
.
ok
(
!
this
.
_documents
.
has
(
resource
.
toString
()),
`document '
${
resource
}
already exists!'`
);
const
documentData
=
new
ExtHostDocumentData
(
this
.
_
ctx
.
r
pc
.
getProxy
(
MainContext
.
MainThreadDocuments
),
this
.
_
extHostR
pc
.
getProxy
(
MainContext
.
MainThreadDocuments
),
resource
,
data
.
lines
,
data
.
EOL
,
...
...
@@ -99,7 +99,7 @@ export class ExtHostDocumentsAndEditors implements ExtHostDocumentsAndEditorsSha
const
documentData
=
this
.
_documents
.
get
(
resource
.
toString
())
!
;
const
editor
=
new
ExtHostTextEditor
(
this
.
_
ctx
.
r
pc
.
getProxy
(
MainContext
.
MainThreadTextEditors
),
this
.
_
extHostR
pc
.
getProxy
(
MainContext
.
MainThreadTextEditors
),
data
.
id
,
documentData
,
data
.
selections
.
map
(
typeConverters
.
Selection
.
to
),
...
...
src/vs/workbench/api/common/extHost
Context
Service.ts
→
src/vs/workbench/api/common/extHost
InitData
Service.ts
浏览文件 @
2420d4c5
...
...
@@ -3,22 +3,12 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
I
MainContext
,
I
InitData
}
from
'
./extHost.protocol
'
;
import
{
IInitData
}
from
'
./extHost.protocol
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
export
const
IExtHost
ContextService
=
createDecorator
<
IExtHostContextService
>
(
'
IExtHostContext
Service
'
);
export
const
IExtHost
InitDataService
=
createDecorator
<
IExtHostInitDataService
>
(
'
IExtHostInitData
Service
'
);
export
interface
IExtHost
ContextService
{
export
interface
IExtHost
InitDataService
extends
Readonly
<
IInitData
>
{
_serviceBrand
:
undefined
;
readonly
rpc
:
IMainContext
;
readonly
initData
:
IInitData
;
}
export
class
ExtHostContextService
implements
IExtHostContextService
{
_serviceBrand
:
any
;
constructor
(
readonly
rpc
:
IMainContext
,
readonly
initData
:
IInitData
)
{
}
}
src/vs/workbench/api/common/extHostOutput.ts
浏览文件 @
2420d4c5
...
...
@@ -10,7 +10,7 @@ import { Event, Emitter } from 'vs/base/common/event';
import
{
Disposable
,
MutableDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
VSBuffer
}
from
'
vs/base/common/buffer
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IExtHost
ContextService
}
from
'
vs/workbench/api/common/extHostContext
Service
'
;
import
{
IExtHost
RpcService
}
from
'
vs/workbench/api/common/rpc
Service
'
;
export
abstract
class
AbstractExtHostOutputChannel
extends
Disposable
implements
vscode
.
OutputChannel
{
...
...
@@ -143,8 +143,8 @@ export class ExtHostOutputService implements ExtHostOutputServiceShape {
protected
readonly
_channels
:
Map
<
string
,
AbstractExtHostOutputChannel
>
=
new
Map
<
string
,
AbstractExtHostOutputChannel
>
();
protected
readonly
_visibleChannelDisposable
=
new
MutableDisposable
();
constructor
(@
IExtHost
ContextService
extHostContext
:
IExtHostContext
Service
)
{
this
.
_proxy
=
extHost
Context
.
r
pc
.
getProxy
(
MainContext
.
MainThreadOutputService
);
constructor
(@
IExtHost
RpcService
extHostRpc
:
IExtHostRpc
Service
)
{
this
.
_proxy
=
extHost
R
pc
.
getProxy
(
MainContext
.
MainThreadOutputService
);
}
$setVisibleChannel
(
channelId
:
string
):
void
{
...
...
src/vs/workbench/api/common/extHostWorkspace.ts
浏览文件 @
2420d4c5
...
...
@@ -25,8 +25,9 @@ import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensio
import
{
Barrier
}
from
'
vs/base/common/async
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
withUndefinedAsNull
}
from
'
vs/base/common/types
'
;
import
{
IExtHost
ContextService
}
from
'
vs/workbench/api/common/extHostContext
Service
'
;
import
{
IExtHost
InitDataService
}
from
'
vs/workbench/api/common/extHostInitData
Service
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IExtHostRpcService
}
from
'
vs/workbench/api/common/rpcService
'
;
export
interface
IExtHostWorkspaceProvider
{
getWorkspaceFolder2
(
uri
:
vscode
.
Uri
,
resolveParent
?:
boolean
):
Promise
<
vscode
.
WorkspaceFolder
|
undefined
>
;
...
...
@@ -173,16 +174,17 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape, IExtHostWorkspac
private
readonly
_activeSearchCallbacks
:
((
match
:
IRawFileMatch2
)
=>
any
)[]
=
[];
constructor
(
@
IExtHostContextService
extHostContext
:
IExtHostContextService
,
@
IExtHostRpcService
extHostRpc
:
IExtHostRpcService
,
@
IExtHostInitDataService
initData
:
IExtHostInitDataService
,
@
ILogService
logService
:
ILogService
,
)
{
this
.
_logService
=
logService
;
this
.
_requestIdProvider
=
new
Counter
();
this
.
_barrier
=
new
Barrier
();
this
.
_proxy
=
extHost
Context
.
r
pc
.
getProxy
(
MainContext
.
MainThreadWorkspace
);
this
.
_messageService
=
extHost
Context
.
r
pc
.
getProxy
(
MainContext
.
MainThreadMessageService
);
const
data
=
extHostContext
.
initData
.
workspace
;
this
.
_proxy
=
extHost
R
pc
.
getProxy
(
MainContext
.
MainThreadWorkspace
);
this
.
_messageService
=
extHost
R
pc
.
getProxy
(
MainContext
.
MainThreadMessageService
);
const
data
=
initData
.
workspace
;
this
.
_confirmedWorkspace
=
data
?
new
ExtHostWorkspaceImpl
(
data
.
id
,
data
.
name
,
[],
data
.
configuration
?
URI
.
revive
(
data
.
configuration
)
:
null
,
!!
data
.
isUntitled
)
:
undefined
;
}
...
...
src/vs/workbench/api/common/rpcService.ts
0 → 100644
浏览文件 @
2420d4c5
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
IMainContext
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
ProxyIdentifier
}
from
'
vs/workbench/services/extensions/common/proxyIdentifier
'
;
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
export
const
IExtHostRpcService
=
createDecorator
<
IExtHostRpcService
>
(
'
IExtHostRpcService
'
);
export
interface
IExtHostRpcService
{
_serviceBrand
:
any
;
getProxy
<
T
>
(
identifier
:
ProxyIdentifier
<
T
>
):
T
;
}
export
class
ExtHostRpcService
implements
IExtHostRpcService
{
readonly
_serviceBrand
:
any
;
constructor
(
private
readonly
_mainContext
:
IMainContext
)
{
}
getProxy
<
T
>
(
identifier
:
ProxyIdentifier
<
T
>
):
T
{
return
this
.
_mainContext
.
getProxy
(
identifier
);
}
}
src/vs/workbench/api/node/extHostExtensionService.ts
浏览文件 @
2420d4c5
...
...
@@ -35,7 +35,7 @@ import { RemoteAuthorityResolverError, ExtensionExecutionContext } from 'vs/work
import
{
IURITransformer
}
from
'
vs/base/common/uriIpc
'
;
import
{
ResolvedAuthority
,
ResolvedOptions
}
from
'
vs/platform/remote/common/remoteAuthorityResolver
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IExtHost
ContextService
}
from
'
vs/workbench/api/common/extHostContext
Service
'
;
import
{
IExtHost
InitDataService
}
from
'
vs/workbench/api/common/extHostInitData
Service
'
;
interface
ITestRunner
{
/** Old test runner API, as exported from `vscode/lib/testrunner` */
...
...
@@ -99,15 +99,16 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
constructor
(
hostUtils
:
IHostUtils
,
uriTransformer
:
IURITransformer
|
null
,
extHostContext
:
IMainContext
,
@
IInstantiationService
instaService
:
IInstantiationService
,
@
IExtHostContextService
extHostContext
:
IExtHostContextService
,
@
IExtHostWorkspace
extHostWorkspace
:
IExtHostWorkspace
,
@
IExtHostConfiguration
extHostConfiguration
:
IExtHostConfiguration
,
@
ILogService
extHostLogService
:
ExtHostLogService
,
@
IExtHostInitDataService
initData
:
IExtHostInitDataService
)
{
this
.
_hostUtils
=
hostUtils
;
this
.
_
initData
=
extHostContext
.
initData
;
this
.
_
extHostContext
=
extHostContext
.
rpc
;
this
.
_
extHostContext
=
extHostContext
;
this
.
_
initData
=
initData
;
this
.
_instaService
=
instaService
;
this
.
_extHostWorkspace
=
extHostWorkspace
;
this
.
_extHostConfiguration
=
extHostConfiguration
;
...
...
src/vs/workbench/api/node/extHostOutputService.ts
浏览文件 @
2420d4c5
...
...
@@ -11,7 +11,8 @@ import { OutputAppender } from 'vs/workbench/services/output/node/outputAppender
import
{
toLocalISOString
}
from
'
vs/base/common/date
'
;
import
{
dirExists
,
mkdirp
}
from
'
vs/base/node/pfs
'
;
import
{
AbstractExtHostOutputChannel
,
ExtHostPushOutputChannel
,
ExtHostOutputService
,
LazyOutputChannel
}
from
'
vs/workbench/api/common/extHostOutput
'
;
import
{
IExtHostContextService
}
from
'
vs/workbench/api/common/extHostContextService
'
;
import
{
IExtHostInitDataService
}
from
'
vs/workbench/api/common/extHostInitDataService
'
;
import
{
IExtHostRpcService
}
from
'
vs/workbench/api/common/rpcService
'
;
export
class
ExtHostOutputChannelBackedByFile
extends
AbstractExtHostOutputChannel
{
...
...
@@ -49,9 +50,12 @@ export class ExtHostOutputService2 extends ExtHostOutputService {
private
_logsLocation
:
URI
;
private
_namePool
:
number
=
1
;
constructor
(@
IExtHostContextService
extHostContext
:
IExtHostContextService
)
{
super
(
extHostContext
);
this
.
_logsLocation
=
extHostContext
.
initData
.
logsLocation
;
constructor
(
@
IExtHostRpcService
extHostRpc
:
IExtHostRpcService
,
@
IExtHostInitDataService
initData
:
IExtHostInitDataService
,
)
{
super
(
extHostRpc
);
this
.
_logsLocation
=
initData
.
logsLocation
;
}
createOutputChannel
(
name
:
string
):
vscode
.
OutputChannel
{
...
...
src/vs/workbench/api/node/extHostTask.ts
浏览文件 @
2420d4c5
...
...
@@ -15,7 +15,7 @@ import { win32 } from 'vs/base/node/processes';
import
{
MainContext
,
MainThreadTaskShape
,
ExtHostTaskShape
,
IMainContext
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
*
as
types
from
'
vs/workbench/api/common/extHostTypes
'
;
import
{
ExtHostWorkspace
,
IExtHostWorkspaceProvider
}
from
'
vs/workbench/api/common/extHostWorkspace
'
;
import
{
IExtHostWorkspaceProvider
,
IExtHostWorkspace
}
from
'
vs/workbench/api/common/extHostWorkspace
'
;
import
*
as
vscode
from
'
vscode
'
;
import
{
TaskDefinitionDTO
,
TaskExecutionDTO
,
TaskPresentationOptionsDTO
,
...
...
@@ -25,8 +25,8 @@ import {
TaskDTO
,
TaskHandleDTO
,
TaskFilterDTO
,
TaskProcessStartedDTO
,
TaskProcessEndedDTO
,
TaskSystemInfoDTO
,
TaskSetDTO
}
from
'
../common/shared/tasks
'
;
import
{
ExtHostVariableResolverService
}
from
'
vs/workbench/api/node/extHostDebugService
'
;
import
{
ExtHostDocumentsAndEditors
}
from
'
vs/workbench/api/common/extHostDocumentsAndEditors
'
;
import
{
ExtHostConfiguration
}
from
'
vs/workbench/api/common/extHostConfiguration
'
;
import
{
I
ExtHostDocumentsAndEditors
}
from
'
vs/workbench/api/common/extHostDocumentsAndEditors
'
;
import
{
I
ExtHostConfiguration
}
from
'
vs/workbench/api/common/extHostConfiguration
'
;
import
{
IWorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
IExtensionDescription
}
from
'
vs/platform/extensions/common/extensions
'
;
...
...
@@ -354,11 +354,11 @@ interface HandlerData {
export
class
ExtHostTask
implements
ExtHostTaskShape
{
private
_proxy
:
MainThreadTaskShape
;
private
_workspaceProvider
:
IExtHostWorkspaceProvider
;
private
_editorService
:
ExtHostDocumentsAndEditors
;
private
_configurationService
:
ExtHostConfiguration
;
private
_terminalService
:
IExtHostTerminalService
;
private
readonly
_proxy
:
MainThreadTaskShape
;
private
readonly
_workspaceProvider
:
IExtHostWorkspaceProvider
;
private
readonly
_editorService
:
I
ExtHostDocumentsAndEditors
;
private
readonly
_configurationService
:
I
ExtHostConfiguration
;
private
readonly
_terminalService
:
IExtHostTerminalService
;
private
_handleCounter
:
number
;
private
_handlers
:
Map
<
number
,
HandlerData
>
;
private
_taskExecutions
:
Map
<
string
,
TaskExecutionImpl
>
;
...
...
@@ -373,10 +373,11 @@ export class ExtHostTask implements ExtHostTaskShape {
constructor
(
mainContext
:
IMainContext
,
workspaceService
:
ExtHostWorkspace
,
editorService
:
ExtHostDocumentsAndEditors
,
configurationService
:
ExtHostConfiguration
,
extHostTerminalService
:
IExtHostTerminalService
)
{
@
IExtHostWorkspace
workspaceService
:
IExtHostWorkspace
,
@
IExtHostDocumentsAndEditors
editorService
:
IExtHostDocumentsAndEditors
,
@
IExtHostConfiguration
configurationService
:
IExtHostConfiguration
,
@
IExtHostTerminalService
extHostTerminalService
:
IExtHostTerminalService
)
{
this
.
_proxy
=
mainContext
.
getProxy
(
MainContext
.
MainThreadTask
);
this
.
_workspaceProvider
=
workspaceService
;
this
.
_editorService
=
editorService
;
...
...
src/vs/workbench/api/node/extHostTerminalService.ts
浏览文件 @
2420d4c5
...
...
@@ -23,8 +23,8 @@ import { ExtHostDocumentsAndEditors, IExtHostDocumentsAndEditors } from 'vs/work
import
{
getSystemShell
,
detectAvailableShells
}
from
'
vs/workbench/contrib/terminal/node/terminal
'
;
import
{
getMainProcessParentEnv
}
from
'
vs/workbench/contrib/terminal/node/terminalEnvironment
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IExtHostContextService
}
from
'
vs/workbench/api/common/extHostContextService
'
;
import
{
IExtHostTerminalService
}
from
'
vs/workbench/api/common/extHostTerminalService
'
;
import
{
IExtHostRpcService
}
from
'
vs/workbench/api/common/rpcService
'
;
export
class
BaseExtHostTerminal
{
public
_id
:
number
|
undefined
;
...
...
@@ -228,13 +228,13 @@ export class ExtHostTerminalService implements IExtHostTerminalService, ExtHostT
public
get
onDidWriteTerminalData
():
Event
<
vscode
.
TerminalDataWriteEvent
>
{
return
this
.
_onDidWriteTerminalData
&&
this
.
_onDidWriteTerminalData
.
event
;
}
constructor
(
@
IExtHost
ContextService
extHostContext
:
IExtHostContext
Service
,
@
IExtHost
RpcService
extHostRpc
:
IExtHostRpc
Service
,
@
IExtHostConfiguration
private
_extHostConfiguration
:
ExtHostConfiguration
,
@
IExtHostWorkspace
private
_extHostWorkspace
:
ExtHostWorkspace
,
@
IExtHostDocumentsAndEditors
private
_extHostDocumentsAndEditors
:
ExtHostDocumentsAndEditors
,
@
ILogService
private
_logService
:
ILogService
)
{
this
.
_proxy
=
extHost
Context
.
r
pc
.
getProxy
(
MainContext
.
MainThreadTerminalService
);
this
.
_proxy
=
extHost
R
pc
.
getProxy
(
MainContext
.
MainThreadTerminalService
);
this
.
_onDidWriteTerminalData
=
new
Emitter
<
vscode
.
TerminalDataWriteEvent
>
({
onFirstListenerAdd
:
()
=>
this
.
_proxy
.
$startSendingDataEvents
(),
onLastListenerRemove
:
()
=>
this
.
_proxy
.
$stopSendingDataEvents
()
...
...
src/vs/workbench/services/extensions/node/extensionHostMain.ts
浏览文件 @
2420d4c5
...
...
@@ -17,9 +17,10 @@ import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
getSingletonServiceDescriptors
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
IExtHost
ContextService
,
ExtHostContextService
}
from
'
vs/workbench/api/common/extHostContext
Service
'
;
import
{
IExtHost
InitDataService
}
from
'
vs/workbench/api/common/extHostInitData
Service
'
;
import
{
InstantiationService
}
from
'
vs/platform/instantiation/common/instantiationService
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IExtHostRpcService
,
ExtHostRpcService
}
from
'
vs/workbench/api/common/rpcService
'
;
// we don't (yet) throw when extensions parse
// uris that have no scheme
...
...
@@ -68,10 +69,11 @@ export class ExtensionHostMain {
// bootstrap services
const
services
=
new
ServiceCollection
(...
getSingletonServiceDescriptors
());
services
.
set
(
IExtHostContextService
,
new
ExtHostContextService
(
rpcProtocol
,
initData
));
services
.
set
(
IExtHostInitDataService
,
{
_serviceBrand
:
undefined
,
...
initData
});
services
.
set
(
IExtHostRpcService
,
new
ExtHostRpcService
(
rpcProtocol
));
services
.
set
(
ILogService
,
extHostLogService
);
const
instaService
:
IInstantiationService
=
new
InstantiationService
(
services
);
const
instaService
:
IInstantiationService
=
new
InstantiationService
(
services
,
true
);
extHostLogService
.
info
(
'
extension host started
'
);
extHostLogService
.
trace
(
'
initData
'
,
initData
);
...
...
@@ -79,7 +81,8 @@ export class ExtensionHostMain {
this
.
_extensionService
=
instaService
.
createInstance
(
ExtHostExtensionService
,
hostUtils
,
uriTransformer
uriTransformer
,
rpcProtocol
);
// error forwarding and stack trace scanning
...
...
src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts
浏览文件 @
2420d4c5
...
...
@@ -21,7 +21,7 @@ import { ExtHostCommands } from 'vs/workbench/api/common/extHostCommands';
import
{
MainThreadCommands
}
from
'
vs/workbench/api/browser/mainThreadCommands
'
;
import
{
ExtHostDocuments
}
from
'
vs/workbench/api/common/extHostDocuments
'
;
import
{
ExtHostDocumentsAndEditors
}
from
'
vs/workbench/api/common/extHostDocumentsAndEditors
'
;
import
{
MainContext
,
ExtHostContext
,
IInitData
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
MainContext
,
ExtHostContext
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
ExtHostDiagnostics
}
from
'
vs/workbench/api/common/extHostDiagnostics
'
;
import
*
as
vscode
from
'
vscode
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -30,8 +30,6 @@ import { NullLogService } from 'vs/platform/log/common/log';
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
nullExtensionDescription
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
ExtHostContextService
}
from
'
vs/workbench/api/common/extHostContextService
'
;
import
{
mock
}
from
'
vs/workbench/test/electron-browser/api/mock
'
;
const
defaultSelector
=
{
scheme
:
'
far
'
};
const
model
:
ITextModel
=
EditorModel
.
createFromString
(
...
...
@@ -95,9 +93,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
inst
=
instantiationService
;
}
const
extHostContext
=
new
ExtHostContextService
(
rpcProtocol
,
new
class
extends
mock
<
IInitData
>
()
{
});
const
extHostDocumentsAndEditors
=
new
ExtHostDocumentsAndEditors
(
extHostContext
);
const
extHostDocumentsAndEditors
=
new
ExtHostDocumentsAndEditors
(
rpcProtocol
);
extHostDocumentsAndEditors
.
$acceptDocumentsAndEditorsDelta
({
addedDocuments
:
[{
isDirty
:
false
,
...
...
@@ -111,7 +107,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
const
extHostDocuments
=
new
ExtHostDocuments
(
rpcProtocol
,
extHostDocumentsAndEditors
);
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostDocuments
,
extHostDocuments
);
commands
=
new
ExtHostCommands
(
extHostContext
,
new
NullLogService
());
commands
=
new
ExtHostCommands
(
rpcProtocol
,
new
NullLogService
());
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostCommands
,
commands
);
rpcProtocol
.
set
(
MainContext
.
MainThreadCommands
,
inst
.
createInstance
(
MainThreadCommands
,
rpcProtocol
));
ExtHostApiCommands
.
register
(
commands
);
...
...
@@ -185,7 +181,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
test
(
'
executeWorkspaceSymbolProvider should accept empty string, #39522
'
,
async
function
()
{
disposables
.
push
(
extHost
.
registerWorkspaceSymbolProvider
(
nullExtensionDescription
,
{
provideWorkspaceSymbols
(
query
):
vscode
.
SymbolInformation
[]
{
provideWorkspaceSymbols
():
vscode
.
SymbolInformation
[]
{
return
[
new
types
.
SymbolInformation
(
'
hello
'
,
types
.
SymbolKind
.
Array
,
new
types
.
Range
(
0
,
0
,
0
,
0
),
URI
.
parse
(
'
foo:bar
'
))
as
vscode
.
SymbolInformation
];
}
}));
...
...
@@ -316,7 +312,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
test
(
'
reference search, back and forth
'
,
function
()
{
disposables
.
push
(
extHost
.
registerReferenceProvider
(
nullExtensionDescription
,
defaultSelector
,
<
vscode
.
ReferenceProvider
>
{
provideReferences
(
doc
:
any
)
{
provideReferences
()
{
return
[
new
types
.
Location
(
URI
.
parse
(
'
some:uri/path
'
),
new
types
.
Range
(
0
,
1
,
0
,
5
))
];
...
...
@@ -392,7 +388,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
test
(
'
Suggest, back and forth
'
,
function
()
{
disposables
.
push
(
extHost
.
registerCompletionItemProvider
(
nullExtensionDescription
,
defaultSelector
,
<
vscode
.
CompletionItemProvider
>
{
provideCompletionItems
(
doc
,
pos
):
any
{
provideCompletionItems
():
any
{
let
a
=
new
types
.
CompletionItem
(
'
item1
'
);
let
b
=
new
types
.
CompletionItem
(
'
item2
'
);
b
.
textEdit
=
types
.
TextEdit
.
replace
(
new
types
.
Range
(
0
,
4
,
0
,
8
),
'
foo
'
);
// overwite after
...
...
@@ -728,7 +724,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
provideDocumentColors
():
vscode
.
ColorInformation
[]
{
return
[
new
types
.
ColorInformation
(
new
types
.
Range
(
0
,
0
,
0
,
20
),
new
types
.
Color
(
0.1
,
0.2
,
0.3
,
0.4
))];
},
provideColorPresentations
(
color
:
vscode
.
Color
,
context
:
{
range
:
vscode
.
Range
,
document
:
vscode
.
TextDocument
}
):
vscode
.
ColorPresentation
[]
{
provideColorPresentations
():
vscode
.
ColorPresentation
[]
{
const
cp
=
new
types
.
ColorPresentation
(
'
#ABC
'
);
cp
.
textEdit
=
types
.
TextEdit
.
replace
(
new
types
.
Range
(
1
,
0
,
1
,
20
),
'
#ABC
'
);
cp
.
additionalTextEdits
=
[
types
.
TextEdit
.
insert
(
new
types
.
Position
(
2
,
20
),
'
*
'
)];
...
...
src/vs/workbench/test/electron-browser/api/extHostCommands.test.ts
浏览文件 @
2420d4c5
...
...
@@ -5,12 +5,11 @@
import
*
as
assert
from
'
assert
'
;
import
{
ExtHostCommands
}
from
'
vs/workbench/api/common/extHostCommands
'
;
import
{
MainThreadCommandsShape
,
IInitData
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
MainThreadCommandsShape
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
CommandsRegistry
}
from
'
vs/platform/commands/common/commands
'
;
import
{
SingleProxyRPCProtocol
}
from
'
./testRPCProtocol
'
;
import
{
mock
}
from
'
vs/workbench/test/electron-browser/api/mock
'
;
import
{
NullLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
ExtHostContextService
}
from
'
vs/workbench/api/common/extHostContextService
'
;
suite
(
'
ExtHostCommands
'
,
function
()
{
...
...
@@ -28,7 +27,7 @@ suite('ExtHostCommands', function () {
};
const
commands
=
new
ExtHostCommands
(
new
ExtHostContextService
(
SingleProxyRPCProtocol
(
shape
),
new
class
extends
mock
<
IInitData
>
()
{
}
),
SingleProxyRPCProtocol
(
shape
),
new
NullLogService
()
);
commands
.
registerCommand
(
true
,
'
foo
'
,
():
any
=>
{
}).
dispose
();
...
...
@@ -51,7 +50,7 @@ suite('ExtHostCommands', function () {
};
const
commands
=
new
ExtHostCommands
(
new
ExtHostContextService
(
SingleProxyRPCProtocol
(
shape
),
new
class
extends
mock
<
IInitData
>
()
{
}
),
SingleProxyRPCProtocol
(
shape
),
new
NullLogService
()
);
const
reg
=
commands
.
registerCommand
(
true
,
'
foo
'
,
():
any
=>
{
});
...
...
src/vs/workbench/test/electron-browser/api/extHostConfiguration.test.ts
浏览文件 @
2420d4c5
...
...
@@ -7,7 +7,7 @@ import * as assert from 'assert';
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
ExtHostWorkspace
}
from
'
vs/workbench/api/common/extHostWorkspace
'
;
import
{
ExtHostConfigProvider
}
from
'
vs/workbench/api/common/extHostConfiguration
'
;
import
{
MainThreadConfigurationShape
,
IConfigurationInitData
,
IInitData
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
MainThreadConfigurationShape
,
IConfigurationInitData
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
ConfigurationModel
}
from
'
vs/platform/configuration/common/configurationModels
'
;
import
{
TestRPCProtocol
}
from
'
./testRPCProtocol
'
;
import
{
mock
}
from
'
vs/workbench/test/electron-browser/api/mock
'
;
...
...
@@ -15,6 +15,7 @@ import { IWorkspaceFolder, WorkspaceFolder } from 'vs/platform/workspace/common/
import
{
ConfigurationTarget
,
IConfigurationModel
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
NullLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
assign
}
from
'
vs/base/common/objects
'
;
import
{
IExtHostInitDataService
}
from
'
vs/workbench/api/common/extHostInitDataService
'
;
suite
(
'
ExtHostConfiguration
'
,
function
()
{
...
...
@@ -27,11 +28,7 @@ suite('ExtHostConfiguration', function () {
}
function
createExtHostWorkspace
():
ExtHostWorkspace
{
return
new
ExtHostWorkspace
({
_serviceBrand
:
undefined
,
rpc
:
new
TestRPCProtocol
(),
initData
:
new
class
extends
mock
<
IInitData
>
()
{
}
},
new
NullLogService
());
return
new
ExtHostWorkspace
(
new
TestRPCProtocol
(),
new
class
extends
mock
<
IExtHostInitDataService
>
()
{
},
new
NullLogService
());
}
function
createExtHostConfiguration
(
contents
:
any
=
Object
.
create
(
null
),
shape
?:
MainThreadConfigurationShape
)
{
...
...
src/vs/workbench/test/electron-browser/api/extHostDocumentSaveParticipant.test.ts
浏览文件 @
2420d4c5
...
...
@@ -7,7 +7,7 @@ import { URI } from 'vs/base/common/uri';
import
{
ExtHostDocuments
}
from
'
vs/workbench/api/common/extHostDocuments
'
;
import
{
ExtHostDocumentsAndEditors
}
from
'
vs/workbench/api/common/extHostDocumentsAndEditors
'
;
import
{
TextDocumentSaveReason
,
TextEdit
,
Position
,
EndOfLine
}
from
'
vs/workbench/api/common/extHostTypes
'
;
import
{
MainThreadTextEditorsShape
,
IWorkspaceEditDto
,
IInitData
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
MainThreadTextEditorsShape
,
IWorkspaceEditDto
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
ExtHostDocumentSaveParticipant
}
from
'
vs/workbench/api/common/extHostDocumentSaveParticipant
'
;
import
{
SingleProxyRPCProtocol
}
from
'
./testRPCProtocol
'
;
import
{
SaveReason
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
...
...
@@ -17,7 +17,6 @@ import { NullLogService } from 'vs/platform/log/common/log';
import
{
isResourceTextEdit
,
ResourceTextEdit
}
from
'
vs/editor/common/modes
'
;
import
{
timeout
}
from
'
vs/base/common/async
'
;
import
{
ExtensionIdentifier
,
IExtensionDescription
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
ExtHostContextService
}
from
'
vs/workbench/api/common/extHostContextService
'
;
suite
(
'
ExtHostDocumentSaveParticipant
'
,
()
=>
{
...
...
@@ -38,8 +37,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
};
setup
(()
=>
{
const
extHostContext
=
new
ExtHostContextService
(
SingleProxyRPCProtocol
(
null
),
new
class
extends
mock
<
IInitData
>
()
{
});
const
documentsAndEditors
=
new
ExtHostDocumentsAndEditors
(
extHostContext
);
const
documentsAndEditors
=
new
ExtHostDocumentsAndEditors
(
SingleProxyRPCProtocol
(
null
));
documentsAndEditors
.
$acceptDocumentsAndEditorsDelta
({
addedDocuments
:
[{
isDirty
:
false
,
...
...
src/vs/workbench/test/electron-browser/api/extHostDocumentsAndEditors.test.ts
浏览文件 @
2420d4c5
...
...
@@ -6,24 +6,14 @@
import
*
as
assert
from
'
assert
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
ExtHostDocumentsAndEditors
}
from
'
vs/workbench/api/common/extHostDocumentsAndEditors
'
;
import
{
mock
}
from
'
vs/workbench/test/electron-browser/api/mock
'
;
import
{
IInitData
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
TestRPCProtocol
}
from
'
vs/workbench/test/electron-browser/api/testRPCProtocol
'
;
suite
(
'
ExtHostDocumentsAndEditors
'
,
()
=>
{
let
editors
:
ExtHostDocumentsAndEditors
;
setup
(
function
()
{
editors
=
new
ExtHostDocumentsAndEditors
({
_serviceBrand
:
undefined
,
rpc
:
{
getProxy
:
()
=>
{
return
undefined
!
;
},
set
:
undefined
!
,
assertRegistered
:
undefined
!
},
initData
:
new
class
extends
mock
<
IInitData
>
()
{
}
});
editors
=
new
ExtHostDocumentsAndEditors
(
new
TestRPCProtocol
());
});
test
(
'
The value of TextDocument.isClosed is incorrect when a text document is closed, #27949
'
,
()
=>
{
...
...
src/vs/workbench/test/electron-browser/api/extHostLanguageFeatures.test.ts
浏览文件 @
2420d4c5
...
...
@@ -34,7 +34,7 @@ import { provideSignatureHelp } from 'vs/editor/contrib/parameterHints/provideSi
import
{
provideSuggestionItems
,
CompletionOptions
}
from
'
vs/editor/contrib/suggest/suggest
'
;
import
{
getDocumentFormattingEditsUntilResult
,
getDocumentRangeFormattingEditsUntilResult
,
getOnTypeFormattingEdits
}
from
'
vs/editor/contrib/format/format
'
;
import
{
getLinks
}
from
'
vs/editor/contrib/links/getLinks
'
;
import
{
MainContext
,
ExtHostContext
,
IInitData
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
MainContext
,
ExtHostContext
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
ExtHostDiagnostics
}
from
'
vs/workbench/api/common/extHostDiagnostics
'
;
import
*
as
vscode
from
'
vscode
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -48,7 +48,6 @@ import { mock } from 'vs/workbench/test/electron-browser/api/mock';
import
{
IEditorWorkerService
}
from
'
vs/editor/common/services/editorWorkerService
'
;
import
{
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
withNullAsUndefined
}
from
'
vs/base/common/types
'
;
import
{
ExtHostContextService
}
from
'
vs/workbench/api/common/extHostContextService
'
;
const
defaultSelector
=
{
scheme
:
'
far
'
};
const
model
:
ITextModel
=
EditorModel
.
createFromString
(
...
...
@@ -86,9 +85,7 @@ suite('ExtHostLanguageFeatures', function () {
originalErrorHandler
=
errorHandler
.
getUnexpectedErrorHandler
();
setUnexpectedErrorHandler
(()
=>
{
});
const
extHostContext
=
new
ExtHostContextService
(
rpcProtocol
,
new
class
extends
mock
<
IInitData
>
()
{
});
const
extHostDocumentsAndEditors
=
new
ExtHostDocumentsAndEditors
(
extHostContext
);
const
extHostDocumentsAndEditors
=
new
ExtHostDocumentsAndEditors
(
rpcProtocol
);
extHostDocumentsAndEditors
.
$acceptDocumentsAndEditorsDelta
({
addedDocuments
:
[{
isDirty
:
false
,
...
...
@@ -102,7 +99,7 @@ suite('ExtHostLanguageFeatures', function () {
const
extHostDocuments
=
new
ExtHostDocuments
(
rpcProtocol
,
extHostDocumentsAndEditors
);
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostDocuments
,
extHostDocuments
);
const
commands
=
new
ExtHostCommands
(
extHostContext
,
new
NullLogService
());
const
commands
=
new
ExtHostCommands
(
rpcProtocol
,
new
NullLogService
());
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostCommands
,
commands
);
rpcProtocol
.
set
(
MainContext
.
MainThreadCommands
,
inst
.
createInstance
(
MainThreadCommands
,
rpcProtocol
));
...
...
src/vs/workbench/test/electron-browser/api/extHostTextEditors.test.ts
浏览文件 @
2420d4c5
...
...
@@ -4,14 +4,13 @@
*--------------------------------------------------------------------------------------------*/
import
*
as
assert
from
'
assert
'
;
import
*
as
extHostTypes
from
'
vs/workbench/api/common/extHostTypes
'
;
import
{
MainContext
,
MainThreadTextEditorsShape
,
IWorkspaceEditDto
,
IInitData
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
MainContext
,
MainThreadTextEditorsShape
,
IWorkspaceEditDto
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
mock
}
from
'
vs/workbench/test/electron-browser/api/mock
'
;
import
{
ExtHostDocumentsAndEditors
}
from
'
vs/workbench/api/common/extHostDocumentsAndEditors
'
;
import
{
SingleProxyRPCProtocol
,
TestRPCProtocol
}
from
'
vs/workbench/test/electron-browser/api/testRPCProtocol
'
;
import
{
ExtHostEditors
}
from
'
vs/workbench/api/common/extHostTextEditors
'
;
import
{
ResourceTextEdit
}
from
'
vs/editor/common/modes
'
;
import
{
ExtHostContextService
}
from
'
vs/workbench/api/common/extHostContextService
'
;
suite
(
'
ExtHostTextEditors.applyWorkspaceEdit
'
,
()
=>
{
...
...
@@ -29,8 +28,7 @@ suite('ExtHostTextEditors.applyWorkspaceEdit', () => {
return
Promise
.
resolve
(
true
);
}
});
const
extHostContext
=
new
ExtHostContextService
(
SingleProxyRPCProtocol
(
null
),
new
class
extends
mock
<
IInitData
>
()
{
});
const
documentsAndEditors
=
new
ExtHostDocumentsAndEditors
(
extHostContext
);
const
documentsAndEditors
=
new
ExtHostDocumentsAndEditors
(
SingleProxyRPCProtocol
(
null
));
documentsAndEditors
.
$acceptDocumentsAndEditorsDelta
({
addedDocuments
:
[{
isDirty
:
false
,
...
...
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
浏览文件 @
2420d4c5
...
...
@@ -8,7 +8,7 @@ import * as sinon from 'sinon';
import
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
ExtHostTreeViews
}
from
'
vs/workbench/api/common/extHostTreeViews
'
;
import
{
ExtHostCommands
}
from
'
vs/workbench/api/common/extHostCommands
'
;
import
{
MainThreadTreeViewsShape
,
MainContext
,
IInitData
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
MainThreadTreeViewsShape
,
MainContext
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
TreeDataProvider
,
TreeItem
}
from
'
vscode
'
;
import
{
TestRPCProtocol
}
from
'
./testRPCProtocol
'
;
import
{
TestInstantiationService
}
from
'
vs/platform/instantiation/test/common/instantiationServiceMock
'
;
...
...
@@ -18,7 +18,6 @@ import { mock } from 'vs/workbench/test/electron-browser/api/mock';
import
{
TreeItemCollapsibleState
,
ITreeItem
}
from
'
vs/workbench/common/views
'
;
import
{
NullLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
IExtensionDescription
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
ExtHostContextService
}
from
'
vs/workbench/api/common/extHostContextService
'
;
suite
(
'
ExtHostTreeView
'
,
function
()
{
...
...
@@ -73,7 +72,7 @@ suite('ExtHostTreeView', function () {
rpcProtocol
.
set
(
MainContext
.
MainThreadCommands
,
inst
.
createInstance
(
MainThreadCommands
,
rpcProtocol
));
target
=
new
RecordingShape
();
testObject
=
new
ExtHostTreeViews
(
target
,
new
ExtHostCommands
(
new
ExtHostContextService
(
rpcProtocol
,
new
class
extends
mock
<
IInitData
>
()
{
})
,
rpcProtocol
,
new
NullLogService
()
),
new
NullLogService
());
onDidChangeTreeNode
=
new
Emitter
<
{
key
:
string
}
>
();
...
...
src/vs/workbench/test/electron-browser/api/extHostWorkspace.test.ts
浏览文件 @
2420d4c5
...
...
@@ -11,18 +11,20 @@ import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensio
import
{
ILogService
,
NullLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
IWorkspaceFolderData
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
MainThreadWorkspace
}
from
'
vs/workbench/api/browser/mainThreadWorkspace
'
;
import
{
IMainContext
,
IWorkspaceData
,
MainContext
,
IInitData
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
IMainContext
,
IWorkspaceData
,
MainContext
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
RelativePattern
}
from
'
vs/workbench/api/common/extHostTypes
'
;
import
{
ExtHostWorkspace
}
from
'
vs/workbench/api/common/extHostWorkspace
'
;
import
{
mock
}
from
'
vs/workbench/test/electron-browser/api/mock
'
;
import
{
TestRPCProtocol
}
from
'
./testRPCProtocol
'
;
import
{
ExtHostRpcService
}
from
'
vs/workbench/api/common/rpcService
'
;
import
{
IExtHostInitDataService
}
from
'
vs/workbench/api/common/extHostInitDataService
'
;
function
createExtHostWorkspace
(
mainContext
:
IMainContext
,
data
:
IWorkspaceData
,
logService
:
ILogService
):
ExtHostWorkspace
{
const
result
=
new
ExtHostWorkspace
(
{
_serviceBrand
:
undefined
,
rpc
:
mainContext
,
initData
:
new
class
extends
mock
<
IInitData
>
()
{
workspace
=
data
;
}
},
logService
);
const
result
=
new
ExtHostWorkspace
(
new
ExtHostRpcService
(
mainContext
)
,
new
class
extends
mock
<
IExtHostInitDataService
>
()
{
workspace
=
data
;
}
,
logService
);
result
.
$initializeWorkspace
(
data
);
return
result
;
}
...
...
src/vs/workbench/test/electron-browser/api/testRPCProtocol.ts
浏览文件 @
2420d4c5
...
...
@@ -7,9 +7,11 @@ import { ProxyIdentifier } from 'vs/workbench/services/extensions/common/proxyId
import
{
CharCode
}
from
'
vs/base/common/charCode
'
;
import
{
IExtHostContext
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
isThenable
}
from
'
vs/base/common/async
'
;
import
{
IExtHostRpcService
}
from
'
vs/workbench/api/common/rpcService
'
;
export
function
SingleProxyRPCProtocol
(
thing
:
any
):
IExtHostContext
{
export
function
SingleProxyRPCProtocol
(
thing
:
any
):
IExtHostContext
&
IExtHostRpcService
{
return
{
_serviceBrand
:
undefined
,
remoteAuthority
:
null
!
,
getProxy
<
T
>
():
T
{
return
thing
;
...
...
@@ -21,8 +23,9 @@ export function SingleProxyRPCProtocol(thing: any): IExtHostContext {
};
}
export
class
TestRPCProtocol
implements
IExtHostContext
{
export
class
TestRPCProtocol
implements
IExtHostContext
,
IExtHostRpcService
{
public
_serviceBrand
=
undefined
;
public
remoteAuthority
=
null
!
;
private
_callCountValue
:
number
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录