Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
4ecad471
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,发现更多精彩内容 >>
提交
4ecad471
编写于
12月 06, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixes #39806
上级
f71f52f6
变更
17
显示空白变更内容
内联
并排
Showing
17 changed file
with
59 addition
and
76 deletion
+59
-76
src/vs/code/electron-browser/sharedProcessMain.ts
src/vs/code/electron-browser/sharedProcessMain.ts
+1
-2
src/vs/code/electron-main/main.ts
src/vs/code/electron-main/main.ts
+1
-2
src/vs/code/node/cliProcessMain.ts
src/vs/code/node/cliProcessMain.ts
+1
-2
src/vs/platform/commands/common/commandService.ts
src/vs/platform/commands/common/commandService.ts
+5
-3
src/vs/platform/commands/test/commandService.test.ts
src/vs/platform/commands/test/commandService.test.ts
+7
-5
src/vs/platform/log/common/log.ts
src/vs/platform/log/common/log.ts
+0
-32
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/extHostCommands.ts
src/vs/workbench/api/node/extHostCommands.ts
+7
-5
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
+13
-7
src/vs/workbench/electron-browser/main.ts
src/vs/workbench/electron-browser/main.ts
+0
-2
src/vs/workbench/node/extensionHostMain.ts
src/vs/workbench/node/extensionHostMain.ts
+1
-4
src/vs/workbench/services/scm/common/scmService.ts
src/vs/workbench/services/scm/common/scmService.ts
+5
-2
src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts
...ench/test/electron-browser/api/extHostApiCommands.test.ts
+2
-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/code/electron-browser/sharedProcessMain.ts
浏览文件 @
4ecad471
...
...
@@ -36,7 +36,7 @@ import { ipcRenderer } from 'electron';
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
createSharedProcessContributions
}
from
'
vs/code/electron-browser/contrib/contributions
'
;
import
{
createLogService
}
from
'
vs/platform/log/node/spdlogService
'
;
import
{
ILogService
,
registerGlobalLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
export
interface
ISharedProcessConfiguration
{
readonly
machineId
:
string
;
...
...
@@ -81,7 +81,6 @@ function main(server: Server, initData: ISharedProcessInitData, configuration: I
const
environmentService
=
new
EnvironmentService
(
initData
.
args
,
process
.
execPath
);
const
logService
=
createLogService
(
'
sharedprocess
'
,
environmentService
);
process
.
once
(
'
exit
'
,
()
=>
logService
.
dispose
());
registerGlobalLogService
(
logService
);
logService
.
info
(
'
main
'
,
JSON
.
stringify
(
configuration
));
...
...
src/vs/code/electron-main/main.ts
浏览文件 @
4ecad471
...
...
@@ -21,7 +21,7 @@ import { ServicesAccessor, IInstantiationService } from 'vs/platform/instantiati
import
{
InstantiationService
}
from
'
vs/platform/instantiation/common/instantiationService
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
SyncDescriptor
}
from
'
vs/platform/instantiation/common/descriptors
'
;
import
{
ILogService
,
ConsoleLogMainService
,
MultiplexLogService
,
registerGlobalLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
ILogService
,
ConsoleLogMainService
,
MultiplexLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
StateService
}
from
'
vs/platform/state/node/stateService
'
;
import
{
IStateService
}
from
'
vs/platform/state/common/state
'
;
import
{
IBackupMainService
}
from
'
vs/platform/backup/common/backup
'
;
...
...
@@ -53,7 +53,6 @@ function createServices(args: ParsedArgs): IInstantiationService {
const
consoleLogService
=
new
ConsoleLogMainService
(
environmentService
);
const
logService
=
new
MultiplexLogService
([
consoleLogService
,
spdlogService
]);
registerGlobalLogService
(
logService
);
process
.
once
(
'
exit
'
,
()
=>
logService
.
dispose
());
// Eventually cleanup
...
...
src/vs/code/node/cliProcessMain.ts
浏览文件 @
4ecad471
...
...
@@ -36,7 +36,7 @@ import { getBaseLabel } from 'vs/base/common/labels';
import
{
IStateService
}
from
'
vs/platform/state/common/state
'
;
import
{
StateService
}
from
'
vs/platform/state/node/stateService
'
;
import
{
createLogService
}
from
'
vs/platform/log/node/spdlogService
'
;
import
{
registerGlobalLogService
,
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
isPromiseCanceledError
}
from
'
vs/base/common/errors
'
;
const
notFound
=
(
id
:
string
)
=>
localize
(
'
notFound
'
,
"
Extension '{0}' not found.
"
,
id
);
...
...
@@ -198,7 +198,6 @@ export function main(argv: ParsedArgs): TPromise<void> {
const
environmentService
=
new
EnvironmentService
(
argv
,
process
.
execPath
);
const
logService
=
createLogService
(
'
cli
'
,
environmentService
);
process
.
once
(
'
exit
'
,
()
=>
logService
.
dispose
());
registerGlobalLogService
(
logService
);
logService
.
info
(
'
main
'
,
argv
);
...
...
src/vs/platform/commands/common/commandService.ts
浏览文件 @
4ecad471
...
...
@@ -11,7 +11,7 @@ import { IExtensionService } from 'vs/platform/extensions/common/extensions';
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
log
,
LogLevel
}
from
'
vs/platform/log/common/log
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
export
class
CommandService
extends
Disposable
implements
ICommandService
{
...
...
@@ -25,14 +25,16 @@ export class CommandService extends Disposable implements ICommandService {
constructor
(
@
IInstantiationService
private
_instantiationService
:
IInstantiationService
,
@
IExtensionService
private
_extensionService
:
IExtensionService
,
@
IContextKeyService
private
_contextKeyService
:
IContextKeyService
@
IContextKeyService
private
_contextKeyService
:
IContextKeyService
,
@
ILogService
private
_logService
:
ILogService
)
{
super
();
this
.
_extensionService
.
whenInstalledExtensionsRegistered
().
then
(
value
=>
this
.
_extensionHostIsReady
=
value
);
}
@
log
(
LogLevel
.
Info
,
'
CommandService
'
,
(
msg
,
id
)
=>
`
${
msg
}
(
${
id
}
)`
)
executeCommand
<
T
>
(
id
:
string
,
...
args
:
any
[]):
TPromise
<
T
>
{
this
.
_logService
.
info
(
'
CommandService#executeCommand
'
,
id
);
// we always send an activation event, but
// we don't wait for it when the extension
// host didn't yet start and the command is already registered
...
...
src/vs/platform/commands/test/commandService.test.ts
浏览文件 @
4ecad471
...
...
@@ -16,6 +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
{
NoopLogService
}
from
'
vs/platform/log/common/log
'
;
class
SimpleExtensionService
implements
IExtensionService
{
_serviceBrand
:
any
;
...
...
@@ -74,7 +75,7 @@ suite('CommandService', function () {
lastEvent
=
activationEvent
;
return
super
.
activateByEvent
(
activationEvent
);
}
},
new
ContextKeyService
(
new
SimpleConfigurationService
()));
},
new
ContextKeyService
(
new
SimpleConfigurationService
())
,
new
NoopLogService
()
);
return
service
.
executeCommand
(
'
foo
'
).
then
(()
=>
{
assert
.
ok
(
lastEvent
,
'
onCommand:foo
'
);
...
...
@@ -92,7 +93,7 @@ suite('CommandService', function () {
activateByEvent
(
activationEvent
:
string
):
TPromise
<
void
>
{
return
TPromise
.
wrapError
<
void
>
(
new
Error
(
'
bad_activate
'
));
}
},
new
ContextKeyService
(
new
SimpleConfigurationService
()));
},
new
ContextKeyService
(
new
SimpleConfigurationService
())
,
new
NoopLogService
()
);
return
service
.
executeCommand
(
'
foo
'
).
then
(()
=>
assert
.
ok
(
false
),
err
=>
{
assert
.
equal
(
err
.
message
,
'
bad_activate
'
);
...
...
@@ -108,7 +109,7 @@ suite('CommandService', function () {
whenInstalledExtensionsRegistered
()
{
return
new
TPromise
<
boolean
>
(
_resolve
=>
{
/*ignore*/
});
}
},
new
ContextKeyService
(
new
SimpleConfigurationService
()));
},
new
ContextKeyService
(
new
SimpleConfigurationService
())
,
new
NoopLogService
()
);
service
.
executeCommand
(
'
bar
'
);
assert
.
equal
(
callCounter
,
1
);
...
...
@@ -125,7 +126,7 @@ suite('CommandService', function () {
whenInstalledExtensionsRegistered
()
{
return
new
TPromise
<
boolean
>
(
_resolve
=>
{
resolveFunc
=
_resolve
;
});
}
},
new
ContextKeyService
(
new
SimpleConfigurationService
()));
},
new
ContextKeyService
(
new
SimpleConfigurationService
())
,
new
NoopLogService
()
);
let
r
=
service
.
executeCommand
(
'
bar
'
);
assert
.
equal
(
callCounter
,
0
);
...
...
@@ -144,7 +145,8 @@ suite('CommandService', function () {
let
commandService
=
new
CommandService
(
new
InstantiationService
(),
new
SimpleExtensionService
(),
contextKeyService
contextKeyService
,
new
NoopLogService
()
);
let
counter
=
0
;
...
...
src/vs/platform/log/common/log.ts
浏览文件 @
4ecad471
...
...
@@ -7,7 +7,6 @@
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
createDecorator
as
createServiceDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
createDecorator
}
from
'
vs/base/common/decorators
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
isWindows
}
from
'
vs/base/common/platform
'
;
...
...
@@ -193,34 +192,3 @@ export class NoopLogService implements ILogService {
critical
(
message
:
string
|
Error
,
...
args
:
any
[]):
void
{
}
dispose
():
void
{
}
}
let
globalLogService
:
ILogService
=
new
NoopLogService
();
export
function
registerGlobalLogService
(
logService
:
ILogService
):
void
{
globalLogService
=
logService
;
}
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
}
`
;
if
(
logFn
)
{
message
=
logFn
(
message
,
...
args
);
}
switch
(
level
)
{
case
LogLevel
.
Trace
:
globalLogService
.
trace
(
message
);
break
;
case
LogLevel
.
Debug
:
globalLogService
.
debug
(
message
);
break
;
case
LogLevel
.
Info
:
globalLogService
.
info
(
message
);
break
;
case
LogLevel
.
Warning
:
globalLogService
.
warn
(
message
);
break
;
case
LogLevel
.
Error
:
globalLogService
.
error
(
message
);
break
;
case
LogLevel
.
Critical
:
globalLogService
.
critical
(
message
);
break
;
}
return
fn
.
apply
(
this
,
args
);
};
});
}
\ No newline at end of file
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
4ecad471
...
...
@@ -58,6 +58,7 @@ import { ExtHostDecorations } from 'vs/workbench/api/node/extHostDecorations';
import
{
toGlobPattern
,
toLanguageSelector
}
from
'
vs/workbench/api/node/extHostTypeConverters
'
;
import
{
ExtensionActivatedByAPI
}
from
'
vs/workbench/api/node/extHostExtensionActivator
'
;
import
{
isFalsyOrEmpty
}
from
'
vs/base/common/arrays
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
export
interface
IExtensionApiFactory
{
(
extension
:
IExtensionDescription
):
typeof
vscode
;
...
...
@@ -81,7 +82,8 @@ export function createApiFactory(
threadService
:
ExtHostThreadService
,
extHostWorkspace
:
ExtHostWorkspace
,
extHostConfiguration
:
ExtHostConfiguration
,
extensionService
:
ExtHostExtensionService
extensionService
:
ExtHostExtensionService
,
logService
:
ILogService
):
IExtensionApiFactory
{
// Addressable instances
...
...
@@ -92,7 +94,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
));
...
...
@@ -103,7 +105,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/extHostCommands.ts
浏览文件 @
4ecad471
...
...
@@ -15,7 +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
{
log
,
LogLevel
}
from
'
vs/platform/log/common/log
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
interface
CommandHandler
{
callback
:
Function
;
...
...
@@ -36,7 +36,8 @@ export class ExtHostCommands implements ExtHostCommandsShape {
constructor
(
mainContext
:
IMainContext
,
heapService
:
ExtHostHeapService
heapService
:
ExtHostHeapService
,
private
logService
:
ILogService
)
{
this
.
_proxy
=
mainContext
.
get
(
MainContext
.
MainThreadCommands
);
this
.
_converter
=
new
CommandsConverter
(
this
,
heapService
);
...
...
@@ -50,8 +51,8 @@ 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
{
this
.
logService
.
trace
(
'
ExtHostCommands#registerCommand
'
,
id
);
if
(
!
id
.
trim
().
length
)
{
throw
new
Error
(
'
invalid id
'
);
...
...
@@ -71,8 +72,8 @@ export class ExtHostCommands implements ExtHostCommandsShape {
});
}
@
log
(
LogLevel
.
Trace
,
'
ExtHostCommands
'
,
(
msg
,
id
)
=>
`
${
msg
}
(
${
id
}
)`
)
executeCommand
<
T
>
(
id
:
string
,
...
args
:
any
[]):
Thenable
<
T
>
{
this
.
logService
.
trace
(
'
ExtHostCommands#executeCommand
'
,
id
);
if
(
this
.
_commands
.
has
(
id
))
{
// we stay inside the extension host and support
...
...
@@ -136,8 +137,9 @@ export class ExtHostCommands implements ExtHostCommandsShape {
}
}
@
log
(
LogLevel
.
Trace
,
'
ExtHostCommands
'
,
(
msg
,
filterUnderscoreCommands
)
=>
`
${
msg
}
(
${
filterUnderscoreCommands
}
)`
)
getCommands
(
filterUnderscoreCommands
:
boolean
=
false
):
Thenable
<
string
[]
>
{
this
.
logService
.
trace
(
'
ExtHostCommands#getCommands
'
,
filterUnderscoreCommands
);
return
this
.
_proxy
.
$getCommands
().
then
(
result
=>
{
if
(
filterUnderscoreCommands
)
{
result
=
result
.
filter
(
command
=>
command
[
0
]
!==
'
_
'
);
...
...
src/vs/workbench/api/node/extHostExtensionService.ts
浏览文件 @
4ecad471
...
...
@@ -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
浏览文件 @
4ecad471
...
...
@@ -17,7 +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
}
from
'
vs/platform/log/common/log
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
type
ProviderHandle
=
number
;
type
GroupHandle
=
number
;
...
...
@@ -444,7 +444,8 @@ export class ExtHostSCM {
constructor
(
mainContext
:
IMainContext
,
private
_commands
:
ExtHostCommands
private
_commands
:
ExtHostCommands
,
@
ILogService
private
logService
:
ILogService
)
{
this
.
_proxy
=
mainContext
.
get
(
MainContext
.
MainThreadSCM
);
...
...
@@ -487,8 +488,9 @@ 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
{
this
.
logService
.
trace
(
'
ExtHostSCM#createSourceControl
'
,
extension
.
id
,
id
,
label
,
rootUri
);
const
handle
=
ExtHostSCM
.
_handlePool
++
;
const
sourceControl
=
new
ExtHostSourceControl
(
this
.
_proxy
,
this
.
_commands
,
id
,
label
,
rootUri
);
this
.
_sourceControls
.
set
(
handle
,
sourceControl
);
...
...
@@ -501,8 +503,9 @@ export class ExtHostSCM {
}
// Deprecated
@
log
(
LogLevel
.
Trace
,
'
ExtHostSCM
'
,
(
msg
,
extension
)
=>
`
${
msg
}
(
${
extension
.
id
}
)`
)
getLastInputBox
(
extension
:
IExtensionDescription
):
ExtHostSCMInputBox
{
this
.
logService
.
trace
(
'
ExtHostSCM#getLastInputBox
'
,
extension
.
id
);
const
sourceControls
=
this
.
_sourceControlsByExtension
.
get
(
extension
.
id
);
const
sourceControl
=
sourceControls
&&
sourceControls
[
sourceControls
.
length
-
1
];
const
inputBox
=
sourceControl
&&
sourceControl
.
inputBox
;
...
...
@@ -510,8 +513,9 @@ export class ExtHostSCM {
return
inputBox
;
}
@
log
(
LogLevel
.
Trace
,
'
ExtHostSCM
'
,
(
msg
,
handle
,
uri
)
=>
`
${
msg
}
(
${
handle
}
,
${
uri
}
)`
)
$provideOriginalResource
(
sourceControlHandle
:
number
,
uri
:
URI
):
TPromise
<
URI
>
{
this
.
logService
.
trace
(
'
ExtHostSCM#$provideOriginalResource
'
,
sourceControlHandle
,
uri
);
const
sourceControl
=
this
.
_sourceControls
.
get
(
sourceControlHandle
);
if
(
!
sourceControl
||
!
sourceControl
.
quickDiffProvider
)
{
...
...
@@ -524,8 +528,9 @@ export class ExtHostSCM {
});
}
@
log
(
LogLevel
.
Trace
,
'
ExtHostSCM
'
,
(
msg
,
handle
)
=>
`
${
msg
}
(
${
handle
}
)`
)
$onInputBoxValueChange
(
sourceControlHandle
:
number
,
value
:
string
):
TPromise
<
void
>
{
this
.
logService
.
trace
(
'
ExtHostSCM#$onInputBoxValueChange
'
,
sourceControlHandle
);
const
sourceControl
=
this
.
_sourceControls
.
get
(
sourceControlHandle
);
if
(
!
sourceControl
)
{
...
...
@@ -536,8 +541,9 @@ 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
>
{
this
.
logService
.
trace
(
'
ExtHostSCM#$executeResourceCommand
'
,
sourceControlHandle
,
groupHandle
,
handle
);
const
sourceControl
=
this
.
_sourceControls
.
get
(
sourceControlHandle
);
if
(
!
sourceControl
)
{
...
...
src/vs/workbench/electron-browser/main.ts
浏览文件 @
4ecad471
...
...
@@ -42,7 +42,6 @@ import { IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
import
{
createLogService
}
from
'
vs/platform/log/node/spdlogService
'
;
import
fs
=
require
(
'
fs
'
);
import
{
registerGlobalLogService
}
from
'
vs/platform/log/common/log
'
;
gracefulFs
.
gracefulify
(
fs
);
// enable gracefulFs
const
currentWindowId
=
remote
.
getCurrentWindow
().
id
;
...
...
@@ -75,7 +74,6 @@ function openWorkbench(configuration: IWindowConfiguration): TPromise<void> {
const
environmentService
=
new
EnvironmentService
(
configuration
,
configuration
.
execPath
);
const
logService
=
createLogService
(
`renderer
${
currentWindowId
}
`
,
environmentService
);
registerGlobalLogService
(
logService
);
logService
.
info
(
'
openWorkbench
'
,
JSON
.
stringify
(
configuration
));
...
...
src/vs/workbench/node/extensionHostMain.ts
浏览文件 @
4ecad471
...
...
@@ -24,7 +24,6 @@ import * as glob from 'vs/base/common/glob';
import
{
ExtensionActivatedByEvent
}
from
'
vs/workbench/api/node/extHostExtensionActivator
'
;
import
{
EnvironmentService
}
from
'
vs/platform/environment/node/environmentService
'
;
import
{
createLogService
}
from
'
vs/platform/log/node/spdlogService
'
;
import
{
registerGlobalLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
// const nativeExit = process.exit.bind(process);
...
...
@@ -91,15 +90,13 @@ export class ExtensionHostMain {
const
extHostWorkspace
=
new
ExtHostWorkspace
(
threadService
,
initData
.
workspace
);
const
environmentService
=
new
EnvironmentService
(
initData
.
args
,
initData
.
execPath
);
const
logService
=
createLogService
(
`exthost
${
initData
.
windowId
}
`
,
environmentService
);
registerGlobalLogService
(
logService
);
this
.
disposables
.
push
(
logService
);
logService
.
info
(
'
extension host started
'
);
logService
.
trace
(
'
initData
'
,
initData
);
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/scm/common/scmService.ts
浏览文件 @
4ecad471
...
...
@@ -8,7 +8,7 @@
import
{
IDisposable
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
ISCMService
,
ISCMProvider
,
ISCMInput
,
ISCMRepository
}
from
'
./scm
'
;
import
{
log
,
LogLevel
}
from
'
vs/platform/log/common/log
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
class
SCMInput
implements
ISCMInput
{
...
...
@@ -77,8 +77,11 @@ export class SCMService implements ISCMService {
private
_onDidRemoveProvider
=
new
Emitter
<
ISCMRepository
>
();
get
onDidRemoveRepository
():
Event
<
ISCMRepository
>
{
return
this
.
_onDidRemoveProvider
.
event
;
}
@
log
(
LogLevel
.
Info
,
'
SCMService
'
)
constructor
(
@
ILogService
private
logService
:
ILogService
)
{
}
registerSCMProvider
(
provider
:
ISCMProvider
):
ISCMRepository
{
this
.
logService
.
info
(
'
SCMService#registerSCMProvider
'
);
if
(
this
.
_providerIds
.
has
(
provider
.
id
))
{
throw
new
Error
(
`SCM Provider
${
provider
.
id
}
already exists.`
);
}
...
...
src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts
浏览文件 @
4ecad471
...
...
@@ -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
(
...
...
@@ -113,7 +114,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
const
heapService
=
new
ExtHostHeapService
();
commands
=
new
ExtHostCommands
(
threadService
,
heapService
);
commands
=
new
ExtHostCommands
(
threadService
,
heapService
,
new
NoopLogService
()
);
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
浏览文件 @
4ecad471
...
...
@@ -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
浏览文件 @
4ecad471
...
...
@@ -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
浏览文件 @
4ecad471
...
...
@@ -19,6 +19,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
{
mock
}
from
'
vs/workbench/test/electron-browser/api/mock
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
TreeItemCollapsibleState
,
ITreeItem
}
from
'
vs/workbench/common/views
'
;
import
{
NoopLogService
}
from
'
vs/platform/log/common/log
'
;
suite
(
'
ExtHostTreeView
'
,
function
()
{
...
...
@@ -65,7 +66,7 @@ suite('ExtHostTreeView', 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
()
));
onDidChangeTreeNode
=
new
Emitter
<
{
key
:
string
}
>
();
onDidChangeTreeKey
=
new
Emitter
<
string
>
();
testObject
.
registerTreeDataProvider
(
'
testNodeTreeProvider
'
,
aNodeTreeDataProvider
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录