FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
vscode-java-debug/src/variableMenu.ts at main · 3rdigen/vscode-java-debug · GitHub
3rdigen
/
vscode-java-debug
Public
forked from
microsoft/vscode-java-debug
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
vscode-java-debug
/
src
/
variableMenu.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
99 lines (89 loc) · 5.86 KB
Breadcrumbs
vscode-java-debug
/
src
/
variableMenu.ts
Copy path
File metadata and controls
99 lines (89 loc) · 5.86 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
import
*
as
vscode
from
"vscode"
;
import
{
instrumentOperationAsVsCodeCommand
}
from
"vscode-extension-telemetry-wrapper"
;
export
function
registerVariableMenuCommands
(
context
:
vscode
.
ExtensionContext
)
:
void
{
vscode
.
workspace
.
onDidChangeConfiguration
(
(
event
)
=>
{
if
(
event
.
affectsConfiguration
(
"java.debug.settings"
)
||
event
.
affectsConfiguration
(
"debug.autoExpandLazyVariables"
)
)
{
updateContextKeys
(
)
;
}
}
)
;
// Initialize the context keys
updateContextKeys
(
)
;
context
.
subscriptions
.
push
(
instrumentOperationAsVsCodeCommand
(
"java.debug.variables.showHex"
,
(
)
=>
updateVariableFormatter
(
"showHex"
,
true
)
)
)
;
context
.
subscriptions
.
push
(
instrumentOperationAsVsCodeCommand
(
"java.debug.variables.notShowHex"
,
(
)
=>
updateVariableFormatter
(
"showHex"
,
false
)
)
)
;
context
.
subscriptions
.
push
(
instrumentOperationAsVsCodeCommand
(
"java.debug.variables.showQualifiedNames"
,
(
)
=>
updateVariableFormatter
(
"showQualifiedNames"
,
true
)
)
)
;
context
.
subscriptions
.
push
(
instrumentOperationAsVsCodeCommand
(
"java.debug.variables.notShowQualifiedNames"
,
(
)
=>
updateVariableFormatter
(
"showQualifiedNames"
,
false
)
)
)
;
context
.
subscriptions
.
push
(
instrumentOperationAsVsCodeCommand
(
"java.debug.variables.showStaticVariables"
,
(
)
=>
updateVariableFormatter
(
"showStaticVariables"
,
true
)
)
)
;
context
.
subscriptions
.
push
(
instrumentOperationAsVsCodeCommand
(
"java.debug.variables.notShowStaticVariables"
,
(
)
=>
updateVariableFormatter
(
"showStaticVariables"
,
false
)
)
)
;
context
.
subscriptions
.
push
(
instrumentOperationAsVsCodeCommand
(
"java.debug.variables.showLogicalStructure"
,
(
)
=>
updateVariableFormatter
(
"showLogicalStructure"
,
true
)
)
)
;
context
.
subscriptions
.
push
(
instrumentOperationAsVsCodeCommand
(
"java.debug.variables.notShowLogicalStructure"
,
(
)
=>
updateVariableFormatter
(
"showLogicalStructure"
,
false
)
)
)
;
context
.
subscriptions
.
push
(
instrumentOperationAsVsCodeCommand
(
"java.debug.variables.showToString"
,
(
)
=>
updateVariableFormatter
(
"showToString"
,
true
)
)
)
;
context
.
subscriptions
.
push
(
instrumentOperationAsVsCodeCommand
(
"java.debug.variables.notShowToString"
,
(
)
=>
updateVariableFormatter
(
"showToString"
,
false
)
)
)
;
context
.
subscriptions
.
push
(
instrumentOperationAsVsCodeCommand
(
"java.debug.variables.autoExpandLazyVariables"
,
(
)
=>
toggleLazyVariableSetting
(
true
)
)
)
;
context
.
subscriptions
.
push
(
instrumentOperationAsVsCodeCommand
(
"java.debug.variables.manualExpandLazyVariables"
,
(
)
=>
toggleLazyVariableSetting
(
false
)
)
)
;
}
async
function
updateVariableFormatter
(
key
:
string
,
value
:
any
)
{
const
debugSettingsRoot
:
vscode
.
WorkspaceConfiguration
=
vscode
.
workspace
.
getConfiguration
(
"java.debug.settings"
)
;
// Update the formatter to settings.json
await
debugSettingsRoot
.
update
(
key
,
value
,
getConfigurationTarget
(
"java.debug"
,
"settings"
)
)
;
refreshVariableView
(
)
;
}
function
refreshVariableView
(
)
{
const
debugSettingsRoot
:
vscode
.
WorkspaceConfiguration
=
vscode
.
workspace
.
getConfiguration
(
"java.debug.settings"
)
;
if
(
vscode
.
debug
.
activeDebugSession
&&
vscode
.
debug
.
activeDebugSession
.
type
===
"java"
)
{
const
formatter
:
any
=
{
showHex
:
debugSettingsRoot
.
showHex
,
showQualifiedNames
:
debugSettingsRoot
.
showQualifiedNames
,
showStaticVariables
:
debugSettingsRoot
.
showStaticVariables
,
showLogicalStructure
:
debugSettingsRoot
.
showLogicalStructure
,
showToString
:
debugSettingsRoot
.
showToString
,
}
;
vscode
.
debug
.
activeDebugSession
.
customRequest
(
"refreshVariables"
,
formatter
)
;
}
}
async
function
toggleLazyVariableSetting
(
toggle
:
boolean
)
{
const
javadDebugSettingsRoot
:
vscode
.
WorkspaceConfiguration
=
vscode
.
workspace
.
getConfiguration
(
"java.debug.settings"
)
;
if
(
!
javadDebugSettingsRoot
.
showToString
)
{
await
javadDebugSettingsRoot
.
update
(
"showToString"
,
true
,
getConfigurationTarget
(
"java.debug"
,
"settings"
)
)
;
}
const
debugSettingsRoot
:
vscode
.
WorkspaceConfiguration
=
vscode
.
workspace
.
getConfiguration
(
"debug"
)
;
await
debugSettingsRoot
.
update
(
"autoExpandLazyVariables"
,
toggle
,
getConfigurationTarget
(
"debug"
,
"autoExpandLazyVariables"
)
)
;
refreshVariableView
(
)
;
}
function
getConfigurationTarget
(
section
:
string
,
key
:
string
)
:
vscode
.
ConfigurationTarget
{
const
inspect
=
vscode
.
workspace
.
getConfiguration
(
section
)
.
inspect
(
key
)
;
if
(
inspect
&&
inspect
.
workspaceFolderValue
!==
undefined
)
{
return
vscode
.
ConfigurationTarget
.
WorkspaceFolder
;
}
else
if
(
inspect
&&
inspect
.
workspaceValue
!==
undefined
)
{
return
vscode
.
ConfigurationTarget
.
Workspace
;
}
else
{
return
vscode
.
ConfigurationTarget
.
Global
;
}
}
function
updateContextKeys
(
)
{
const
debugSettingsRoot
:
vscode
.
WorkspaceConfiguration
=
vscode
.
workspace
.
getConfiguration
(
"java.debug.settings"
)
;
if
(
debugSettingsRoot
)
{
vscode
.
commands
.
executeCommand
(
"setContext"
,
"javadebug:showHex"
,
debugSettingsRoot
.
showHex
?
"on"
:
"off"
)
;
vscode
.
commands
.
executeCommand
(
"setContext"
,
"javadebug:showLogicalStructure"
,
debugSettingsRoot
.
showLogicalStructure
?
"on"
:
"off"
)
;
vscode
.
commands
.
executeCommand
(
"setContext"
,
"javadebug:showQualifiedNames"
,
debugSettingsRoot
.
showQualifiedNames
?
"on"
:
"off"
)
;
vscode
.
commands
.
executeCommand
(
"setContext"
,
"javadebug:showStaticVariables"
,
debugSettingsRoot
.
showStaticVariables
?
"on"
:
"off"
)
;
vscode
.
commands
.
executeCommand
(
"setContext"
,
"javadebug:showToString"
,
debugSettingsRoot
.
showToString
?
"on"
:
"off"
)
;
}
const
globalDebugRoot
:
vscode
.
WorkspaceConfiguration
=
vscode
.
workspace
.
getConfiguration
(
"debug"
)
;
if
(
globalDebugRoot
)
{
vscode
.
commands
.
executeCommand
(
"setContext"
,
"javadebug:expandLazyVariable"
,
globalDebugRoot
.
autoExpandLazyVariables
?
"on"
:
"off"
)
;
}
}
Back
|
FazBrowse Home
|
New Git URL