Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
myhjmzy
code-server
提交
39a57700
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,发现更多精彩内容 >>
未验证
提交
39a57700
编写于
2月 18, 2020
作者:
A
Asher
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Enable access to vscode cli
上级
0ec83f87
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
73 addition
and
15 deletion
+73
-15
scripts/vscode.patch
scripts/vscode.patch
+31
-12
src/node/app/app.ts
src/node/app/app.ts
+1
-1
src/node/cli.ts
src/node/cli.ts
+13
-0
src/node/entry.ts
src/node/entry.ts
+28
-2
未找到文件。
scripts/vscode.patch
浏览文件 @
39a57700
...
...
@@ -12,7 +12,7 @@ index 160c42ed74..0d544c495c 100644
coverage/
diff --git a/coder.js b/coder.js
new file mode 100644
index 0000000000..
fc18355f89
index 0000000000..
6aee0e46bc
--- /dev/null
+++ b/coder.js
@@ -0,0 +1,70 @@
...
...
@@ -32,9 +32,9 @@ index 0000000000..fc18355f89
+ buildfile.workbenchWeb,
+ buildfile.workerExtensionHost,
+ buildfile.keyboardMaps,
+ buildfile.entrypoint(
'vs/platform/files/node/watcher/unix/watcherApp'
, ["vs/css", "vs/nls"]),
+ buildfile.entrypoint(
'vs/platform/files/node/watcher/nsfw/watcherApp'
, ["vs/css", "vs/nls"]),
+ buildfile.entrypoint(
'vs/workbench/services/extensions/node/extensionHostProcess'
, ["vs/css", "vs/nls"]),
+ buildfile.entrypoint(
"vs/platform/files/node/watcher/unix/watcherApp"
, ["vs/css", "vs/nls"]),
+ buildfile.entrypoint(
"vs/platform/files/node/watcher/nsfw/watcherApp"
, ["vs/css", "vs/nls"]),
+ buildfile.entrypoint(
"vs/workbench/services/extensions/node/extensionHostProcess"
, ["vs/css", "vs/nls"]),
+]);
+
+const vscodeResources = [
...
...
@@ -894,10 +894,10 @@ index 0000000000..eb62b87798
+}
diff --git a/src/vs/server/entry.ts b/src/vs/server/entry.ts
new file mode 100644
index 0000000000..
9995e9f7fc
index 0000000000..
0d7feaa24e
--- /dev/null
+++ b/src/vs/server/entry.ts
@@ -0,0 +1,
67
@@
@@ -0,0 +1,
76
@@
+import { field } from '@coder/logger';
+import { setUnexpectedErrorHandler } from 'vs/base/common/errors';
+import { CodeServerMessage, VscodeMessage } from 'vs/server/ipc';
...
...
@@ -953,6 +953,15 @@ index 0000000000..9995e9f7fc
+ exit(1);
+ }
+ break;
+ case 'cli':
+ try {
+ await vscode.cli(message.args);
+ exit(0);
+ } catch (error) {
+ logger.error(error.message);
+ exit(1);
+ }
+ break;
+ case 'socket':
+ vscode.handleWebSocket(socket, message.query);
+ break;
...
...
@@ -976,10 +985,10 @@ index 0000000000..56331ff1fc
+require('../../bootstrap-amd').load('vs/server/entry');
diff --git a/src/vs/server/ipc.d.ts b/src/vs/server/ipc.d.ts
new file mode 100644
index 0000000000..
a1047fff86
index 0000000000..
82566066ff
--- /dev/null
+++ b/src/vs/server/ipc.d.ts
@@ -0,0 +1,10
1
@@
@@ -0,0 +1,10
6
@@
+/**
+ * External interfaces for integration into code-server over IPC. No vs imports
+ * should be made in this file.
...
...
@@ -998,7 +1007,12 @@ index 0000000000..a1047fff86
+ query: Query;
+}
+
+export type CodeServerMessage = InitMessage | SocketMessage;
+export interface CliMessage {
+ type: 'cli';
+ args: Args;
+}
+
+export type CodeServerMessage = InitMessage | SocketMessage | CliMessage;
+
+export interface ReadyMessage {
+ type: 'ready';
...
...
@@ -1032,8 +1046,8 @@ index 0000000000..a1047fff86
+}
+
+export interface VscodeOptions {
+ readonly remoteAuthority: string;
+ readonly args: Args;
+ readonly remoteAuthority: string;
+ readonly startPath?: StartPath;
+}
+
...
...
@@ -2152,10 +2166,10 @@ index 0000000000..3c74512192
+}
diff --git a/src/vs/server/node/server.ts b/src/vs/server/node/server.ts
new file mode 100644
index 0000000000..
13d71949ce
index 0000000000..
20dbca69b2
--- /dev/null
+++ b/src/vs/server/node/server.ts
@@ -0,0 +1,25
2
@@
@@ -0,0 +1,25
7
@@
+import * as net from 'net';
+import * as path from 'path';
+import { Emitter } from 'vs/base/common/event';
...
...
@@ -2165,6 +2179,7 @@ index 0000000000..13d71949ce
+import { ClientConnectionEvent, IPCServer, IServerChannel } from 'vs/base/parts/ipc/common/ipc';
+import { createChannelReceiver } from 'vs/base/parts/ipc/node/ipc';
+import { LogsDataCleaner } from 'vs/code/electron-browser/sharedProcess/contrib/logsDataCleaner';
+import { main } from "vs/code/node/cliProcessMain";
+import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
+import { ConfigurationService } from 'vs/platform/configuration/node/configurationService';
+import { ExtensionHostDebugBroadcastChannel } from 'vs/platform/debug/common/extensionHostDebugIpc';
...
...
@@ -2222,6 +2237,10 @@ index 0000000000..13d71949ce
+ private readonly services = new ServiceCollection();
+ private servicesPromise?: Promise<void>;
+
+ public async cli(args: ParsedArgs): Promise<void> {
+ return main(args);
+ }
+
+ public async initialize(options: VscodeOptions): Promise<WorkbenchOptions> {
+ const transformer = getUriTransformer(options.remoteAuthority);
+ if (!this.servicesPromise) {
...
...
src/node/app/app.ts
浏览文件 @
39a57700
...
...
@@ -136,7 +136,7 @@ export class MainHttpProvider extends HttpProvider {
private
async
getUpdate
():
Promise
<
string
>
{
if
(
!
this
.
update
.
enabled
)
{
return
"
Updates are disabled
"
return
`<div class="block-row"><div class="item"><div class="sub">Updates are disabled</div></div></div>`
}
const
humanize
=
(
time
:
number
):
string
=>
{
...
...
src/node/cli.ts
浏览文件 @
39a57700
...
...
@@ -15,6 +15,7 @@ export interface Args extends VsArgs {
readonly
cert
?:
OptionalString
readonly
"
cert-key
"
?:
string
readonly
"
disable-updates
"
?:
boolean
readonly
"
disable-telemetry
"
?:
boolean
readonly
help
?:
boolean
readonly
host
?:
string
readonly
json
?:
boolean
...
...
@@ -22,6 +23,9 @@ export interface Args extends VsArgs {
readonly
port
?:
number
readonly
socket
?:
string
readonly
version
?:
boolean
readonly
"
list-extensions
"
?:
boolean
readonly
"
install-extension
"
?:
string
[]
readonly
"
uninstall-extension
"
?:
string
[]
readonly
_
:
string
[]
}
...
...
@@ -68,6 +72,7 @@ const options: Options<Required<Args>> = {
},
"
cert-key
"
:
{
type
:
"
string
"
,
path
:
true
,
description
:
"
Path to certificate key when using non-generated cert.
"
},
"
disable-updates
"
:
{
type
:
"
boolean
"
,
description
:
"
Disable automatic updates.
"
},
"
disable-telemetry
"
:
{
type
:
"
boolean
"
,
description
:
"
Disable telemetry.
"
},
host
:
{
type
:
"
string
"
,
description
:
"
Host for the HTTP server.
"
},
help
:
{
type
:
"
boolean
"
,
short
:
"
h
"
,
description
:
"
Show this output.
"
},
json
:
{
type
:
"
boolean
"
},
...
...
@@ -82,6 +87,9 @@ const options: Options<Required<Args>> = {
"
builtin-extensions-dir
"
:
{
type
:
"
string
"
,
path
:
true
},
"
extra-extensions-dir
"
:
{
type
:
"
string[]
"
,
path
:
true
},
"
extra-builtin-extensions-dir
"
:
{
type
:
"
string[]
"
,
path
:
true
},
"
list-extensions
"
:
{
type
:
"
boolean
"
},
"
install-extension
"
:
{
type
:
"
string[]
"
},
"
uninstall-extension
"
:
{
type
:
"
string[]
"
},
log
:
{
type
:
"
string
"
},
verbose
:
{
type
:
"
boolean
"
,
short
:
"
vvv
"
,
description
:
"
Enable verbose logging.
"
},
...
...
@@ -193,8 +201,13 @@ export const parse = (argv: string[]): Args => {
if
(
process
.
env
.
LOG_LEVEL
===
"
trace
"
||
args
.
verbose
)
{
args
.
verbose
=
true
args
.
log
=
"
trace
"
}
else
if
(
!
args
.
log
)
{
args
.
log
=
process
.
env
.
LOG_LEVEL
}
// Ensure this passes down to forked processes.
process
.
env
.
LOG_LEVEL
=
args
.
log
switch
(
args
.
log
)
{
case
"
trace
"
:
logger
.
level
=
Level
.
Trace
...
...
src/node/entry.ts
浏览文件 @
39a57700
import
{
logger
}
from
"
@coder/logger
"
import
{
Args
,
optionDescriptions
,
parse
}
from
"
./cli
"
import
{
field
,
logger
}
from
"
@coder/logger
"
import
*
as
cp
from
"
child_process
"
import
*
as
path
from
"
path
"
import
{
CliMessage
}
from
"
../../lib/vscode/src/vs/server/ipc
"
import
{
ApiHttpProvider
}
from
"
./app/api
"
import
{
MainHttpProvider
}
from
"
./app/app
"
import
{
LoginHttpProvider
}
from
"
./app/login
"
import
{
UpdateHttpProvider
}
from
"
./app/update
"
import
{
VscodeHttpProvider
}
from
"
./app/vscode
"
import
{
Args
,
optionDescriptions
,
parse
}
from
"
./cli
"
import
{
AuthType
,
HttpServer
}
from
"
./http
"
import
{
generateCertificate
,
generatePassword
,
hash
,
open
}
from
"
./util
"
import
{
ipcMain
,
wrap
}
from
"
./wrapper
"
...
...
@@ -105,6 +108,29 @@ if (args.help) {
console
.
log
(
version
)
}
process
.
exit
(
0
)
}
else
if
(
args
[
"
list-extensions
"
]
||
args
[
"
install-extension
"
]
||
args
[
"
uninstall-extension
"
])
{
process
.
env
.
NBIN_BYPASS
=
"
true
"
logger
.
debug
(
"
Forking VS Code CLI...
"
)
const
vscode
=
cp
.
fork
(
path
.
resolve
(
__dirname
,
"
../../lib/vscode/out/vs/server/fork
"
),
[],
{
env
:
{
...
process
.
env
,
CODE_SERVER_PARENT_PID
:
process
.
pid
.
toString
(),
},
})
vscode
.
once
(
"
message
"
,
(
message
)
=>
{
logger
.
debug
(
"
Got message from VS Code
"
,
field
(
"
message
"
,
message
))
if
(
message
.
type
!==
"
ready
"
)
{
logger
.
error
(
"
Unexpected response waiting for ready response
"
)
process
.
exit
(
1
)
}
const
send
:
CliMessage
=
{
type
:
"
cli
"
,
args
}
vscode
.
send
(
send
)
})
vscode
.
once
(
"
error
"
,
(
error
)
=>
{
logger
.
error
(
error
.
message
)
process
.
exit
(
1
)
})
vscode
.
on
(
"
exit
"
,
(
code
)
=>
process
.
exit
(
code
||
0
))
}
else
{
wrap
(()
=>
main
(
args
))
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录