diff --git a/README.md b/README.md index 0d08729..abe12bb 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,10 @@ 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.showStaticVariables`: show static variables in "Variables" viewlet, defaults to `true`. +- `java.debug.settings.showQualifiedNames`: show fully qualified class names in "Variables" viewlet, defaults to `false`. +- `java.debug.settings.maxStringLength`: the maximum length of string displayed in "Variables" or "Debug Console" viewlet, the string longer than this length will be trimmed, defaults to `0` which means no trim is performed. ## Feedback and Questions You can find the full list of issues at [Issue Tracker](https://github.com/Microsoft/vscode-java-debug/issues). You can submit a [bug or feature suggestion](https://github.com/Microsoft/vscode-java-debug/issues/new), and participate community driven [![Gitter](https://badges.gitter.im/Microsoft/vscode-java-debug.svg)](https://gitter.im/Microsoft/vscode-java-debug) diff --git a/package.json b/package.json index 6a52ca2..ed6f7ba 100644 --- a/package.json +++ b/package.json @@ -190,12 +190,33 @@ "java.debug.logLevel": { "type": "string", "default": "warn", + "description": "minimum level of debugger logs that are sent to VS Code", "enum": [ "error", "warn", "info", "verbose" ] + }, + "java.debug.settings.showHex": { + "type": "boolean", + "description" : "show numbers in hex format in \"Variables\" viewlet.", + "default": false + }, + "java.debug.settings.showStaticVariables": { + "type": "boolean", + "description": "show static variables in \"Variables\" viewlet", + "default": true + }, + "java.debug.settings.showQualifiedNames": { + "type": "boolean", + "description": "show fully qualified class names in \"Variables\" viewlet", + "default": false + }, + "java.debug.settings.maxStringLength": { + "type": "number", + "description": "the maximum length of string displayed in \"Variables\" or \"Debug Console\" viewlet, the string longer than this length will be trimmed, defaults to 0 which means no trim is performed.", + "default": 0 } } } diff --git a/src/commands.ts b/src/commands.ts index 44f6aff..5ddb127 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -19,7 +19,7 @@ export const JAVA_EXECUTE_WORKSPACE_COMMAND = "java.execute.workspaceCommand"; export const JAVA_FETCH_USAGE_DATA = "vscode.java.fetchUsageData"; -export const JAVA_CONFIG_LOG_LEVEL = "vscode.java.configLogLevel"; +export const JAVA_UPDATE_DEBUG_SETTINGS = "vscode.java.updateDebugSettings"; export function executeJavaLanguageServerCommand(...rest) { // TODO: need to handle error and trace telemetry diff --git a/src/configurationProvider.ts b/src/configurationProvider.ts index 39da6bd..4519615 100644 --- a/src/configurationProvider.ts +++ b/src/configurationProvider.ts @@ -6,7 +6,16 @@ import TelemetryReporter from "vscode-extension-telemetry"; import * as commands from "./commands"; export class JavaDebugConfigurationProvider implements vscode.DebugConfigurationProvider { + private isUserSettingsDirty: boolean = true; constructor(private _reporter: TelemetryReporter) { + vscode.workspace.onDidChangeConfiguration((event) => { + if (vscode.debug.activeDebugSession) { + this.isUserSettingsDirty = false; + return updateDebugSettings(); + } else { + this.isUserSettingsDirty = true; + } + }); } // Returns an initial debug configurations based on contextual information. @@ -72,12 +81,9 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration private async heuristicallyResolveDebugConfiguration(folder: vscode.WorkspaceFolder | undefined, config: vscode.DebugConfiguration) { try { - try { - const level = await configLogLevel(vscode.workspace.getConfiguration().get("java.debug.logLevel")); - console.log("setting log level to ", level); - } catch (err) { - // log a warning message and continue, since logger failure should not block debug session - console.log("Cannot set log level to java debuggeer.") + if (this.isUserSettingsDirty) { + this.isUserSettingsDirty = false; + await updateDebugSettings(); } // trigger build workspace @@ -218,8 +224,21 @@ function resolveMainClass() { return commands.executeJavaLanguageServerCommand(commands.JAVA_RESOLVE_MAINCLASS); } -function configLogLevel(level) { - return commands.executeJavaLanguageServerCommand(commands.JAVA_CONFIG_LOG_LEVEL, convertLogLevel(level)); +async function updateDebugSettings() { + const debugSettingsRoot: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration("java.debug"); + if (!debugSettingsRoot) { + return; + } + const logLevel = convertLogLevel(debugSettingsRoot.logLevel || ""); + if (debugSettingsRoot.settings && Object.keys(debugSettingsRoot.settings).length) { + try { + console.log("settings:", await commands.executeJavaLanguageServerCommand(commands.JAVA_UPDATE_DEBUG_SETTINGS, JSON.stringify( + { ...debugSettingsRoot.settings, logLevel }))); + } catch (err) { + // log a warning message and continue, since update settings failure should not block debug session + console.log("Cannot update debug settings.", err) + } + } } function convertLogLevel(commonLogLevel: string) {