Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
e42ad52f
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e42ad52f
编写于
4月 02, 2019
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
show confirmation dialogs to remind of uploading files, #70492
上级
92183e82
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
30 addition
and
2 deletion
+30
-2
src/vs/workbench/contrib/extensions/electron-browser/extensionsSlowActions.ts
...trib/extensions/electron-browser/extensionsSlowActions.ts
+30
-2
未找到文件。
src/vs/workbench/contrib/extensions/electron-browser/extensionsSlowActions.ts
浏览文件 @
e42ad52f
...
...
@@ -16,6 +16,8 @@ import { CancellationToken } from 'vs/base/common/cancellation';
import
{
asText
}
from
'
vs/base/node/request
'
;
import
{
join
}
from
'
path
'
;
import
{
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
IDialogService
}
from
'
vs/platform/dialogs/common/dialogs
'
;
import
Severity
from
'
vs/base/common/severity
'
;
abstract
class
RepoInfo
{
readonly
base
:
string
;
...
...
@@ -91,6 +93,7 @@ export async function createSlowExtensionAction(
}
const
requestService
=
accessor
.
get
(
IRequestService
);
const
instaService
=
accessor
.
get
(
IInstantiationService
);
const
url
=
`https://api.github.com/search/issues?q=is:issue+state:open+in:title+repo:
${
info
.
owner
}
/
${
info
.
repo
}
+%22Extension+causes+high+cpu+load%22`
;
const
res
=
await
requestService
.
request
({
url
},
CancellationToken
.
None
);
const
rawText
=
await
asText
(
res
);
...
...
@@ -102,9 +105,9 @@ export async function createSlowExtensionAction(
if
(
!
data
||
typeof
data
.
total_count
!==
'
number
'
)
{
return
undefined
;
}
else
if
(
data
.
total_count
===
0
)
{
return
new
ReportExtensionSlowAction
(
extension
,
info
,
profile
);
return
instaService
.
createInstance
(
ReportExtensionSlowAction
,
extension
,
info
,
profile
);
}
else
{
return
new
ShowExtensionSlowAction
(
extension
,
info
);
return
instaService
.
createInstance
(
ShowExtensionSlowAction
,
extension
,
info
,
profile
);
}
}
...
...
@@ -114,6 +117,7 @@ class ReportExtensionSlowAction extends Action {
readonly
extension
:
IExtensionDescription
,
readonly
repoInfo
:
RepoInfo
,
readonly
profile
:
IExtensionHostProfile
,
@
IDialogService
private
readonly
_dialogService
:
IDialogService
,
)
{
super
(
'
report.slow
'
,
localize
(
'
cmd.report
'
,
"
Report Issue
"
));
}
...
...
@@ -138,6 +142,13 @@ class ReportExtensionSlowAction extends Action {
const
url
=
`
${
this
.
repoInfo
.
base
}
/
${
this
.
repoInfo
.
owner
}
/
${
this
.
repoInfo
.
repo
}
/issues/new/?body=
${
body
}
&title=
${
title
}
`
;
window
.
open
(
url
);
this
.
_dialogService
.
show
(
Severity
.
Info
,
localize
(
'
attach.title
'
,
"
Did you attach the CPU-Profile?
"
),
[
localize
(
'
ok
'
,
'
OK
'
)],
{
detail
:
localize
(
'
attach.msg
'
,
"
This is a reminder to make sure that you have not forgotten to attach '{0}' to the issue you have just created.
"
,
path
)
}
);
}
}
...
...
@@ -146,12 +157,29 @@ class ShowExtensionSlowAction extends Action {
constructor
(
readonly
extension
:
IExtensionDescription
,
readonly
repoInfo
:
RepoInfo
,
readonly
profile
:
IExtensionHostProfile
,
@
IDialogService
private
readonly
_dialogService
:
IDialogService
,
)
{
super
(
'
show.slow
'
,
localize
(
'
cmd.show
'
,
"
Show Issues
"
));
}
async
run
():
Promise
<
void
>
{
// rewrite pii (paths) and store on disk
const
profiler
=
await
import
(
'
v8-inspect-profiler
'
);
const
data
=
profiler
.
rewriteAbsolutePaths
({
profile
:
<
any
>
this
.
profile
.
data
},
'
pii_removed
'
);
const
path
=
join
(
os
.
homedir
(),
`
${
this
.
extension
.
identifier
.
value
}
-unresponsive.cpuprofile.txt`
);
await
profiler
.
writeProfile
(
data
,
path
).
then
(
undefined
,
onUnexpectedError
);
// show issues
const
url
=
`
${
this
.
repoInfo
.
base
}
/
${
this
.
repoInfo
.
owner
}
/
${
this
.
repoInfo
.
repo
}
/issues?utf8=✓&q=is%3Aissue+state%3Aopen+%22Extension+causes+high+cpu+load%22`
;
window
.
open
(
url
);
this
.
_dialogService
.
show
(
Severity
.
Info
,
localize
(
'
attach.title
'
,
"
Did you attach the CPU-Profile?
"
),
[
localize
(
'
ok
'
,
'
OK
'
)],
{
detail
:
localize
(
'
attach.msg2
'
,
"
This is a reminder to make sure that you have not forgotten to attach '{0}' to an existing performance issue.
"
,
path
)
}
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录