diff --git a/README.md b/README.md index 8090666..4840f5c 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ The following settings are supported in [CocConfig][9]: - `java.debug.vimspector.profile` : **(Deprecated)** Set to `null` and use `"default":true` in Vimspector.json instead. Specifies the Vimspector [profile][10] to activate when launching. Set to `null` to be prompted if multiple configurations are found and no default is set. Defaults to `Java Attach` - `java.debug.vimspector.substitution.adapterPort` : Specifies the Vimspector [adapter port][11] substitution name in `.vimspector.json`. The actual port number will replace this value in the Vimspector config when the debug server is started. Defaults to `AdapterPort` +- `java.debug.logLevel`: minimum level of debugger logs that are sent to language server, 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 `false`. - `java.debug.settings.showQualifiedNames`: show fully qualified class names in "Variables" viewlet, defaults to `false`. diff --git a/package.json b/package.json index 26920f4..5a533f9 100644 --- a/package.json +++ b/package.json @@ -112,6 +112,18 @@ "description": "Specifies the Vimspector project name substitution name in `.vimspector.json`. The actual project name will replace this value in the Vimspector config when the debug server is started.", "scope": "window" }, + "java.debug.logLevel": { + "type": "string", + "default": "warn", + "description": "minimum level of debugger logs that are sent to language server", + "enum": [ + "error", + "warn", + "info", + "verbose" + ], + "scope": "window" + }, "java.debug.settings.showHex": { "type": "boolean", "default": false, diff --git a/src/settings.ts b/src/settings.ts index c8f05c5..febba45 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -4,7 +4,7 @@ import {Commands} from "./commands"; export function onConfigurationChange() { return workspace.onDidChangeConfiguration(params => { - if (!params.affectsConfiguration('java.debug.settings')) { + if (!params.affectsConfiguration('java.debug.settings') && !params.affectsConfiguration('java.debug.logLevel')) { return } updateDebugSettings(); @@ -12,60 +12,60 @@ export function onConfigurationChange() { } export async function updateDebugSettings() { - const debugSettingsRoot = workspace.getConfiguration('java.debug.settings'); + const debugSettingsRoot = workspace.getConfiguration('java.debug'); if (!debugSettingsRoot) { return; } const logLevel = convertLogLevel(debugSettingsRoot.logLevel || ""); - if (debugSettingsRoot && Object.keys(debugSettingsRoot).length) { + if (debugSettingsRoot.settings && Object.keys(debugSettingsRoot.settings).length) { try { let extraSettings = {}; - if (debugSettingsRoot.stepping && Object.keys(debugSettingsRoot.stepping).length) { + if (debugSettingsRoot.settings.stepping && Object.keys(debugSettingsRoot.settings.stepping).length) { let stepFilters = {}; - if (debugSettingsRoot.stepping.skipClasses) { - stepFilters["skipClasses"] = await substituteFilterVariables(debugSettingsRoot.stepping.skipClasses); + if (debugSettingsRoot.settings.stepping.skipClasses) { + stepFilters["skipClasses"] = await substituteFilterVariables(debugSettingsRoot.settings.stepping.skipClasses); } - if (debugSettingsRoot.stepping.skipSynthetics) { - stepFilters["skipSynthetics"] = debugSettingsRoot.stepping.skipSynthetics; + if (debugSettingsRoot.settings.stepping.skipSynthetics) { + stepFilters["skipSynthetics"] = debugSettingsRoot.settings.stepping.skipSynthetics; } - if (debugSettingsRoot.stepping.skipStaticInitializers) { - stepFilters["skipStaticInitializers"] = debugSettingsRoot.stepping.skipStaticInitializers; + if (debugSettingsRoot.settings.stepping.skipStaticInitializers) { + stepFilters["skipStaticInitializers"] = debugSettingsRoot.settings.stepping.skipStaticInitializers; } - if (debugSettingsRoot.stepping.skipConstructors) { - stepFilters["skipConstructors"] = debugSettingsRoot.stepping.skipConstructors; + if (debugSettingsRoot.settings.stepping.skipConstructors) { + stepFilters["skipConstructors"] = debugSettingsRoot.settings.stepping.skipConstructors; } extraSettings["stepFilters"] = stepFilters; } - if (debugSettingsRoot.exceptionBreakpoint && Object.keys(debugSettingsRoot.exceptionBreakpoint).length) { + if (debugSettingsRoot.settings.exceptionBreakpoint && Object.keys(debugSettingsRoot.settings.exceptionBreakpoint).length) { let exceptionFilters = {}; - if (debugSettingsRoot.exceptionBreakpoint.exceptionTypes) { - exceptionFilters["exceptionTypes"] = debugSettingsRoot.exceptionBreakpoint.exceptionTypes; + if (debugSettingsRoot.settings.exceptionBreakpoint.exceptionTypes) { + exceptionFilters["exceptionTypes"] = debugSettingsRoot.settings.exceptionBreakpoint.exceptionTypes; } - if (debugSettingsRoot.exceptionBreakpoint.allowClasses) { - exceptionFilters["allowClasses"] = debugSettingsRoot.exceptionBreakpoint.allowClasses; + if (debugSettingsRoot.settings.exceptionBreakpoint.allowClasses) { + exceptionFilters["allowClasses"] = debugSettingsRoot.settings.exceptionBreakpoint.allowClasses; } - if (debugSettingsRoot.exceptionBreakpoint.skipClasses) { - exceptionFilters["skipClasses"] = await substituteFilterVariables(debugSettingsRoot.exceptionBreakpoint.skipClasses); + if (debugSettingsRoot.settings.exceptionBreakpoint.skipClasses) { + exceptionFilters["skipClasses"] = await substituteFilterVariables(debugSettingsRoot.settings.exceptionBreakpoint.skipClasses); } extraSettings["exceptionFilters"] = exceptionFilters; extraSettings["exceptionFiltersUpdated"] = true; } - if (debugSettingsRoot.jdwp) { - if (debugSettingsRoot.jdwp.async) { - extraSettings["asyncJDWP"] = debugSettingsRoot.jdwp.async; + if (debugSettingsRoot.settings.jdwp) { + if (debugSettingsRoot.settings.jdwp.async) { + extraSettings["asyncJDWP"] = debugSettingsRoot.settings.jdwp.async; } - if (debugSettingsRoot.jdwp.limitOfVariablesPerJdwpRequest) { - extraSettings["limitOfVariablesPerJdwpRequest"] = Math.max(debugSettingsRoot.jdwp.limitOfVariablesPerJdwpRequest, 1); + if (debugSettingsRoot.settings.jdwp.limitOfVariablesPerJdwpRequest) { + extraSettings["limitOfVariablesPerJdwpRequest"] = Math.max(debugSettingsRoot.settings.jdwp.limitOfVariablesPerJdwpRequest, 1); } - if (debugSettingsRoot.jdwp.requestTimeout) { - extraSettings["jdwpRequestTimeout"] = Math.max(debugSettingsRoot.jdwp.requestTimeout, 100); + if (debugSettingsRoot.settings.jdwp.requestTimeout) { + extraSettings["requestTimeout"] = Math.max(debugSettingsRoot.settings.jdwp.requestTimeout, 100); } } const settings = await commands.executeCommand(Commands.JAVA_UPDATE_DEBUG_SETTINGS, JSON.stringify( { - ...debugSettingsRoot, + ...debugSettingsRoot.settings, ...extraSettings, logLevel, })); @@ -74,7 +74,6 @@ export async function updateDebugSettings() { } } catch (err) { // log a warning message and continue, since update settings failure should not block debug session - // tslint:disable-next-line:no-console console.error("Cannot update debug settings.", err); } }