Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
81821c71
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,体验更适合开发者的 AI 搜索 >>
提交
81821c71
编写于
6月 13, 2019
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
testresolver: kill server process, more settings
上级
390c0bda
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
47 addition
and
25 deletion
+47
-25
extensions/vscode-test-resolver/package.json
extensions/vscode-test-resolver/package.json
+14
-15
extensions/vscode-test-resolver/src/extension.ts
extensions/vscode-test-resolver/src/extension.ts
+33
-10
未找到文件。
extensions/vscode-test-resolver/package.json
浏览文件 @
81821c71
...
...
@@ -43,11 +43,6 @@
"category"
:
"Remote-TestResolver"
,
"command"
:
"vscode-testresolver.newWindow"
},
{
"title"
:
"New Window with Error"
,
"category"
:
"Remote-TestResolver"
,
"command"
:
"vscode-testresolver.newWindowWithError"
},
{
"title"
:
"Show Log"
,
"category"
:
"Remote-TestResolver"
,
...
...
@@ -61,11 +56,6 @@
"when"
:
"!remoteAuthority"
,
"group"
:
"9_local_testresolver@2"
},
{
"command"
:
"vscode-testresolver.newWindowWithError"
,
"when"
:
"!remoteAuthority"
,
"group"
:
"9_local_testresolver@3"
},
{
"command"
:
"vscode-testresolver.showLog"
,
"when"
:
"remoteAuthority =~ /^test
\\
+.*$/"
,
...
...
@@ -75,13 +65,22 @@
"command"
:
"vscode-testresolver.newWindow"
,
"when"
:
"remoteAuthority =~ /^test
\\
+.*$/"
,
"group"
:
"1_remote_testresolver_open@1"
},
{
"command"
:
"vscode-testresolver.newWindowWithError"
,
"when"
:
"remoteAuthority =~ /^test
\\
+.*$/"
,
"group"
:
"1_remote_testresolver_open@2"
}
]
},
"configuration"
:
{
"properties"
:
{
"testresolver.startupDelay"
:
{
"description"
:
"If set, the resolver will delay for the given amount of seconds. Use ths setting for testing a slow resolver"
,
"type"
:
"number"
,
"default"
:
0
},
"testresolver.startupError"
:
{
"description"
:
"If set, the resolver will fail. Use ths setting for testing the failure of a resolver."
,
"type"
:
"boolean"
,
"default"
:
false
}
}
}
}
...
...
extensions/vscode-test-resolver/src/extension.ts
浏览文件 @
81821c71
...
...
@@ -60,9 +60,19 @@ export function activate(context: vscode.ExtensionContext) {
}
}
}
const
delay
=
vscode
.
workspace
.
getConfiguration
(
'
testresolver
'
).
get
(
'
startupDelay
'
);
if
(
typeof
delay
===
'
number
'
)
{
let
remaining
=
Math
.
ceil
(
delay
);
outputChannel
.
append
(
`Delaying startup by
${
remaining
}
seconds (configured by "testresolver.startupDelay").`
);
while
(
remaining
>
0
)
{
progress
.
report
({
message
:
`Delayed resolving: Remaining
${
remaining
}
s`
});
await
(
sleep
(
1000
));
remaining
--
;
}
}
if
(
_authority
===
'
test+error
'
||
vscode
.
workspace
.
getConfiguration
(
'
testresolver
'
).
get
(
'
e
rror
'
)
===
true
)
{
processError
(
'
Unable to start the Test Resolver
.
'
);
if
(
vscode
.
workspace
.
getConfiguration
(
'
testresolver
'
).
get
(
'
startupE
rror
'
)
===
true
)
{
processError
(
'
Test Resolver failed for testing purposes (configured by "testresolver.startupError")
.
'
);
return
;
}
...
...
@@ -77,19 +87,32 @@ export function activate(context: vscode.ExtensionContext) {
if
(
!
commit
)
{
// dev mode
const
vscodePath
=
path
.
resolve
(
path
.
join
(
context
.
extensionPath
,
'
..
'
,
'
..
'
));
const
serverCommandPath
=
path
.
join
(
vscodePath
,
'
resources
'
,
'
server
'
,
'
bin-dev
'
,
serverCommand
);
extHostProcess
=
cp
.
spawn
(
serverCommandPath
,
commandArgs
,
{
env
,
cwd
:
vscodePath
});
extHostProcess
=
cp
.
spawn
(
serverCommandPath
,
commandArgs
,
{
env
,
cwd
:
vscodePath
,
detached
:
true
});
}
else
{
const
serverBin
=
path
.
join
(
remoteDataDir
,
'
bin
'
);
progress
.
report
({
message
:
'
Installing VSCode Server
'
});
const
serverLocation
=
await
downloadAndUnzipVSCodeServer
(
updateUrl
,
commit
,
quality
,
serverBin
);
outputChannel
.
appendLine
(
`Using server build at
${
serverLocation
}
`
);
extHostProcess
=
cp
.
spawn
(
path
.
join
(
serverLocation
,
serverCommand
),
commandArgs
,
{
env
,
cwd
:
serverLocation
});
extHostProcess
=
cp
.
spawn
(
path
.
join
(
serverLocation
,
serverCommand
),
commandArgs
,
{
env
,
cwd
:
serverLocation
,
detached
:
true
});
}
extHostProcess
.
stdout
.
on
(
'
data
'
,
(
data
:
Buffer
)
=>
processOutput
(
data
.
toString
()));
extHostProcess
.
stderr
.
on
(
'
data
'
,
(
data
:
Buffer
)
=>
processOutput
(
data
.
toString
()));
extHostProcess
.
on
(
'
error
'
,
(
error
:
Error
)
=>
processError
(
`server failed with error:\n
${
error
.
message
}
`
));
extHostProcess
.
on
(
'
close
'
,
(
code
:
number
)
=>
processError
(
`server closed unexpectedly.\nError code:
${
code
}
`
));
extHostProcess
.
on
(
'
error
'
,
(
error
:
Error
)
=>
{
processError
(
`server failed with error:\n
${
error
.
message
}
`
);
extHostProcess
=
undefined
;
});
extHostProcess
.
on
(
'
close
'
,
(
code
:
number
)
=>
{
processError
(
`server closed unexpectedly.\nError code:
${
code
}
`
);
extHostProcess
=
undefined
;
});
context
.
subscriptions
.
push
({
dispose
:
()
=>
{
if
(
extHostProcess
)
{
process
.
kill
(
-
extHostProcess
.
pid
);
}
}
});
});
}
...
...
@@ -168,8 +191,8 @@ function getNewEnv(): { [x: string]: string | undefined } {
return
env
;
}
export
function
deactivate
()
{
if
(
extHostProcess
)
{
extHostProcess
.
kill
(
);
}
function
sleep
(
ms
:
number
):
Promise
<
void
>
{
return
new
Promise
(
resolve
=>
{
setTimeout
(
resolve
,
ms
);
}
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录