Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
4e78a42a
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,发现更多精彩内容 >>
提交
4e78a42a
编写于
11月 29, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
log ext host commands, ext hsot scm
上级
2b5d14e4
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
66 addition
and
31 deletion
+66
-31
src/vs/platform/commands/test/commandService.test.ts
src/vs/platform/commands/test/commandService.test.ts
+1
-11
src/vs/platform/log/common/log.ts
src/vs/platform/log/common/log.ts
+12
-0
src/vs/platform/log/node/spdlogService.ts
src/vs/platform/log/node/spdlogService.ts
+6
-6
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+5
-3
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+3
-0
src/vs/workbench/api/node/extHostCommands.ts
src/vs/workbench/api/node/extHostCommands.ts
+7
-1
src/vs/workbench/api/node/extHostExtensionService.ts
src/vs/workbench/api/node/extHostExtensionService.ts
+4
-2
src/vs/workbench/api/node/extHostSCM.ts
src/vs/workbench/api/node/extHostSCM.ts
+9
-1
src/vs/workbench/node/extensionHostMain.ts
src/vs/workbench/node/extensionHostMain.ts
+6
-1
src/vs/workbench/services/extensions/electron-browser/extensionHost.ts
...nch/services/extensions/electron-browser/extensionHost.ts
+3
-1
src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts
...ench/test/electron-browser/api/extHostApiCommands.test.ts
+3
-1
src/vs/workbench/test/electron-browser/api/extHostCommands.test.ts
...rkbench/test/electron-browser/api/extHostCommands.test.ts
+3
-2
src/vs/workbench/test/electron-browser/api/extHostLanguageFeatures.test.ts
...test/electron-browser/api/extHostLanguageFeatures.test.ts
+2
-1
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
...kbench/test/electron-browser/api/extHostTreeViews.test.ts
+2
-1
未找到文件。
src/vs/platform/commands/test/commandService.test.ts
浏览文件 @
4e78a42a
...
...
@@ -16,17 +16,7 @@ import { ContextKeyService } from 'vs/platform/contextkey/browser/contextKeyServ
import
{
SimpleConfigurationService
}
from
'
vs/editor/standalone/browser/simpleServices
'
;
import
{
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
class
NoopLogService
implements
ILogService
{
_serviceBrand
:
any
;
trace
(
message
:
string
,
...
args
:
any
[]):
void
{
}
debug
(
message
:
string
,
...
args
:
any
[]):
void
{
}
info
(
message
:
string
,
...
args
:
any
[]):
void
{
}
warn
(
message
:
string
,
...
args
:
any
[]):
void
{
}
error
(
message
:
string
|
Error
,
...
args
:
any
[]):
void
{
}
critical
(
message
:
string
|
Error
,
...
args
:
any
[]):
void
{
}
}
import
{
NoopLogService
}
from
'
vs/platform/log/common/log
'
;
class
SimpleExtensionService
implements
IExtensionService
{
_serviceBrand
:
any
;
...
...
src/vs/platform/log/common/log.ts
浏览文件 @
4e78a42a
...
...
@@ -69,6 +69,8 @@ export class LegacyLogMainService implements ILogService {
export
function
log
(
level
:
LogLevel
,
prefix
:
string
,
logFn
?:
(
message
:
string
,
...
args
:
any
[])
=>
string
):
Function
{
return
createDecorator
((
fn
,
key
)
=>
{
// TODO@Joao: load-time log level? return fn;
return
function
(
this
:
any
,
...
args
:
any
[])
{
let
message
=
`
${
prefix
}
-
${
key
}
`
;
...
...
@@ -88,4 +90,14 @@ export function log(level: LogLevel, prefix: string, logFn?: (message: string, .
return
fn
.
apply
(
this
,
args
);
};
});
}
export
class
NoopLogService
implements
ILogService
{
_serviceBrand
:
any
;
trace
(
message
:
string
,
...
args
:
any
[]):
void
{
}
debug
(
message
:
string
,
...
args
:
any
[]):
void
{
}
info
(
message
:
string
,
...
args
:
any
[]):
void
{
}
warn
(
message
:
string
,
...
args
:
any
[]):
void
{
}
error
(
message
:
string
|
Error
,
...
args
:
any
[]):
void
{
}
critical
(
message
:
string
|
Error
,
...
args
:
any
[]):
void
{
}
}
\ No newline at end of file
src/vs/platform/log/node/spdlogService.ts
浏览文件 @
4e78a42a
...
...
@@ -20,26 +20,26 @@ export class SpdLogService implements ILogService {
}
trace
(
message
:
string
,
...
args
:
any
[]):
void
{
console
.
log
(
'
TRACE
'
,
message
,
...
args
);
//
console.log('TRACE', message, ...args);
}
debug
(
message
:
string
,
...
args
:
any
[]):
void
{
console
.
log
(
'
DEBUG
'
,
message
,
...
args
);
//
console.log('DEBUG', message, ...args);
}
info
(
message
:
string
,
...
args
:
any
[]):
void
{
console
.
log
(
'
INFO
'
,
message
,
...
args
);
//
console.log('INFO', message, ...args);
}
warn
(
message
:
string
,
...
args
:
any
[]):
void
{
console
.
warn
(
'
WARN
'
,
message
,
...
args
);
//
console.warn('WARN', message, ...args);
}
error
(
message
:
string
|
Error
,
...
args
:
any
[]):
void
{
console
.
error
(
'
ERROR
'
,
message
,
...
args
);
//
console.error('ERROR', message, ...args);
}
critical
(
message
:
string
,
...
args
:
any
[]):
void
{
console
.
error
(
'
CRITICAL
'
,
message
,
...
args
);
//
console.error('CRITICAL', message, ...args);
}
}
\ No newline at end of file
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
4e78a42a
...
...
@@ -56,6 +56,7 @@ import { ExtHostFileSystem } from 'vs/workbench/api/node/extHostFileSystem';
import
{
FileChangeType
,
FileType
}
from
'
vs/platform/files/common/files
'
;
import
{
ExtHostDecorations
}
from
'
vs/workbench/api/node/extHostDecorations
'
;
import
{
toGlobPattern
,
toLanguageSelector
}
from
'
vs/workbench/api/node/extHostTypeConverters
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
export
interface
IExtensionApiFactory
{
(
extension
:
IExtensionDescription
):
typeof
vscode
;
...
...
@@ -79,7 +80,8 @@ export function createApiFactory(
threadService
:
ExtHostThreadService
,
extHostWorkspace
:
ExtHostWorkspace
,
extHostConfiguration
:
ExtHostConfiguration
,
extensionService
:
ExtHostExtensionService
extensionService
:
ExtHostExtensionService
,
logService
:
ILogService
):
IExtensionApiFactory
{
// Addressable instances
...
...
@@ -90,7 +92,7 @@ export function createApiFactory(
const
extHostDocumentContentProviders
=
threadService
.
set
(
ExtHostContext
.
ExtHostDocumentContentProviders
,
new
ExtHostDocumentContentProvider
(
threadService
,
extHostDocumentsAndEditors
));
const
extHostDocumentSaveParticipant
=
threadService
.
set
(
ExtHostContext
.
ExtHostDocumentSaveParticipant
,
new
ExtHostDocumentSaveParticipant
(
extHostDocuments
,
threadService
.
get
(
MainContext
.
MainThreadEditors
)));
const
extHostEditors
=
threadService
.
set
(
ExtHostContext
.
ExtHostEditors
,
new
ExtHostEditors
(
threadService
,
extHostDocumentsAndEditors
));
const
extHostCommands
=
threadService
.
set
(
ExtHostContext
.
ExtHostCommands
,
new
ExtHostCommands
(
threadService
,
extHostHeapService
));
const
extHostCommands
=
threadService
.
set
(
ExtHostContext
.
ExtHostCommands
,
new
ExtHostCommands
(
threadService
,
extHostHeapService
,
logService
));
const
extHostTreeViews
=
threadService
.
set
(
ExtHostContext
.
ExtHostTreeViews
,
new
ExtHostTreeViews
(
threadService
.
get
(
MainContext
.
MainThreadTreeViews
),
extHostCommands
));
threadService
.
set
(
ExtHostContext
.
ExtHostWorkspace
,
extHostWorkspace
);
const
extHostDebugService
=
threadService
.
set
(
ExtHostContext
.
ExtHostDebugService
,
new
ExtHostDebugService
(
threadService
,
extHostWorkspace
));
...
...
@@ -101,7 +103,7 @@ export function createApiFactory(
const
extHostFileSystemEvent
=
threadService
.
set
(
ExtHostContext
.
ExtHostFileSystemEventService
,
new
ExtHostFileSystemEventService
());
const
extHostQuickOpen
=
threadService
.
set
(
ExtHostContext
.
ExtHostQuickOpen
,
new
ExtHostQuickOpen
(
threadService
,
extHostWorkspace
,
extHostCommands
));
const
extHostTerminalService
=
threadService
.
set
(
ExtHostContext
.
ExtHostTerminalService
,
new
ExtHostTerminalService
(
threadService
));
const
extHostSCM
=
threadService
.
set
(
ExtHostContext
.
ExtHostSCM
,
new
ExtHostSCM
(
threadService
,
extHostCommands
));
const
extHostSCM
=
threadService
.
set
(
ExtHostContext
.
ExtHostSCM
,
new
ExtHostSCM
(
threadService
,
extHostCommands
,
logService
));
const
extHostTask
=
threadService
.
set
(
ExtHostContext
.
ExtHostTask
,
new
ExtHostTask
(
threadService
,
extHostWorkspace
));
const
extHostWindow
=
threadService
.
set
(
ExtHostContext
.
ExtHostWindow
,
new
ExtHostWindow
(
threadService
));
threadService
.
set
(
ExtHostContext
.
ExtHostExtensionService
,
extensionService
);
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
4e78a42a
...
...
@@ -49,6 +49,7 @@ import { SerializedError } from 'vs/base/common/errors';
import
{
IWorkspaceFolderData
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
IStat
,
IFileChange
}
from
'
vs/platform/files/common/files
'
;
import
{
ConfigurationScope
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
ParsedArgs
}
from
'
vs/platform/environment/common/environment
'
;
export
interface
IEnvironment
{
isExtensionDevelopmentDebug
:
boolean
;
...
...
@@ -75,6 +76,8 @@ export interface IInitData {
extensions
:
IExtensionDescription
[];
configuration
:
IConfigurationInitData
;
telemetryInfo
:
ITelemetryInfo
;
args
:
ParsedArgs
;
execPath
:
string
;
}
export
interface
IConfigurationInitData
extends
IConfigurationData
{
...
...
src/vs/workbench/api/node/extHostCommands.ts
浏览文件 @
4e78a42a
...
...
@@ -15,6 +15,7 @@ import { ExtHostHeapService } from 'vs/workbench/api/node/extHostHeapService';
import
{
isFalsyOrEmpty
}
from
'
vs/base/common/arrays
'
;
import
*
as
modes
from
'
vs/editor/common/modes
'
;
import
*
as
vscode
from
'
vscode
'
;
import
{
ILogService
,
log
,
LogLevel
}
from
'
vs/platform/log/common/log
'
;
interface
CommandHandler
{
callback
:
Function
;
...
...
@@ -35,7 +36,9 @@ export class ExtHostCommands implements ExtHostCommandsShape {
constructor
(
mainContext
:
IMainContext
,
heapService
:
ExtHostHeapService
heapService
:
ExtHostHeapService
,
// @ts-ignore
@
ILogService
private
logService
:
ILogService
)
{
this
.
_proxy
=
mainContext
.
get
(
MainContext
.
MainThreadCommands
);
this
.
_converter
=
new
CommandsConverter
(
this
,
heapService
);
...
...
@@ -49,6 +52,7 @@ export class ExtHostCommands implements ExtHostCommandsShape {
this
.
_argumentProcessors
.
push
(
processor
);
}
@
log
(
LogLevel
.
TRACE
,
'
ExtHostCommands
'
,
(
msg
,
id
)
=>
`
${
msg
}
(
${
id
}
)`
)
registerCommand
(
id
:
string
,
callback
:
<
T
>
(...
args
:
any
[])
=>
T
|
Thenable
<
T
>
,
thisArg
?:
any
,
description
?:
ICommandHandlerDescription
):
extHostTypes
.
Disposable
{
if
(
!
id
.
trim
().
length
)
{
...
...
@@ -69,6 +73,7 @@ export class ExtHostCommands implements ExtHostCommandsShape {
});
}
@
log
(
LogLevel
.
TRACE
,
'
ExtHostCommands
'
,
(
msg
,
id
)
=>
`
${
msg
}
(
${
id
}
)`
)
executeCommand
<
T
>
(
id
:
string
,
...
args
:
any
[]):
Thenable
<
T
>
{
if
(
this
.
_commands
.
has
(
id
))
{
...
...
@@ -133,6 +138,7 @@ export class ExtHostCommands implements ExtHostCommandsShape {
}
}
@
log
(
LogLevel
.
TRACE
,
'
ExtHostCommands
'
,
(
msg
,
filterUnderscoreCommands
)
=>
`
${
msg
}
(
${
filterUnderscoreCommands
}
)`
)
getCommands
(
filterUnderscoreCommands
:
boolean
=
false
):
Thenable
<
string
[]
>
{
return
this
.
_proxy
.
$getCommands
().
then
(
result
=>
{
if
(
filterUnderscoreCommands
)
{
...
...
src/vs/workbench/api/node/extHostExtensionService.ts
浏览文件 @
4e78a42a
...
...
@@ -21,6 +21,7 @@ import { ExtHostWorkspace } from 'vs/workbench/api/node/extHostWorkspace';
import
{
realpath
}
from
'
fs
'
;
import
{
TernarySearchTree
}
from
'
vs/base/common/map
'
;
import
{
Barrier
}
from
'
vs/base/common/async
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
class
ExtensionMemento
implements
IExtensionMemento
{
...
...
@@ -125,7 +126,8 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
constructor
(
initData
:
IInitData
,
threadService
:
ExtHostThreadService
,
extHostWorkspace
:
ExtHostWorkspace
,
extHostConfiguration
:
ExtHostConfiguration
extHostConfiguration
:
ExtHostConfiguration
,
logService
:
ILogService
)
{
this
.
_barrier
=
new
Barrier
();
this
.
_registry
=
new
ExtensionDescriptionRegistry
(
initData
.
extensions
);
...
...
@@ -137,7 +139,7 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
this
.
_activator
=
null
;
// initialize API first (i.e. do not release barrier until the API is initialized)
const
apiFactory
=
createApiFactory
(
initData
,
threadService
,
extHostWorkspace
,
extHostConfiguration
,
this
);
const
apiFactory
=
createApiFactory
(
initData
,
threadService
,
extHostWorkspace
,
extHostConfiguration
,
this
,
logService
);
initializeExtensionApi
(
this
,
apiFactory
).
then
(()
=>
{
...
...
src/vs/workbench/api/node/extHostSCM.ts
浏览文件 @
4e78a42a
...
...
@@ -17,6 +17,7 @@ import { sortedDiff } from 'vs/base/common/arrays';
import
{
comparePaths
}
from
'
vs/base/common/comparers
'
;
import
*
as
vscode
from
'
vscode
'
;
import
{
ISplice
}
from
'
vs/base/common/sequence
'
;
import
{
log
,
LogLevel
,
ILogService
}
from
'
vs/platform/log/common/log
'
;
type
ProviderHandle
=
number
;
type
GroupHandle
=
number
;
...
...
@@ -443,7 +444,9 @@ export class ExtHostSCM {
constructor
(
mainContext
:
IMainContext
,
private
_commands
:
ExtHostCommands
private
_commands
:
ExtHostCommands
,
// @ts-ignore
@
ILogService
private
logService
:
ILogService
)
{
this
.
_proxy
=
mainContext
.
get
(
MainContext
.
MainThreadSCM
);
...
...
@@ -486,6 +489,7 @@ export class ExtHostSCM {
});
}
@
log
(
LogLevel
.
TRACE
,
'
ExtHostSCM
'
,
(
msg
,
extension
,
id
,
label
,
rootUri
)
=>
`
${
msg
}
(
${
extension
.
id
}
,
${
id
}
,
${
label
}
,
${
rootUri
}
)`
)
createSourceControl
(
extension
:
IExtensionDescription
,
id
:
string
,
label
:
string
,
rootUri
:
vscode
.
Uri
|
undefined
):
vscode
.
SourceControl
{
const
handle
=
ExtHostSCM
.
_handlePool
++
;
const
sourceControl
=
new
ExtHostSourceControl
(
this
.
_proxy
,
this
.
_commands
,
id
,
label
,
rootUri
);
...
...
@@ -499,6 +503,7 @@ export class ExtHostSCM {
}
// Deprecated
@
log
(
LogLevel
.
TRACE
,
'
ExtHostSCM
'
,
(
msg
,
extension
)
=>
`
${
msg
}
(
${
extension
.
id
}
)`
)
getLastInputBox
(
extension
:
IExtensionDescription
):
ExtHostSCMInputBox
{
const
sourceControls
=
this
.
_sourceControlsByExtension
.
get
(
extension
.
id
);
const
sourceControl
=
sourceControls
&&
sourceControls
[
sourceControls
.
length
-
1
];
...
...
@@ -507,6 +512,7 @@ export class ExtHostSCM {
return
inputBox
;
}
@
log
(
LogLevel
.
TRACE
,
'
ExtHostSCM
'
,
(
msg
,
handle
,
uri
)
=>
`
${
msg
}
(
${
handle
}
,
${
uri
}
)`
)
$provideOriginalResource
(
sourceControlHandle
:
number
,
uri
:
URI
):
TPromise
<
URI
>
{
const
sourceControl
=
this
.
_sourceControls
.
get
(
sourceControlHandle
);
...
...
@@ -520,6 +526,7 @@ export class ExtHostSCM {
});
}
@
log
(
LogLevel
.
TRACE
,
'
ExtHostSCM
'
,
(
msg
,
handle
)
=>
`
${
msg
}
(
${
handle
}
)`
)
$onInputBoxValueChange
(
sourceControlHandle
:
number
,
value
:
string
):
TPromise
<
void
>
{
const
sourceControl
=
this
.
_sourceControls
.
get
(
sourceControlHandle
);
...
...
@@ -531,6 +538,7 @@ export class ExtHostSCM {
return
TPromise
.
as
(
null
);
}
@
log
(
LogLevel
.
TRACE
,
'
ExtHostSCM
'
,
(
msg
,
h1
,
h2
,
h3
)
=>
`
${
msg
}
(
${
h1
}
,
${
h2
}
,
${
h3
}
)`
)
async
$executeResourceCommand
(
sourceControlHandle
:
number
,
groupHandle
:
number
,
handle
:
number
):
TPromise
<
void
>
{
const
sourceControl
=
this
.
_sourceControls
.
get
(
sourceControlHandle
);
...
...
src/vs/workbench/node/extensionHostMain.ts
浏览文件 @
4e78a42a
...
...
@@ -21,6 +21,8 @@ import { IInitData, IEnvironment, IWorkspaceData, MainContext } from 'vs/workben
import
*
as
errors
from
'
vs/base/common/errors
'
;
import
*
as
watchdog
from
'
native-watchdog
'
;
import
*
as
glob
from
'
vs/base/common/glob
'
;
import
{
EnvironmentService
}
from
'
vs/platform/environment/node/environmentService
'
;
import
{
SpdLogService
}
from
'
vs/platform/log/node/spdlogService
'
;
// const nativeExit = process.exit.bind(process);
function
patchProcess
(
allowExit
:
boolean
)
{
...
...
@@ -83,8 +85,11 @@ export class ExtensionHostMain {
// services
const
threadService
=
new
ExtHostThreadService
(
rpcProtocol
);
const
extHostWorkspace
=
new
ExtHostWorkspace
(
threadService
,
initData
.
workspace
);
const
environmentService
=
new
EnvironmentService
(
initData
.
args
,
initData
.
execPath
);
const
logService
=
new
SpdLogService
(
'
exthost
'
,
environmentService
);
this
.
_extHostConfiguration
=
new
ExtHostConfiguration
(
threadService
.
get
(
MainContext
.
MainThreadConfiguration
),
extHostWorkspace
,
initData
.
configuration
);
this
.
_extensionService
=
new
ExtHostExtensionService
(
initData
,
threadService
,
extHostWorkspace
,
this
.
_extHostConfiguration
);
this
.
_extensionService
=
new
ExtHostExtensionService
(
initData
,
threadService
,
extHostWorkspace
,
this
.
_extHostConfiguration
,
logService
);
// error forwarding and stack trace scanning
const
extensionErrors
=
new
WeakMap
<
Error
,
IExtensionDescription
>
();
...
...
src/vs/workbench/services/extensions/electron-browser/extensionHost.ts
浏览文件 @
4e78a42a
...
...
@@ -363,7 +363,9 @@ export class ExtensionHostProcessWorker {
extensions
:
extensionDescriptions
,
// Send configurations scopes only in development mode.
configuration
:
!
this
.
_environmentService
.
isBuilt
||
this
.
_environmentService
.
isExtensionDevelopment
?
{
...
configurationData
,
configurationScopes
:
getScopes
(
this
.
_configurationService
.
keys
().
default
)
}
:
configurationData
,
telemetryInfo
telemetryInfo
,
args
:
this
.
_environmentService
.
args
,
execPath
:
this
.
_environmentService
.
execPath
};
return
r
;
});
...
...
src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts
浏览文件 @
4e78a42a
...
...
@@ -32,6 +32,7 @@ import { ExtHostDiagnostics } from 'vs/workbench/api/node/extHostDiagnostics';
import
*
as
vscode
from
'
vscode
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
'
vs/workbench/parts/search/electron-browser/search.contribution
'
;
import
{
NoopLogService
}
from
'
vs/platform/log/common/log
'
;
const
defaultSelector
=
{
scheme
:
'
far
'
};
const
model
:
EditorCommon
.
IModel
=
EditorModel
.
createFromString
(
...
...
@@ -112,8 +113,9 @@ suite('ExtHostLanguageFeatureCommands', function () {
threadService
.
set
(
ExtHostContext
.
ExtHostDocuments
,
extHostDocuments
);
const
heapService
=
new
ExtHostHeapService
();
const
logService
=
new
NoopLogService
();
commands
=
new
ExtHostCommands
(
threadService
,
heapService
);
commands
=
new
ExtHostCommands
(
threadService
,
heapService
,
logService
);
threadService
.
set
(
ExtHostContext
.
ExtHostCommands
,
commands
);
threadService
.
setTestInstance
(
MainContext
.
MainThreadCommands
,
inst
.
createInstance
(
MainThreadCommands
,
threadService
));
ExtHostApiCommands
.
register
(
commands
);
...
...
src/vs/workbench/test/electron-browser/api/extHostCommands.test.ts
浏览文件 @
4e78a42a
...
...
@@ -12,6 +12,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
import
{
CommandsRegistry
}
from
'
vs/platform/commands/common/commands
'
;
import
{
OneGetThreadService
}
from
'
./testThreadService
'
;
import
{
mock
}
from
'
vs/workbench/test/electron-browser/api/mock
'
;
import
{
NoopLogService
}
from
'
vs/platform/log/common/log
'
;
suite
(
'
ExtHostCommands
'
,
function
()
{
...
...
@@ -29,7 +30,7 @@ suite('ExtHostCommands', function () {
}
};
const
commands
=
new
ExtHostCommands
(
OneGetThreadService
(
shape
),
undefined
);
const
commands
=
new
ExtHostCommands
(
OneGetThreadService
(
shape
),
undefined
,
new
NoopLogService
()
);
commands
.
registerCommand
(
'
foo
'
,
():
any
=>
{
}).
dispose
();
assert
.
equal
(
lastUnregister
,
'
foo
'
);
assert
.
equal
(
CommandsRegistry
.
getCommand
(
'
foo
'
),
undefined
);
...
...
@@ -50,7 +51,7 @@ suite('ExtHostCommands', function () {
}
};
const
commands
=
new
ExtHostCommands
(
OneGetThreadService
(
shape
),
undefined
);
const
commands
=
new
ExtHostCommands
(
OneGetThreadService
(
shape
),
undefined
,
new
NoopLogService
()
);
const
reg
=
commands
.
registerCommand
(
'
foo
'
,
():
any
=>
{
});
reg
.
dispose
();
reg
.
dispose
();
...
...
src/vs/workbench/test/electron-browser/api/extHostLanguageFeatures.test.ts
浏览文件 @
4e78a42a
...
...
@@ -44,6 +44,7 @@ import { ExtHostDiagnostics } from 'vs/workbench/api/node/extHostDiagnostics';
import
{
ExtHostHeapService
}
from
'
vs/workbench/api/node/extHostHeapService
'
;
import
*
as
vscode
from
'
vscode
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
NoopLogService
}
from
'
vs/platform/log/common/log
'
;
const
defaultSelector
=
{
scheme
:
'
far
'
};
const
model
:
EditorCommon
.
IModel
=
EditorModel
.
createFromString
(
...
...
@@ -102,7 +103,7 @@ suite('ExtHostLanguageFeatures', function () {
const
heapService
=
new
ExtHostHeapService
();
const
commands
=
new
ExtHostCommands
(
threadService
,
heapService
);
const
commands
=
new
ExtHostCommands
(
threadService
,
heapService
,
new
NoopLogService
()
);
threadService
.
set
(
ExtHostContext
.
ExtHostCommands
,
commands
);
threadService
.
setTestInstance
(
MainContext
.
MainThreadCommands
,
inst
.
createInstance
(
MainThreadCommands
,
threadService
));
...
...
src/vs/workbench/test/electron-browser/api/extHostTreeViews.test.ts
浏览文件 @
4e78a42a
...
...
@@ -17,6 +17,7 @@ import { TestInstantiationService } from 'vs/platform/instantiation/test/common/
import
{
MainThreadCommands
}
from
'
vs/workbench/api/electron-browser/mainThreadCommands
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
mock
}
from
'
vs/workbench/test/electron-browser/api/mock
'
;
import
{
NoopLogService
}
from
'
vs/platform/log/common/log
'
;
suite
(
'
ExtHostConfiguration
'
,
function
()
{
...
...
@@ -48,7 +49,7 @@ suite('ExtHostConfiguration', function () {
threadService
.
setTestInstance
(
MainContext
.
MainThreadCommands
,
inst
.
createInstance
(
MainThreadCommands
,
threadService
));
target
=
new
RecordingShape
();
testObject
=
new
ExtHostTreeViews
(
target
,
new
ExtHostCommands
(
threadService
,
new
ExtHostHeapService
()));
testObject
=
new
ExtHostTreeViews
(
target
,
new
ExtHostCommands
(
threadService
,
new
ExtHostHeapService
()
,
new
NoopLogService
()
));
onDidChangeTreeData
=
new
Emitter
<
string
>
();
testObject
.
registerTreeDataProvider
(
'
testDataProvider
'
,
aTreeDataProvider
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录