Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1078 Support Show as Binary #1195

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Please also check the documentation of [Language Support for Java by Red Hat](ht
### User Settings

- `java.debug.logLevel`: minimum level of debugger logs that are sent to VS Code, defaults to `warn`.
- `java.debug.settings.showHex`: show numbers in hex format in "Variables" viewlet, defaults to `false`.
- `java.debug.settings.formatType`: show numbers in specified format in "Variables" viewlet, defaults to `DEC`.
- `java.debug.settings.showStaticVariables`: show static variables in "Variables" viewlet, defaults to `false`.
- `java.debug.settings.showQualifiedNames`: show fully qualified class names in "Variables" viewlet, defaults to `false`.
- `java.debug.settings.showLogicalStructure`: show the logical structure for the Collection and Map classes in "Variables" viewlet, defaults to `true`.
Expand Down
52 changes: 42 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,20 @@
"command": "java.debug.pauseOthers",
"title": "Pause Others"
},
{
"command": "java.debug.variables.showBin",
"title": "Show as Bin"
},
{
"command": "java.debug.variables.showOct",
"title": "Show as Oct"
},
{
"command": "java.debug.variables.showHex",
"title": "Show as Hex"
},
{
"command": "java.debug.variables.notShowHex",
"command": "java.debug.variables.showDec",
"title": "Show as Dec"
},
{
Expand Down Expand Up @@ -258,12 +266,20 @@
"command": "java.debug.debugFromProjectView",
"when": "false"
},
{
"command": "java.debug.variables.showBin",
"when": "false"
},
{
"command": "java.debug.variables.showOct",
"when": "false"
},
{
"command": "java.debug.variables.showHex",
"when": "false"
},
{
"command": "java.debug.variables.notShowHex",
"command": "java.debug.variables.showDec",
"when": "false"
},
{
Expand Down Expand Up @@ -300,14 +316,24 @@
}
],
"debug/variables/context": [
{
"command": "java.debug.variables.showBin",
"when": "debugType == 'java' && javadebug:formatType == 'BIN'",
"group": "1_view@1"
},
{
"command": "java.debug.variables.showOct",
"when": "debugType == 'java' && javadebug:formatType == 'OCT'",
"group": "1_view@1"
},
{
"command": "java.debug.variables.showHex",
"when": "debugType == 'java' && javadebug:showHex == 'off'",
"when": "debugType == 'java' && javadebug:formatType == 'HEX'",
"group": "1_view@1"
},
{
"command": "java.debug.variables.notShowHex",
"when": "debugType == 'java' && javadebug:showHex == 'on'",
"command": "java.debug.variables.showDec",
"when": "debugType == 'java' && javadebug:formatType == 'DEC'",
"group": "1_view@1"
},
{
Expand Down Expand Up @@ -767,10 +793,16 @@
"verbose"
]
},
"java.debug.settings.showHex": {
"type": "boolean",
"description": "%java.debugger.configuration.showHex.description%",
"default": false
"java.debug.settings.formatType": {
"type": "string",
"description": "%java.debugger.configuration.formatType.description%",
"default": "DEC",
"enum": [
"BIN",
"OCT",
"HEX",
"DEC"
]
},
"java.debug.settings.showStaticVariables": {
"type": "boolean",
Expand Down Expand Up @@ -968,4 +1000,4 @@
"vscode-languageserver-types": "3.16.0",
"vscode-tas-client": "^0.1.47"
}
}
}
1 change: 0 additions & 1 deletion package.nls.es.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"java.debugger.snippet.attachRemote.description": "Añade una nueva configuración para acoplarse a un programa Java remoto.",
"java.debugger.configuration.title": "Depurador de Java",
"java.debugger.configuration.logLevel.description": "Nivel mínimo de registros de depuración que se envían a VS Code.",
"java.debugger.configuration.showHex.description": "Mostrar los números en formato hexadecimal en la vista \"Variables\".",
"java.debugger.configuration.showStaticVariables.description": "Muestra las variables estáticas en la vista \"Variables\".",
"java.debugger.configuration.showQualifiedNames.description": "Mostrar los nombres de las clases totalmente cualificados en la vista de \"Variables\".",
"java.debugger.configuration.showLogicalStructure.description": "Mostrar la estructura lógica de las clases Collection y Map en la vista de \"Variables\".",
Expand Down
1 change: 0 additions & 1 deletion package.nls.it.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"java.debugger.configuration.title": "Java Debugger",
"java.debugger.configuration.logLevel.description": "Livello dei log di debug minimo inviato a VS Code.",
"java.debugger.configuration.showHex.description": "Mostra numeri in formato esadecimale nella scheda \"variabili\".",
"java.debugger.configuration.showStaticVariables.description": "Mostra variabili statiche nella scheda \"variabili\".",
"java.debugger.configuration.showQualifiedNames.description": "Mostra nome completo delle classi nella scheda \"variabili\".",
"java.debugger.configuration.maxStringLength.description": "Lunghezza massima delle stringhe visualizzate nella scheda \"Variabili\" o \"Console di Debug\", stringhe più lunghe di questo numero verranno tagliate, se 0 nessun taglio viene eseguito.",
Expand Down
2 changes: 1 addition & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"java.debugger.snippet.attachRemote.description": "Add a new configuration for attaching to a remote java program.",
"java.debugger.configuration.title": "Java Debugger",
"java.debugger.configuration.logLevel.description": "Minimum level of debugger logs that are sent to VS Code.",
"java.debugger.configuration.showHex.description": "Show numbers in hex format in \"Variables\" viewlet.",
"java.debugger.configuration.formatType.description": "Show numbers in specified format in \"Variables\" viewlet.",
"java.debugger.configuration.showStaticVariables.description": "Show static variables in \"Variables\" viewlet.",
"java.debugger.configuration.showQualifiedNames.description": "Show fully qualified class names in \"Variables\" viewlet.",
"java.debugger.configuration.showLogicalStructure.description": "Show the logical structure for the Collection and Map classes in \"Variables\" viewlet.",
Expand Down
1 change: 0 additions & 1 deletion package.nls.zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"java.debugger.snippet.attachRemote.description": "附加到远程java程序。",
"java.debugger.configuration.title": "Java调试器",
"java.debugger.configuration.logLevel.description": "Java调试器的日志级别。",
"java.debugger.configuration.showHex.description": "在“变量”视图中以十六进制格式显示数值。",
"java.debugger.configuration.showStaticVariables.description": "在“变量”视图中显示静态变量。",
"java.debugger.configuration.showQualifiedNames.description": "在“变量”视图中显示类的全名。",
"java.debugger.configuration.showLogicalStructure.description": "在“变量”视图中显示Collection和Map类的逻辑结构。",
Expand Down
1 change: 0 additions & 1 deletion package.nls.zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"java.debugger.snippet.attachRemote.description": "附加到遠端 Java 程式。",
"java.debugger.configuration.title": "Java 偵錯器",
"java.debugger.configuration.logLevel.description": "Java 偵錯器的記錄級別。",
"java.debugger.configuration.showHex.description": "在「變數」視圖中以十六進位格式顯示數值。",
"java.debugger.configuration.showStaticVariables.description": "在「變數」視圖中顯示靜態變數。",
"java.debugger.configuration.showQualifiedNames.description": "在「變數」視圖中顯示類別的全名。",
"java.debugger.configuration.showLogicalStructure.description": "在「變數」視圖中顯示 Collection 和 Map 類別的邏輯結構。",
Expand Down
13 changes: 8 additions & 5 deletions src/variableMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ export function registerVariableMenuCommands(context: vscode.ExtensionContext):
});
// Initialize the context keys
updateContextKeys();

