Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
myhjmzy
code-server
提交
2e77c9d4
C
code-server
项目概览
myhjmzy
/
code-server
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
code-server
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
2e77c9d4
编写于
7月 02, 2019
作者:
A
Asher
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Scan extensions
上级
a6703ecb
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
63 addition
and
7 deletion
+63
-7
channel.ts
channel.ts
+62
-6
server.ts
server.ts
+1
-1
未找到文件。
channel.ts
浏览文件 @
2e77c9d4
...
...
@@ -10,9 +10,11 @@ import { URITransformer, IRawURITransformer, transformOutgoingURIs } from "vs/ba
import
{
IServerChannel
}
from
"
vs/base/parts/ipc/common/ipc
"
;
import
{
IDiagnosticInfo
}
from
"
vs/platform/diagnostics/common/diagnosticsService
"
;
import
{
IEnvironmentService
}
from
"
vs/platform/environment/common/environment
"
;
import
{
IExtensionDescription
,
ExtensionIdentifier
}
from
"
vs/platform/extensions/common/extensions
"
;
import
{
FileDeleteOptions
,
FileOverwriteOptions
,
FileType
,
IStat
,
IWatchOptions
,
FileOpenOptions
}
from
"
vs/platform/files/common/files
"
;
import
{
ILogService
}
from
"
vs/platform/log/common/log
"
;
import
{
IRemoteAgentEnvironment
}
from
"
vs/platform/remote/common/remoteAgentEnvironment
"
;
import
{
ExtensionScanner
,
ExtensionScannerInput
}
from
"
vs/workbench/services/extensions/node/extensionPoints
"
;
import
{
DiskFileSystemProvider
}
from
"
vs/workbench/services/files/node/diskFileSystemProvider
"
;
/**
...
...
@@ -157,17 +159,20 @@ export class FileProviderChannel implements IServerChannel {
* See: src/vs/workbench/services/remote/common/remoteAgentEnvironmentChannel.ts.
*/
export
class
ExtensionEnvironmentChannel
implements
IServerChannel
{
public
constructor
(
private
readonly
environment
:
IEnvironmentService
)
{}
public
constructor
(
private
readonly
environment
:
IEnvironmentService
,
private
readonly
log
:
ILogService
,
)
{}
public
listen
(
_
:
unknown
,
event
:
string
):
Event
<
any
>
{
throw
new
Error
(
`Invalid listen "
${
event
}
"`
);
}
public
async
call
(
context
:
any
,
command
:
string
,
_
args
?:
any
):
Promise
<
any
>
{
public
async
call
(
context
:
any
,
command
:
string
,
args
?:
any
):
Promise
<
any
>
{
switch
(
command
)
{
case
"
getEnvironmentData
"
:
return
transformOutgoingURIs
(
await
this
.
getEnvironmentData
(),
await
this
.
getEnvironmentData
(
args
.
language
),
getUriTransformer
(
context
.
remoteAuthority
),
);
case
"
getDiagnosticInfo
"
:
return
this
.
getDiagnosticInfo
();
...
...
@@ -176,7 +181,7 @@ export class ExtensionEnvironmentChannel implements IServerChannel {
throw
new
Error
(
`Invalid call "
${
command
}
"`
);
}
private
async
getEnvironmentData
():
Promise
<
IRemoteAgentEnvironment
>
{
private
async
getEnvironmentData
(
locale
:
string
):
Promise
<
IRemoteAgentEnvironment
>
{
return
{
pid
:
process
.
pid
,
appRoot
:
URI
.
file
(
this
.
environment
.
appRoot
),
...
...
@@ -184,14 +189,65 @@ export class ExtensionEnvironmentChannel implements IServerChannel {
settingsPath
:
this
.
environment
.
machineSettingsHome
,
logsPath
:
URI
.
file
(
this
.
environment
.
logsPath
),
extensionsPath
:
URI
.
file
(
this
.
environment
.
extensionsPath
),
extensionHostLogsPath
:
URI
.
file
(
path
.
join
(
this
.
environment
.
logsPath
,
"
extension-host
"
)),
// TODO
extensionHostLogsPath
:
URI
.
file
(
path
.
join
(
this
.
environment
.
logsPath
,
"
extension-host
"
)),
globalStorageHome
:
URI
.
file
(
this
.
environment
.
globalStorageHome
),
userHome
:
URI
.
file
(
this
.
environment
.
userHome
),
extensions
:
[],
// TODO
extensions
:
await
this
.
scanExtensions
(
locale
),
os
:
OS
,
};
}
private
async
scanExtensions
(
locale
:
string
):
Promise
<
IExtensionDescription
[]
>
{
const
root
=
getPathFromAmdModule
(
require
,
""
);
const
pkg
=
require
.
__$__nodeRequire
(
path
.
resolve
(
root
,
"
../package.json
"
))
as
any
;
const
translations
=
{};
// TODO: translations
// TODO: there is also this.environment.extensionDevelopmentLocationURI to look into.
const
scanBuiltin
=
async
():
Promise
<
IExtensionDescription
[]
>
=>
{
const
input
=
new
ExtensionScannerInput
(
pkg
.
version
,
pkg
.
commit
,
locale
,
!!
process
.
env
.
VSCODE_DEV
,
path
.
resolve
(
root
,
"
../extensions
"
),
true
,
false
,
translations
,
);
const
extensions
=
await
ExtensionScanner
.
scanExtensions
(
input
,
this
.
log
);
// TODO: there is more to do if process.env.VSCODE_DEV is true.
return
extensions
;
};
const
scanInstalled
=
async
():
Promise
<
IExtensionDescription
[]
>
=>
{
const
input
=
new
ExtensionScannerInput
(
pkg
.
version
,
pkg
.
commit
,
locale
,
!!
process
.
env
.
VSCODE_DEV
,
this
.
environment
.
extensionsPath
,
false
,
true
,
translations
,
);
return
ExtensionScanner
.
scanExtensions
(
input
,
this
.
log
);
};
return
Promise
.
all
([
scanBuiltin
(),
scanInstalled
()]).
then
((
allExtensions
)
=>
{
// It's possible to get duplicates.
const
uniqueExtensions
=
new
Map
<
string
,
IExtensionDescription
>
();
allExtensions
.
forEach
((
extensions
)
=>
{
extensions
.
forEach
((
extension
)
=>
{
const
id
=
ExtensionIdentifier
.
toKey
(
extension
.
identifier
);
if
(
uniqueExtensions
.
has
(
id
))
{
const
oldPath
=
uniqueExtensions
.
get
(
id
)
!
.
extensionLocation
.
fsPath
;
const
newPath
=
extension
.
extensionLocation
.
fsPath
;
this
.
log
.
warn
(
`Extension
${
id
}
in
${
oldPath
}
has been overridden
${
newPath
}
`
,
);
}
uniqueExtensions
.
set
(
id
,
extension
);
});
});
const
finalExtensions
=
<
IExtensionDescription
[]
>
[];
uniqueExtensions
.
forEach
((
e
)
=>
finalExtensions
.
push
(
e
));
return
finalExtensions
;
});
}
private
getDiagnosticInfo
():
Promise
<
IDiagnosticInfo
>
{
throw
new
Error
(
"
not implemented
"
);
}
...
...
server.ts
浏览文件 @
2e77c9d4
...
...
@@ -127,7 +127,7 @@ export class Server {
);
this
.
ipc
.
registerChannel
(
"
remoteextensionsenvironment
"
,
new
ExtensionEnvironmentChannel
(
this
.
environmentService
),
new
ExtensionEnvironmentChannel
(
this
.
environmentService
,
this
.
logService
),
);
});
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录