diff --git a/README.md b/README.md index 147951ad..896c1f9a 100644 --- a/README.md +++ b/README.md @@ -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`. diff --git a/package.json b/package.json index 5fabd7a7..854fdd0f 100644 --- a/package.json +++ b/package.json @@ -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" }, { @@ -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" }, { @@ -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" }, { @@ -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", @@ -968,4 +1000,4 @@ "vscode-languageserver-types": "3.16.0", "vscode-tas-client": "^0.1.47" } -} +} \ No newline at end of file diff --git a/package.nls.es.json b/package.nls.es.json index eff5c8b3..0fa1be6c 100644 --- a/package.nls.es.json +++ b/package.nls.es.json @@ -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\".", diff --git a/package.nls.it.json b/package.nls.it.json index e7654964..28f5bf9a 100644 --- a/package.nls.it.json +++ b/package.nls.it.json @@ -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.", diff --git a/package.nls.json b/package.nls.json index 56dbe29e..479fb196 100644 --- a/package.nls.json +++ b/package.nls.json @@ -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.", diff --git a/package.nls.zh-cn.json b/package.nls.zh-cn.json index 50e98b92..29874807 100644 --- a/package.nls.zh-cn.json +++ b/package.nls.zh-cn.json @@ -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类的逻辑结构。", diff --git a/package.nls.zh-tw.json b/package.nls.zh-tw.json index 9ded8e9d..9dff8900 100644 --- a/package.nls.zh-tw.json +++ b/package.nls.zh-tw.json @@ -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 類別的邏輯結構。", diff --git a/src/variableMenu.ts b/src/variableMenu.ts index 53738ac3..de5e6c41 100644 --- a/src/variableMenu.ts +++ b/src/variableMenu.ts @@ -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( @@ -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, @@ -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");