Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
4b543447
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,发现更多精彩内容 >>
提交
4b543447
编写于
8月 31, 2020
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug: respect __vscodeVariableMenuContext
#70377
上级
6aafc4b7
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
22 addition
and
15 deletion
+22
-15
src/vs/workbench/contrib/debug/browser/variablesView.ts
src/vs/workbench/contrib/debug/browser/variablesView.ts
+11
-10
src/vs/workbench/contrib/debug/common/debug.ts
src/vs/workbench/contrib/debug/common/debug.ts
+1
-0
src/vs/workbench/contrib/debug/common/debugModel.ts
src/vs/workbench/contrib/debug/common/debugModel.ts
+10
-5
未找到文件。
src/vs/workbench/contrib/debug/browser/variablesView.ts
浏览文件 @
4b543447
...
...
@@ -8,7 +8,7 @@ import { RunOnceScheduler } from 'vs/base/common/async';
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
{
CollapseAction
}
from
'
vs/workbench/browser/viewlet
'
;
import
{
IViewletViewOptions
}
from
'
vs/workbench/browser/parts/views/viewsViewlet
'
;
import
{
IDebugService
,
IExpression
,
IScope
,
CONTEXT_VARIABLES_FOCUSED
,
IStackFrame
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
import
{
IDebugService
,
IExpression
,
IScope
,
CONTEXT_VARIABLES_FOCUSED
,
IStackFrame
,
CONTEXT_DEBUG_PROTOCOL_VARIABLE_MENU_CONTEXT
}
from
'
vs/workbench/contrib/debug/common/debug
'
;
import
{
Variable
,
Scope
,
ErrorScope
,
StackFrame
}
from
'
vs/workbench/contrib/debug/common/debugModel
'
;
import
{
IContextMenuService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
...
...
@@ -27,7 +27,7 @@ import { IAsyncDataTreeViewState } from 'vs/base/browser/ui/tree/asyncDataTree';
import
{
FuzzyScore
,
createMatches
}
from
'
vs/base/common/filters
'
;
import
{
HighlightedLabel
,
IHighlight
}
from
'
vs/base/browser/ui/highlightedlabel/highlightedLabel
'
;
import
{
IClipboardService
}
from
'
vs/platform/clipboard/common/clipboardService
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IContextKeyService
,
IContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
IViewDescriptorService
}
from
'
vs/workbench/common/views
'
;
import
{
IOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
...
...
@@ -50,6 +50,7 @@ export class VariablesView extends ViewPane {
private
savedViewState
=
new
Map
<
string
,
IAsyncDataTreeViewState
>
();
private
autoExpandedScopes
=
new
Set
<
string
>
();
private
menu
:
IMenu
;
private
debugProtocolVariableMenuContext
:
IContextKey
<
string
>
;
constructor
(
options
:
IViewletViewOptions
,
...
...
@@ -70,6 +71,7 @@ export class VariablesView extends ViewPane {
this
.
menu
=
menuService
.
createMenu
(
MenuId
.
DebugVariablesContext
,
contextKeyService
);
this
.
_register
(
this
.
menu
);
this
.
debugProtocolVariableMenuContext
=
CONTEXT_DEBUG_PROTOCOL_VARIABLE_MENU_CONTEXT
.
bindTo
(
contextKeyService
);
// Use scheduler to prevent unnecessary flashing
this
.
onFocusStackFrameScheduler
=
new
RunOnceScheduler
(
async
()
=>
{
...
...
@@ -193,20 +195,18 @@ export class VariablesView extends ViewPane {
const
actions
:
IAction
[]
=
[];
const
session
=
this
.
debugService
.
getViewModel
().
focusedSession
;
if
(
session
&&
session
.
capabilities
.
supportsSetVariable
)
{
actions
.
push
(
new
Action
(
'
workbench.setValue
'
,
nls
.
localize
(
'
setValue
'
,
"
Set Value
"
),
undefined
,
true
,
()
=>
{
actions
.
push
(
new
Action
(
'
workbench.setValue
'
,
nls
.
localize
(
'
setValue
'
,
"
Set Value
"
),
undefined
,
true
,
async
()
=>
{
this
.
debugService
.
getViewModel
().
setSelectedExpression
(
variable
);
return
Promise
.
resolve
();
}));
}
actions
.
push
(
this
.
instantiationService
.
createInstance
(
CopyValueAction
,
CopyValueAction
.
ID
,
CopyValueAction
.
LABEL
,
variable
,
'
variables
'
));
if
(
variable
.
evaluateName
)
{
actions
.
push
(
new
Action
(
'
debug.copyEvaluatePath
'
,
nls
.
localize
(
'
copyAsExpression
'
,
"
Copy as Expression
"
),
undefined
,
true
,
()
=>
{
return
this
.
clipboardService
.
writeText
(
variable
.
evaluateName
!
);
actions
.
push
(
new
Action
(
'
debug.copyEvaluatePath
'
,
nls
.
localize
(
'
copyAsExpression
'
,
"
Copy as Expression
"
),
undefined
,
true
,
async
()
=>
{
await
this
.
clipboardService
.
writeText
(
variable
.
evaluateName
!
);
}));
actions
.
push
(
new
Separator
());
actions
.
push
(
new
Action
(
'
debug.addToWatchExpressions
'
,
nls
.
localize
(
'
addToWatchExpressions
'
,
"
Add to Watch
"
),
undefined
,
true
,
()
=>
{
actions
.
push
(
new
Action
(
'
debug.addToWatchExpressions
'
,
nls
.
localize
(
'
addToWatchExpressions
'
,
"
Add to Watch
"
),
undefined
,
true
,
async
()
=>
{
this
.
debugService
.
addWatchExpression
(
variable
.
evaluateName
);
return
Promise
.
resolve
(
undefined
);
}));
}
if
(
session
&&
session
.
capabilities
.
supportsDataBreakpoints
)
{
...
...
@@ -214,8 +214,8 @@ export class VariablesView extends ViewPane {
const
dataid
=
response
?.
dataId
;
if
(
response
&&
dataid
)
{
actions
.
push
(
new
Separator
());
actions
.
push
(
new
Action
(
'
debug.breakWhenValueChanges
'
,
nls
.
localize
(
'
breakWhenValueChanges
'
,
"
Break When Value Changes
"
),
undefined
,
true
,
()
=>
{
return
this
.
debugService
.
addDataBreakpoint
(
response
.
description
,
dataid
,
!!
response
.
canPersist
,
response
.
accessTypes
);
actions
.
push
(
new
Action
(
'
debug.breakWhenValueChanges
'
,
nls
.
localize
(
'
breakWhenValueChanges
'
,
"
Break When Value Changes
"
),
undefined
,
true
,
async
()
=>
{
await
this
.
debugService
.
addDataBreakpoint
(
response
.
description
,
dataid
,
!!
response
.
canPersist
,
response
.
accessTypes
);
}));
}
}
...
...
@@ -225,6 +225,7 @@ export class VariablesView extends ViewPane {
variable
:
variable
.
toDebugProtocolObject
()
};
const
actionsDisposable
=
createAndFillInContextMenuActions
(
this
.
menu
,
{
arg
:
context
,
shouldForwardArgs
:
false
},
actions
,
this
.
contextMenuService
);
this
.
debugProtocolVariableMenuContext
.
set
(
variable
.
variableMenuContext
||
''
);
this
.
contextMenuService
.
showContextMenu
({
getAnchor
:
()
=>
e
.
anchor
,
...
...
src/vs/workbench/contrib/debug/common/debug.ts
浏览文件 @
4b543447
...
...
@@ -60,6 +60,7 @@ export const CONTEXT_JUMP_TO_CURSOR_SUPPORTED = new RawContextKey<boolean>('jump
export
const
CONTEXT_STEP_INTO_TARGETS_SUPPORTED
=
new
RawContextKey
<
boolean
>
(
'
stepIntoTargetsSupported
'
,
false
);
export
const
CONTEXT_BREAKPOINTS_EXIST
=
new
RawContextKey
<
boolean
>
(
'
breakpointsExist
'
,
false
);
export
const
CONTEXT_DEBUGGERS_AVAILABLE
=
new
RawContextKey
<
boolean
>
(
'
debuggersAvailable
'
,
false
);
export
const
CONTEXT_DEBUG_PROTOCOL_VARIABLE_MENU_CONTEXT
=
new
RawContextKey
<
string
>
(
'
debugProtocolVariableMenuContext
'
,
undefined
);
export
const
EDITOR_CONTRIBUTION_ID
=
'
editor.contrib.debug
'
;
export
const
BREAKPOINT_EDITOR_CONTRIBUTION_ID
=
'
editor.contrib.breakpoint
'
;
...
...
src/vs/workbench/contrib/debug/common/debugModel.ts
浏览文件 @
4b543447
...
...
@@ -24,6 +24,10 @@ import { mixin } from 'vs/base/common/objects';
import
{
DebugStorage
}
from
'
vs/workbench/contrib/debug/common/debugStorage
'
;
import
{
CancellationTokenSource
}
from
'
vs/base/common/cancellation
'
;
interface
IDebugProtocolVariableWithContext
extends
DebugProtocol
.
Variable
{
__vscodeVariableMenuContext
?:
string
;
}
export
class
ExpressionContainer
implements
IExpressionContainer
{
public
static
readonly
allValues
=
new
Map
<
string
,
string
>
();
...
...
@@ -86,7 +90,7 @@ export class ExpressionContainer implements IExpressionContainer {
for
(
let
i
=
0
;
i
<
numberOfChunks
;
i
++
)
{
const
start
=
(
this
.
startOfVariables
||
0
)
+
i
*
chunkSize
;
const
count
=
Math
.
min
(
chunkSize
,
this
.
indexedVariables
-
i
*
chunkSize
);
children
.
push
(
new
Variable
(
this
.
session
,
this
.
threadId
,
this
,
this
.
reference
,
`[
${
start
}
..
${
start
+
count
-
1
}
]`
,
''
,
''
,
undefined
,
count
,
{
kind
:
'
virtual
'
},
undefined
,
true
,
start
));
children
.
push
(
new
Variable
(
this
.
session
,
this
.
threadId
,
this
,
this
.
reference
,
`[
${
start
}
..
${
start
+
count
-
1
}
]`
,
''
,
''
,
undefined
,
count
,
{
kind
:
'
virtual
'
},
undefined
,
undefined
,
true
,
start
));
}
return
children
;
...
...
@@ -117,14 +121,14 @@ export class ExpressionContainer implements IExpressionContainer {
try
{
const
response
=
await
this
.
session
!
.
variables
(
this
.
reference
||
0
,
this
.
threadId
,
filter
,
start
,
count
);
return
response
&&
response
.
body
&&
response
.
body
.
variables
?
distinct
(
response
.
body
.
variables
.
filter
(
v
=>
!!
v
),
v
=>
v
.
name
).
map
(
v
=>
{
?
distinct
(
response
.
body
.
variables
.
filter
(
v
=>
!!
v
),
v
=>
v
.
name
).
map
(
(
v
:
IDebugProtocolVariableWithContext
)
=>
{
if
(
isString
(
v
.
value
)
&&
isString
(
v
.
name
)
&&
typeof
v
.
variablesReference
===
'
number
'
)
{
return
new
Variable
(
this
.
session
,
this
.
threadId
,
this
,
v
.
variablesReference
,
v
.
name
,
v
.
evaluateName
,
v
.
value
,
v
.
namedVariables
,
v
.
indexedVariables
,
v
.
presentationHint
,
v
.
type
);
return
new
Variable
(
this
.
session
,
this
.
threadId
,
this
,
v
.
variablesReference
,
v
.
name
,
v
.
evaluateName
,
v
.
value
,
v
.
namedVariables
,
v
.
indexedVariables
,
v
.
presentationHint
,
v
.
type
,
v
.
__vscodeVariableMenuContext
);
}
return
new
Variable
(
this
.
session
,
this
.
threadId
,
this
,
0
,
''
,
undefined
,
nls
.
localize
(
'
invalidVariableAttributes
'
,
"
Invalid variable attributes
"
),
0
,
0
,
{
kind
:
'
virtual
'
},
undefined
,
false
);
return
new
Variable
(
this
.
session
,
this
.
threadId
,
this
,
0
,
''
,
undefined
,
nls
.
localize
(
'
invalidVariableAttributes
'
,
"
Invalid variable attributes
"
),
0
,
0
,
{
kind
:
'
virtual
'
},
undefined
,
undefined
,
false
);
})
:
[];
}
catch
(
e
)
{
return
[
new
Variable
(
this
.
session
,
this
.
threadId
,
this
,
0
,
''
,
undefined
,
e
.
message
,
0
,
0
,
{
kind
:
'
virtual
'
},
undefined
,
false
)];
return
[
new
Variable
(
this
.
session
,
this
.
threadId
,
this
,
0
,
''
,
undefined
,
e
.
message
,
0
,
0
,
{
kind
:
'
virtual
'
},
undefined
,
undefined
,
false
)];
}
}
...
...
@@ -218,6 +222,7 @@ export class Variable extends ExpressionContainer implements IExpression {
indexedVariables
:
number
|
undefined
,
public
presentationHint
:
DebugProtocol
.
VariablePresentationHint
|
undefined
,
public
type
:
string
|
undefined
=
undefined
,
public
variableMenuContext
:
string
|
undefined
=
undefined
,
public
available
=
true
,
startOfVariables
=
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录