Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
myhjmzy
code-server
提交
fa59156a
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
fa59156a
编写于
11月 19, 2020
作者:
A
Asher
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implement remaining resolver methods
上级
8ffe5997
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
44 addition
and
26 deletion
+44
-26
ci/dev/vscode.patch
ci/dev/vscode.patch
+44
-26
未找到文件。
ci/dev/vscode.patch
浏览文件 @
fa59156a
...
...
@@ -1466,10 +1466,10 @@ index 0000000000000000000000000000000000000000..6ce56bec114a6d8daf5dd3ded945ea78
+}
diff --git a/src/vs/server/node/channel.ts b/src/vs/server/node/channel.ts
new file mode 100644
index 0000000000000000000000000000000000000000..7
081bbf178c660803830675a4d8d596c5d0b7821
index 0000000000000000000000000000000000000000..7
619b02f04b6e61e86e741b09b542d86fab97e3d
--- /dev/null
+++ b/src/vs/server/node/channel.ts
@@ -0,0 +1,8
69
@@
@@ -0,0 +1,8
87
@@
+import { field, logger } from '@coder/logger';
+import { Server } from '@coder/node-browser';
+import * as os from 'os';
...
...
@@ -1846,30 +1846,51 @@ index 0000000000000000000000000000000000000000..7081bbf178c660803830675a4d8d596c
+}
+
+class VariableResolverService extends AbstractVariableResolverService {
+ constructor(folders: terminal.IWorkspaceFolderData[], env: platform.IProcessEnvironment) {
+ constructor(
+ remoteAuthority: string,
+ args: terminal.ICreateTerminalProcessArguments,
+ env: platform.IProcessEnvironment,
+ ) {
+ super({
+ getFolderUri: (name: string): URI | undefined => {
+ const folder =
f
olders.find((f) => f.name === name);
+ const folder =
args.workspaceF
olders.find((f) => f.name === name);
+ return folder && URI.revive(folder.uri);
+ },
+ getWorkspaceFolderCount: (): number => {
+ return
f
olders.length;
+ return
args.workspaceF
olders.length;
+ },
+ getConfigurationValue: (uri: URI, section: string): string | undefined => {
+ throw new Error("not implemented");
+ // In ../../workbench/contrib/terminal/common/remoteTerminalChannel.ts it
+ // looks like there are `config:` entries which must be for this? Not sure
+ // how/if the URI comes into play though.
+ getConfigurationValue: (_: URI, section: string): string | undefined => {
+ return args.resolvedVariables[`config:${section}`];
+ },
+ getExecPath: (): string | undefined => {
+ return env['VSCODE_EXEC_PATH'];
+ },
+ // This is just a guess; this is the only file-related thing we're sent
+ // and none of these resolver methods seem to get called so I don't know
+ // how to test.
+ getFilePath: (): string | undefined => {
+ throw new Error("not implemented");
+ const resource = transformIncoming(remoteAuthority, args.activeFileResource);
+ if (!resource) {
+ return undefined;
+ }
+ // See ../../editor/standalone/browser/simpleServices.ts;
+ // `BaseConfigurationResolverService` calls `getUriLabel` from there.
+ if (resource.scheme === 'file') {
+ return resource.fsPath;
+ }
+ return resource.path;
+ },
+ // It looks like these are set here although they aren't on the types:
+ // ../../workbench/contrib/terminal/common/remoteTerminalChannel.ts
+ getSelectedText: (): string | undefined => {
+
throw new Error("not implemented")
;
+
return args.resolvedVariables.selectedText
;
+ },
+ getLineNumber: (): string | undefined => {
+
throw new Error("not implemented")
;
+ }
+
return args.resolvedVariables.selectedText
;
+ }
,
+ }, undefined, env);
+ }
+}
...
...
@@ -2144,20 +2165,22 @@ index 0000000000000000000000000000000000000000..7081bbf178c660803830675a4d8d596c
+ name: args.shellLaunchConfig.name,
+ executable: args.shellLaunchConfig.executable,
+ args: args.shellLaunchConfig.args,
+ cwd: this.transform(remoteAuthority, args.shellLaunchConfig.cwd),
+ // TODO: Should we transform if it's a string as well? The incoming
+ // transform only takes `UriComponents` so I suspect it's not necessary.
+ cwd: typeof args.shellLaunchConfig.cwd !== "string"
+ ? transformIncoming(remoteAuthority, args.shellLaunchConfig.cwd)
+ : args.shellLaunchConfig.cwd,
+ env: args.shellLaunchConfig.env,
+ };
+
+ // TODO: is this supposed to be the *last* workspace?
+
+ const activeWorkspaceUri = this.transform(remoteAuthority, args.activeWorkspaceFolder?.uri);
+ const activeWorkspaceUri = transformIncoming(remoteAuthority, args.activeWorkspaceFolder?.uri);
+ const activeWorkspace = activeWorkspaceUri && args.activeWorkspaceFolder ? {
+ ...args.activeWorkspaceFolder,
+ uri: activeWorkspaceUri,
+ toResource: (relativePath: string) => resources.joinPath(activeWorkspaceUri, relativePath),
+ } : undefined;
+
+ const resolverService = new VariableResolverService(
args.workspaceFolder
s, process.env as platform.IProcessEnvironment);
+ const resolverService = new VariableResolverService(
remoteAuthority, arg
s, process.env as platform.IProcessEnvironment);
+ const resolver = terminalEnvironment.createVariableResolver(activeWorkspace, resolverService);
+
+ const getDefaultShellAndArgs = (): { executable: string; args: string[] | string } => {
...
...
@@ -2269,16 +2292,6 @@ index 0000000000000000000000000000000000000000..7081bbf178c660803830675a4d8d596c
+ };
+ }
+
+ private transform(remoteAuthority: string, uri: UriComponents | undefined): URI | undefined
+ private transform(remoteAuthority: string, uri: string | UriComponents | undefined): string | URI | undefined
+ private transform(remoteAuthority: string, uri: string | UriComponents | undefined): string | URI | undefined {
+ if (typeof uri === 'string') {
+ return uri;
+ }
+ const transformer = getUriTransformer(remoteAuthority);
+ return uri ? URI.revive(transformer.transformIncoming(uri)) : uri;
+ }
+
+ private getTerminal(id: number): Terminal {
+ const terminal = this.terminals.get(id);
+ if (!terminal) {
...
...
@@ -2339,6 +2352,11 @@ index 0000000000000000000000000000000000000000..7081bbf178c660803830675a4d8d596c
+ }));
+ }
+}
+
+function transformIncoming(remoteAuthority: string, uri: UriComponents | undefined): URI | undefined {
+ const transformer = getUriTransformer(remoteAuthority);
+ return uri ? URI.revive(transformer.transformIncoming(uri)) : uri;
+}
diff --git a/src/vs/server/node/connection.ts b/src/vs/server/node/connection.ts
new file mode 100644
index 0000000000000000000000000000000000000000..93062cadc627c61e0829c27a72894b81e6a0e039
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录