context.subscriptions.push(instrumentOperationAsVsCodeCommand(
"java.debug.variables.showHex", () => updateVariableFormatter("showHex", true)));
"java.debug.variables.showBin", () => updateVariableFormatter("formatType", "BIN")));
context.subscriptions.push(instrumentOperationAsVsCodeCommand(
"java.debug.variables.showOct", () => updateVariableFormatter("formatType", "OCT")));
context.subscriptions.push(instrumentOperationAsVsCodeCommand(
"java.debug.variables.showHex", () => updateVariableFormatter("formatType", "HEX")));
context.subscriptions.push(instrumentOperationAsVsCodeCommand(
"java.debug.variables.notShowHex", () => updateVariableFormatter("showHex", false)));
"java.debug.variables.showDec", () => updateVariableFormatter("formatType", "DEC")));
context.subscriptions.push(instrumentOperationAsVsCodeCommand(
"java.debug.variables.showQualifiedNames", () => updateVariableFormatter("showQualifiedNames", true)));
context.subscriptions.push(instrumentOperationAsVsCodeCommand(
Expand All @@ -39,7 +42,7 @@ function updateVariableFormatter(key: string, value: any) {
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,
formatType: debugSettingsRoot.formatType,
showQualifiedNames: debugSettingsRoot.showQualifiedNames,
showStaticVariables: debugSettingsRoot.showStaticVariables,
showLogicalStructure: debugSettingsRoot.showLogicalStructure,
Expand All @@ -63,7 +66,7 @@ function updateVariableFormatter(key: string, value: any) {
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:formatType", debugSettingsRoot.formatType);
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");
Expand Down