Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
2700f41d
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,发现更多精彩内容 >>
提交
2700f41d
编写于
8月 12, 2019
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use desktop and web ext host logging service
上级
493d512f
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
160 addition
and
35 deletion
+160
-35
src/vs/workbench/api/common/extHost.api.impl.ts
src/vs/workbench/api/common/extHost.api.impl.ts
+3
-8
src/vs/workbench/api/common/extHostExtensionService.ts
src/vs/workbench/api/common/extHostExtensionService.ts
+11
-12
src/vs/workbench/api/node/extHost.services.ts
src/vs/workbench/api/node/extHost.services.ts
+3
-0
src/vs/workbench/api/node/extHostExtensionService.ts
src/vs/workbench/api/node/extHostExtensionService.ts
+2
-2
src/vs/workbench/api/node/extHostLogService.ts
src/vs/workbench/api/node/extHostLogService.ts
+36
-0
src/vs/workbench/api/worker/extHostLogService.ts
src/vs/workbench/api/worker/extHostLogService.ts
+84
-0
src/vs/workbench/services/extensions/common/extensionHostMain.ts
...workbench/services/extensions/common/extensionHostMain.ts
+5
-6
src/vs/workbench/services/extensions/node/proxyResolver.ts
src/vs/workbench/services/extensions/node/proxyResolver.ts
+5
-5
src/vs/workbench/services/extensions/worker/extHost.services.ts
.../workbench/services/extensions/worker/extHost.services.ts
+3
-2
tslint.json
tslint.json
+8
-0
未找到文件。
src/vs/workbench/api/common/extHost.api.impl.ts
浏览文件 @
2700f41d
...
...
@@ -15,7 +15,7 @@ import { OverviewRulerLane } from 'vs/editor/common/model';
import
*
as
languageConfiguration
from
'
vs/editor/common/modes/languageConfiguration
'
;
import
{
score
}
from
'
vs/editor/common/modes/languageSelector
'
;
import
*
as
files
from
'
vs/platform/files/common/files
'
;
import
{
ExtHostContext
,
MainContext
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
ExtHostContext
,
MainContext
,
ExtHostLogServiceShape
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
ExtHostApiCommands
}
from
'
vs/workbench/api/common/extHostApiCommands
'
;
import
{
ExtHostClipboard
}
from
'
vs/workbench/api/common/extHostClipboard
'
;
import
{
IExtHostCommands
}
from
'
vs/workbench/api/common/extHostCommands
'
;
...
...
@@ -33,7 +33,6 @@ import { ExtHostFileSystem } from 'vs/workbench/api/common/extHostFileSystem';
import
{
ExtHostFileSystemEventService
}
from
'
vs/workbench/api/common/extHostFileSystemEventService
'
;
import
{
ExtHostLanguageFeatures
}
from
'
vs/workbench/api/common/extHostLanguageFeatures
'
;
import
{
ExtHostLanguages
}
from
'
vs/workbench/api/common/extHostLanguages
'
;
import
{
ExtHostLogService
}
from
'
vs/workbench/api/common/extHostLogService
'
;
import
{
ExtHostMessageService
}
from
'
vs/workbench/api/common/extHostMessageService
'
;
import
{
IExtHostOutputService
}
from
'
vs/workbench/api/common/extHostOutput
'
;
import
{
ExtHostProgress
}
from
'
vs/workbench/api/common/extHostProgress
'
;
...
...
@@ -95,10 +94,10 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
const
uriTransformer
=
accessor
.
get
(
IURITransformerService
);
const
rpcProtocol
=
accessor
.
get
(
IExtHostRpcService
);
const
extHostStorage
=
accessor
.
get
(
IExtHostStorage
);
const
extHostLogService
=
<
ExtHostLogService
>
accessor
.
get
(
ILogService
);
const
extHostLogService
=
accessor
.
get
(
ILogService
);
// register addressable instances
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostLogService
,
extHostLogService
);
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostLogService
,
<
ExtHostLogServiceShape
><
any
>
extHostLogService
);
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostWorkspace
,
extHostWorkspace
);
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostConfiguration
,
extHostConfiguration
);
rpcProtocol
.
set
(
ExtHostContext
.
ExtHostExtensionService
,
extensionService
);
...
...
@@ -145,10 +144,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
const
extHostStatusBar
=
new
ExtHostStatusBar
(
rpcProtocol
);
const
extHostLanguages
=
new
ExtHostLanguages
(
rpcProtocol
,
extHostDocuments
);
// Register an output channel for exthost log
const
outputChannelName
=
initData
.
remote
.
isRemote
?
nls
.
localize
(
'
remote extension host Log
'
,
"
Remote Extension Host
"
)
:
nls
.
localize
(
'
extension host Log
'
,
"
Extension Host
"
);
extHostOutputService
.
createOutputChannelFromLogFile
(
outputChannelName
,
extHostLogService
.
logFile
);
// Register API-ish commands
ExtHostApiCommands
.
register
(
extHostCommands
);
...
...
src/vs/workbench/api/common/extHostExtensionService.ts
浏览文件 @
2700f41d
...
...
@@ -14,7 +14,6 @@ import { ILogService } from 'vs/platform/log/common/log';
import
{
ExtHostExtensionServiceShape
,
IInitData
,
MainContext
,
MainThreadExtensionServiceShape
,
MainThreadTelemetryShape
,
MainThreadWorkspaceShape
,
IResolveAuthorityResult
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
ExtHostConfiguration
,
IExtHostConfiguration
}
from
'
vs/workbench/api/common/extHostConfiguration
'
;
import
{
ActivatedExtension
,
EmptyExtension
,
ExtensionActivatedByAPI
,
ExtensionActivatedByEvent
,
ExtensionActivationReason
,
ExtensionActivationTimes
,
ExtensionActivationTimesBuilder
,
ExtensionsActivator
,
IExtensionAPI
,
IExtensionContext
,
IExtensionModule
,
HostExtension
,
ExtensionActivationTimesFragment
}
from
'
vs/workbench/api/common/extHostExtensionActivator
'
;
import
{
ExtHostLogService
}
from
'
vs/workbench/api/common/extHostLogService
'
;
import
{
ExtHostStorage
,
IExtHostStorage
}
from
'
vs/workbench/api/common/extHostStorage
'
;
import
{
ExtHostWorkspace
,
IExtHostWorkspace
}
from
'
vs/workbench/api/common/extHostWorkspace
'
;
import
{
ExtensionActivationError
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
...
...
@@ -75,7 +74,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
protected
readonly
_instaService
:
IInstantiationService
;
protected
readonly
_extHostWorkspace
:
ExtHostWorkspace
;
protected
readonly
_extHostConfiguration
:
ExtHostConfiguration
;
protected
readonly
_
extHostLogService
:
ExtHost
LogService
;
protected
readonly
_
logService
:
I
LogService
;
protected
readonly
_mainThreadWorkspaceProxy
:
MainThreadWorkspaceShape
;
protected
readonly
_mainThreadTelemetryProxy
:
MainThreadTelemetryShape
;
...
...
@@ -102,7 +101,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
@
IExtHostRpcService
extHostContext
:
IExtHostRpcService
,
@
IExtHostWorkspace
extHostWorkspace
:
IExtHostWorkspace
,
@
IExtHostConfiguration
extHostConfiguration
:
IExtHostConfiguration
,
@
ILogService
extHostLogService
:
ExtHost
LogService
,
@
ILogService
logService
:
I
LogService
,
@
IExtHostInitDataService
initData
:
IExtHostInitDataService
,
@
IExtensionStoragePaths
storagePath
:
IExtensionStoragePaths
)
{
...
...
@@ -112,7 +111,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
this
.
_extHostWorkspace
=
extHostWorkspace
;
this
.
_extHostConfiguration
=
extHostConfiguration
;
this
.
_
extHostLogService
=
extHostL
ogService
;
this
.
_
logService
=
l
ogService
;
this
.
_disposables
=
new
DisposableStore
();
this
.
_mainThreadWorkspaceProxy
=
this
.
_extHostContext
.
getProxy
(
MainContext
.
MainThreadWorkspace
);
...
...
@@ -329,14 +328,14 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
return
Promise
.
resolve
(
new
EmptyExtension
(
ExtensionActivationTimes
.
NONE
));
}
this
.
_
extHostL
ogService
.
info
(
`ExtensionService#_doActivateExtension
${
extensionDescription
.
identifier
.
value
}
${
JSON
.
stringify
(
reason
)}
`
);
this
.
_
l
ogService
.
info
(
`ExtensionService#_doActivateExtension
${
extensionDescription
.
identifier
.
value
}
${
JSON
.
stringify
(
reason
)}
`
);
const
activationTimesBuilder
=
new
ExtensionActivationTimesBuilder
(
reason
.
startup
);
return
Promise
.
all
<
any
>
([
this
.
_loadCommonJSModule
(
extensionDescription
.
main
,
activationTimesBuilder
),
this
.
_loadExtensionContext
(
extensionDescription
)
]).
then
(
values
=>
{
return
AbstractExtHostExtensionService
.
_callActivate
(
this
.
_
extHostL
ogService
,
extensionDescription
.
identifier
,
<
IExtensionModule
>
values
[
0
],
<
IExtensionContext
>
values
[
1
],
activationTimesBuilder
);
return
AbstractExtHostExtensionService
.
_callActivate
(
this
.
_
l
ogService
,
extensionDescription
.
identifier
,
<
IExtensionModule
>
values
[
0
],
<
IExtensionContext
>
values
[
1
],
activationTimesBuilder
);
});
}
...
...
@@ -347,7 +346,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
const
globalState
=
new
ExtensionMemento
(
extensionDescription
.
identifier
.
value
,
true
,
this
.
_storage
);
const
workspaceState
=
new
ExtensionMemento
(
extensionDescription
.
identifier
.
value
,
false
,
this
.
_storage
);
this
.
_
extHostL
ogService
.
trace
(
`ExtensionService#loadExtensionContext
${
extensionDescription
.
identifier
.
value
}
`
);
this
.
_
l
ogService
.
trace
(
`ExtensionService#loadExtensionContext
${
extensionDescription
.
identifier
.
value
}
`
);
return
Promise
.
all
([
globalState
.
whenReady
,
workspaceState
.
whenReady
,
...
...
@@ -359,10 +358,10 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
workspaceState
,
subscriptions
:
[],
get
extensionPath
()
{
return
extensionDescription
.
extensionLocation
.
fsPath
;
},
storagePath
:
this
.
_storagePath
.
workspaceValue
(
extensionDescription
)
,
g
lobalStoragePath
:
this
.
_storagePath
.
globalValue
(
extensionDescription
)
,
get
storagePath
()
{
return
that
.
_storagePath
.
workspaceValue
(
extensionDescription
);
}
,
g
et
globalStoragePath
()
{
return
that
.
_storagePath
.
globalValue
(
extensionDescription
);
}
,
asAbsolutePath
:
(
relativePath
:
string
)
=>
{
return
path
.
join
(
extensionDescription
.
extensionLocation
.
fsPath
,
relativePath
);
},
logPath
:
that
.
_extHostLogService
.
getLogDirectory
(
extensionDescription
.
identifier
)
,
get
logPath
()
{
return
path
.
join
(
that
.
_initData
.
logsLocation
.
fsPath
,
extensionDescription
.
identifier
.
value
);
}
,
executionContext
:
this
.
_initData
.
remote
.
isRemote
?
ExtensionExecutionContext
.
Remote
:
ExtensionExecutionContext
.
Local
,
});
});
...
...
@@ -479,7 +478,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
}
private
async
_activateIfGlobPatterns
(
folders
:
ReadonlyArray
<
vscode
.
WorkspaceFolder
>
,
extensionId
:
ExtensionIdentifier
,
globPatterns
:
string
[]):
Promise
<
void
>
{
this
.
_
extHostL
ogService
.
trace
(
`extensionHostMain#activateIfGlobPatterns: fileSearch, extension:
${
extensionId
.
value
}
, entryPoint: workspaceContains`
);
this
.
_
l
ogService
.
trace
(
`extensionHostMain#activateIfGlobPatterns: fileSearch, extension:
${
extensionId
.
value
}
, entryPoint: workspaceContains`
);
if
(
globPatterns
.
length
===
0
)
{
return
Promise
.
resolve
(
undefined
);
...
...
@@ -606,7 +605,7 @@ export abstract class AbstractExtHostExtensionService implements ExtHostExtensio
.
then
(()
=>
this
.
_handleEagerExtensions
())
.
then
(()
=>
this
.
_handleExtensionTests
())
.
then
(()
=>
{
this
.
_
extHostL
ogService
.
info
(
`eager extensions activated`
);
this
.
_
l
ogService
.
info
(
`eager extensions activated`
);
});
}
...
...
src/vs/workbench/api/node/extHost.services.ts
浏览文件 @
2700f41d
...
...
@@ -24,8 +24,11 @@ import { IExtensionStoragePaths } from 'vs/workbench/api/common/extHostStoragePa
import
{
IExtHostExtensionService
}
from
'
vs/workbench/api/common/extHostExtensionService
'
;
import
{
ExtHostExtensionService
}
from
'
vs/workbench/api/node/extHostExtensionService
'
;
import
{
IExtHostStorage
,
ExtHostStorage
}
from
'
vs/workbench/api/common/extHostStorage
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
ExtHostLogService
}
from
'
vs/workbench/api/node/extHostLogService
'
;
// register singleton services
registerSingleton
(
ILogService
,
ExtHostLogService
);
registerSingleton
(
IExtHostOutputService
,
ExtHostOutputService2
);
registerSingleton
(
IExtHostWorkspace
,
ExtHostWorkspace
);
registerSingleton
(
IExtHostDecorations
,
ExtHostDecorations
);
...
...
src/vs/workbench/api/node/extHostExtensionService.ts
浏览文件 @
2700f41d
...
...
@@ -41,14 +41,14 @@ export class ExtHostExtensionService extends AbstractExtHostExtensionService {
}
// Do this when extension service exists, but extensions are not being activated yet.
await
connectProxyResolver
(
this
.
_extHostWorkspace
,
configProvider
,
this
,
this
.
_
extHostL
ogService
,
this
.
_mainThreadTelemetryProxy
);
await
connectProxyResolver
(
this
.
_extHostWorkspace
,
configProvider
,
this
,
this
.
_
l
ogService
,
this
.
_mainThreadTelemetryProxy
);
}
protected
_loadCommonJSModule
<
T
>
(
modulePath
:
string
,
activationTimesBuilder
:
ExtensionActivationTimesBuilder
):
Promise
<
T
>
{
let
r
:
T
|
null
=
null
;
activationTimesBuilder
.
codeLoadingStart
();
this
.
_
extHostL
ogService
.
info
(
`ExtensionService#loadCommonJSModule
${
modulePath
}
`
);
this
.
_
l
ogService
.
info
(
`ExtensionService#loadCommonJSModule
${
modulePath
}
`
);
try
{
r
=
require
.
__$__nodeRequire
<
T
>
(
modulePath
);
}
catch
(
e
)
{
...
...
src/vs/workbench/api/
common
/extHostLogService.ts
→
src/vs/workbench/api/
node
/extHostLogService.ts
浏览文件 @
2700f41d
...
...
@@ -3,32 +3,34 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
localize
}
from
'
vs/nls
'
;
import
{
join
}
from
'
vs/base/common/path
'
;
import
{
ILogService
,
DelegatedLogService
,
LogLevel
}
from
'
vs/platform/log/common/log
'
;
import
{
ExtHostLogServiceShape
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
ExtensionHostLogFileName
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
ExtensionIdentifier
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
IExtHostInitDataService
}
from
'
vs/workbench/api/common/extHostInitDataService
'
;
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
SpdLogService
}
from
'
vs/platform/log/node/spdlogService
'
;
import
{
IExtHostOutputService
}
from
'
vs/workbench/api/common/extHostOutput
'
;
export
class
ExtHostLogService
extends
DelegatedLogService
implements
ILogService
,
ExtHostLogServiceShape
{
private
_logsPath
:
string
;
readonly
logFile
:
URI
;
constructor
(
delegate
:
ILog
Service
,
logsPath
:
string
,
@
IExtHostInitDataService
initData
:
IExtHostInitData
Service
,
@
IExtHostOutputService
extHostOutputService
:
IExtHostOutputService
)
{
super
(
delegate
);
this
.
_logsPath
=
logsPath
;
this
.
logFile
=
URI
.
file
(
join
(
logsPath
,
`
${
ExtensionHostLogFileName
}
.log`
));
if
(
initData
.
logsLocation
.
scheme
!==
Schemas
.
file
)
{
throw
new
Error
(
'
Only file-logging supported
'
);
}
super
(
new
SpdLogService
(
ExtensionHostLogFileName
,
initData
.
logsLocation
.
fsPath
,
initData
.
logLevel
));
// Register an output channel for exthost log
extHostOutputService
.
createOutputChannelFromLogFile
(
initData
.
remote
.
isRemote
?
localize
(
'
remote extension host Log
'
,
"
Remote Extension Host
"
)
:
localize
(
'
extension host Log
'
,
"
Extension Host
"
),
URI
.
file
(
join
(
initData
.
logsLocation
.
fsPath
,
`
${
ExtensionHostLogFileName
}
.log`
))
);
}
$setLevel
(
level
:
LogLevel
):
void
{
this
.
setLevel
(
level
);
}
getLogDirectory
(
extensionID
:
ExtensionIdentifier
):
string
{
return
join
(
this
.
_logsPath
,
extensionID
.
value
);
}
}
src/vs/workbench/api/worker/extHostLogService.ts
0 → 100644
浏览文件 @
2700f41d
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
ILogService
,
LogLevel
,
AbstractLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
ExtHostLogServiceShape
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
IExtHostInitDataService
}
from
'
vs/workbench/api/common/extHostInitDataService
'
;
import
{
IExtHostOutputService
}
from
'
vs/workbench/api/common/extHostOutput
'
;
import
*
as
vscode
from
'
vscode
'
;
export
class
ExtHostLogService
extends
AbstractLogService
implements
ILogService
,
ExtHostLogServiceShape
{
_serviceBrand
:
any
;
private
readonly
_logChannel
:
vscode
.
OutputChannel
;
constructor
(
@
IExtHostInitDataService
initData
:
IExtHostInitDataService
,
@
IExtHostOutputService
extHostOutputService
:
IExtHostOutputService
)
{
super
();
this
.
setLevel
(
initData
.
logLevel
);
this
.
_logChannel
=
extHostOutputService
.
createOutputChannel
(
'
Log (Worker Extension Host)
'
);
}
$setLevel
(
level
:
LogLevel
):
void
{
this
.
setLevel
(
level
);
}
trace
(
_message
:
string
,
...
_args
:
any
[]):
void
{
if
(
this
.
getLevel
()
<=
LogLevel
.
Trace
)
{
this
.
_logChannel
.
appendLine
(
this
.
_format
(
arguments
));
}
}
debug
(
_message
:
string
,
...
_args
:
any
[]):
void
{
if
(
this
.
getLevel
()
<=
LogLevel
.
Debug
)
{
this
.
_logChannel
.
appendLine
(
this
.
_format
(
arguments
));
}
}
info
(
_message
:
string
,
...
_args
:
any
[]):
void
{
if
(
this
.
getLevel
()
<=
LogLevel
.
Info
)
{
this
.
_logChannel
.
appendLine
(
this
.
_format
(
arguments
));
}
}
warn
(
_message
:
string
,
...
_args
:
any
[]):
void
{
if
(
this
.
getLevel
()
<=
LogLevel
.
Warning
)
{
this
.
_logChannel
.
appendLine
(
this
.
_format
(
arguments
));
}
}
error
(
_message
:
string
|
Error
,
...
_args
:
any
[]):
void
{
if
(
this
.
getLevel
()
<=
LogLevel
.
Error
)
{
this
.
_logChannel
.
appendLine
(
this
.
_format
(
arguments
));
}
}
critical
(
_message
:
string
|
Error
,
...
_args
:
any
[]):
void
{
if
(
this
.
getLevel
()
<=
LogLevel
.
Critical
)
{
this
.
_logChannel
.
appendLine
(
String
(
arguments
));
}
}
private
_format
(
args
:
any
):
string
{
let
result
=
''
;
for
(
let
i
=
0
;
i
<
args
.
length
;
i
++
)
{
let
a
=
args
[
i
];
if
(
typeof
a
===
'
object
'
)
{
try
{
a
=
JSON
.
stringify
(
a
);
}
catch
(
e
)
{
}
}
result
+=
(
i
>
0
?
'
'
:
''
)
+
a
;
}
return
result
;
}
}
src/vs/workbench/services/extensions/common/extensionHostMain.ts
浏览文件 @
2700f41d
...
...
@@ -10,7 +10,6 @@ import { URI, setUriThrowOnMissingScheme } from 'vs/base/common/uri';
import
{
IURITransformer
}
from
'
vs/base/common/uriIpc
'
;
import
{
IMessagePassingProtocol
}
from
'
vs/base/parts/ipc/common/ipc
'
;
import
{
IInitData
,
MainContext
,
MainThreadConsoleShape
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
ExtHostLogService
}
from
'
vs/workbench/api/common/extHostLogService
'
;
import
{
RPCProtocol
}
from
'
vs/workbench/services/extensions/common/rpcProtocol
'
;
import
{
IExtensionDescription
}
from
'
vs/platform/extensions/common/extensions
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
...
...
@@ -65,21 +64,21 @@ export class ExtensionHostMain {
consolePatchFn
(
rpcProtocol
.
getProxy
(
MainContext
.
MainThreadConsole
));
// services
const
extHostLogService
=
new
ExtHostLogService
(
logServiceFn
(
initData
),
initData
.
logsLocation
.
fsPath
);
this
.
_disposables
.
add
(
extHostLogService
);
// bootstrap services
const
services
=
new
ServiceCollection
(...
getSingletonServiceDescriptors
());
services
.
set
(
IExtHostInitDataService
,
{
_serviceBrand
:
undefined
,
...
initData
});
services
.
set
(
IExtHostRpcService
,
new
ExtHostRpcService
(
rpcProtocol
));
services
.
set
(
ILogService
,
extHostLogService
);
services
.
set
(
IURITransformerService
,
new
URITransformerService
(
uriTransformer
));
services
.
set
(
IHostUtils
,
hostUtils
);
const
instaService
:
IInstantiationService
=
new
InstantiationService
(
services
,
true
);
extHostLogService
.
info
(
'
extension host started
'
);
extHostLogService
.
trace
(
'
initData
'
,
initData
);
const
logService
=
instaService
.
invokeFunction
(
accessor
=>
accessor
.
get
(
ILogService
));
this
.
_disposables
.
add
(
logService
);
logService
.
info
(
'
extension host started
'
);
logService
.
trace
(
'
initData
'
,
initData
);
// todo@joh -> not soo nice...
this
.
_extensionService
=
instaService
.
invokeFunction
(
accessor
=>
accessor
.
get
(
IExtHostExtensionService
));
...
...
src/vs/workbench/services/extensions/node/proxyResolver.ts
浏览文件 @
2700f41d
...
...
@@ -17,11 +17,11 @@ import { IExtHostWorkspaceProvider } from 'vs/workbench/api/common/extHostWorksp
import
{
ExtHostConfigProvider
}
from
'
vs/workbench/api/common/extHostConfiguration
'
;
import
{
ProxyAgent
}
from
'
vscode-proxy-agent
'
;
import
{
MainThreadTelemetryShape
}
from
'
vs/workbench/api/common/extHost.protocol
'
;
import
{
ExtHostLogService
}
from
'
vs/workbench/api/common/extHostLogService
'
;
import
{
toErrorMessage
}
from
'
vs/base/common/errorMessage
'
;
import
{
ExtHostExtensionService
}
from
'
vs/workbench/api/node/extHostExtensionService
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
promisify
}
from
'
util
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
interface
ConnectionResult
{
proxy
:
string
;
...
...
@@ -34,7 +34,7 @@ export function connectProxyResolver(
extHostWorkspace
:
IExtHostWorkspaceProvider
,
configProvider
:
ExtHostConfigProvider
,
extensionService
:
ExtHostExtensionService
,
extHostLogService
:
ExtHost
LogService
,
extHostLogService
:
I
LogService
,
mainThreadTelemetry
:
MainThreadTelemetryShape
)
{
const
resolveProxy
=
setupProxyResolution
(
extHostWorkspace
,
configProvider
,
extHostLogService
,
mainThreadTelemetry
);
...
...
@@ -47,7 +47,7 @@ const maxCacheEntries = 5000; // Cache can grow twice that much due to 'oldCache
function
setupProxyResolution
(
extHostWorkspace
:
IExtHostWorkspaceProvider
,
configProvider
:
ExtHostConfigProvider
,
extHostLogService
:
ExtHost
LogService
,
extHostLogService
:
I
LogService
,
mainThreadTelemetry
:
MainThreadTelemetryShape
)
{
const
env
=
process
.
env
;
...
...
@@ -421,7 +421,7 @@ function configureModuleLoading(extensionService: ExtHostExtensionService, looku
});
}
function
useSystemCertificates
(
extHostLogService
:
ExtHost
LogService
,
useSystemCertificates
:
boolean
,
opts
:
http
.
RequestOptions
,
callback
:
()
=>
void
)
{
function
useSystemCertificates
(
extHostLogService
:
I
LogService
,
useSystemCertificates
:
boolean
,
opts
:
http
.
RequestOptions
,
callback
:
()
=>
void
)
{
if
(
useSystemCertificates
)
{
getCaCertificates
(
extHostLogService
)
.
then
(
caCertificates
=>
{
...
...
@@ -443,7 +443,7 @@ function useSystemCertificates(extHostLogService: ExtHostLogService, useSystemCe
}
let
_caCertificates
:
ReturnType
<
typeof
readCaCertificates
>
|
Promise
<
undefined
>
;
async
function
getCaCertificates
(
extHostLogService
:
ExtHost
LogService
)
{
async
function
getCaCertificates
(
extHostLogService
:
I
LogService
)
{
if
(
!
_caCertificates
)
{
_caCertificates
=
readCaCertificates
()
.
then
(
res
=>
res
&&
res
.
certs
.
length
?
res
:
undefined
)
...
...
src/vs/workbench/services/extensions/worker/extHost.services.ts
浏览文件 @
2700f41d
...
...
@@ -19,8 +19,11 @@ import { IExtHostExtensionService } from 'vs/workbench/api/common/extHostExtensi
import
{
IExtHostStorage
,
ExtHostStorage
}
from
'
vs/workbench/api/common/extHostStorage
'
;
import
{
ExtHostExtensionService
}
from
'
vs/workbench/api/worker/extHostExtensionService
'
;
import
{
ServiceIdentifier
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
ExtHostLogService
}
from
'
vs/workbench/api/worker/extHostLogService
'
;
// register singleton services
registerSingleton
(
ILogService
,
ExtHostLogService
);
registerSingleton
(
IExtHostOutputService
,
ExtHostOutputService
);
registerSingleton
(
IExtHostWorkspace
,
ExtHostWorkspace
);
registerSingleton
(
IExtHostDecorations
,
ExtHostDecorations
);
...
...
@@ -51,6 +54,4 @@ registerSingleton(IExtHostDebugService, class extends NotImplementedProxy(IExtHo
registerSingleton
(
IExtHostSearch
,
class
extends
NotImplementedProxy
(
IExtHostSearch
)
{
});
registerSingleton
(
IExtensionStoragePaths
,
class
extends
NotImplementedProxy
(
IExtensionStoragePaths
)
{
whenReady
=
Promise
.
resolve
();
globalValue
=
()
=>
''
;
workspaceValue
=
()
=>
''
;
});
tslint.json
浏览文件 @
2700f41d
...
...
@@ -391,6 +391,14 @@
"**/vs/workbench/contrib/*/common/**"
]
},
{
"target"
:
"**/vs/workbench/api/worker/**"
,
"restrictions"
:
[
"vscode"
,
"vs/nls"
,
"**/vs/**/{common,worker}/**"
]
},
{
"target"
:
"**/vs/workbench/electron-browser/**"
,
"restrictions"
:
[
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录