Skip to content

Commit 344022b

Browse files
Add a setting to control whether to enable async jdwp (#1208)
* Add a setting to control whether to enable async jdwp
1 parent 8812ccc commit 344022b

File tree

5 files changed

+24
-2
lines changed

5 files changed

+24
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ Please also check the documentation of [Language Support for Java by Red Hat](ht
150150
- `java.debug.settings.stepping.skipConstructors`: Skip constructor methods when stepping.
151151
- `java.debug.settings.jdwp.limitOfVariablesPerJdwpRequest`: The maximum number of variables or fields that can be requested in one JDWP request. The higher the value, the less frequently debuggee will be requested when expanding the variable view. Also a large number can cause JDWP request timeout. Defaults to 100.
152152
- `java.debug.settings.jdwp.requestTimeout`: The timeout (ms) of JDWP request when the debugger communicates with the target JVM. Defaults to 3000.
153+
- `java.debug.settings.jdwp.async`: Experimental: Controls whether the debugger is allowed to send JDWP commands asynchronously. Async mode can improve remote debugging response speed on high-latency networks. Defaults to `auto`, and automatically enable async mode in VS Code - Insiders.
154+
- `auto` (Default)
155+
- `on`
156+
- `off`
153157
- `java.debug.settings.vmArgs`: The default VM arguments to launch the Java program. Eg. Use '-Xmx1G -ea' to increase the heap size to 1GB and enable assertions. If you want to customize the VM arguments for a specific debug session, please modify the 'vmArgs' config in launch.json.
154158
- `java.silentNotification`: Controls whether notifications can be used to report progress. If true, use status bar to report progress instead. Defaults to `false`.
155159

package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,16 @@
922922
"default": 3000,
923923
"minimum": 100
924924
},
925+
"java.debug.settings.jdwp.async": {
926+
"type": "string",
927+
"enum": [
928+
"auto",
929+
"on",
930+
"off"
931+
],
932+
"description": "%java.debugger.configuration.jdwp.async.description%",
933+
"default": "auto"
934+
},
925935
"java.debug.settings.vmArgs": {
926936
"type": "string",
927937
"description": "%java.debugger.configuration.vmArgs.description%",

package.nls.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,6 @@
6969
"java.debugger.configuration.jdwp.limitOfVariablesPerJdwpRequest.description": "The maximum number of variables or fields that can be requested in one JDWP request. The higher the value, the less frequently debuggee will be requested when expanding the variable view. Also a large number can cause JDWP request timeout.",
7070
"java.debugger.configuration.jdwp.requestTimeout.description": "The timeout (ms) of JDWP request when the debugger communicates with the target JVM.",
7171
"java.debugger.configuration.vmArgs.description": "The default VM arguments to launch the Java program. Eg. Use '-Xmx1G -ea' to increase the heap size to 1GB and enable assertions. If you want to customize the VM arguments for a specific debug session, please modify the 'vmArgs' config in launch.json.",
72-
"java.debugger.configuration.silentNotification": "Controls whether notifications can be used to report progress. If true, use status bar to report progress instead."
72+
"java.debugger.configuration.silentNotification": "Controls whether notifications can be used to report progress. If true, use status bar to report progress instead.",
73+
"java.debugger.configuration.jdwp.async.description": "Experimental: Controls whether the debugger is allowed to send JDWP commands asynchronously. Async mode can improve remote debugging response speed on high-latency networks."
7374
}

package.nls.zh-cn.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,6 @@
6666
"java.debugger.configuration.jdwp.limitOfVariablesPerJdwpRequest.description": "一次JDWP请求中可以请求的变量或字段的最大数量。该值越高,在展开变量视图时,请求debuggee的频率就越低。同时数量过大也会导致JDWP请求超时。",
6767
"java.debugger.configuration.jdwp.requestTimeout.description": "调试器与目标JVM通信时JDWP请求的超时时间(ms)。",
6868
"java.debugger.configuration.vmArgs.description": "启动Java程序的默认VM参数。例如,使用'-Xmx1G -ea'将堆大小增加到1GB并启用断言。如果要为特定的调试会话定制VM参数,请修改launch.json中的'vmArgs'配置。",
69-
"java.debugger.configuration.silentNotification": "控制是否可以使用通知来报告进度。如果为真,则使用状态栏来报告进度。"
69+
"java.debugger.configuration.silentNotification": "控制是否可以使用通知来报告进度。如果为真,则使用状态栏来报告进度。",
70+
"java.debugger.configuration.jdwp.async.description": "实验性的:控制是否允许调试器以异步方式发送JDWP命令。异步模式可以提高高延迟网络上的远程调试响应速度。"
7071
}

src/configurationProvider.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,11 @@ async function updateDebugSettings(event?: vscode.ConfigurationChangeEvent) {
737737
const exceptionFilters = {
738738
skipClasses: await substituteFilterVariables(debugSettingsRoot.settings.exceptionBreakpoint.skipClasses),
739739
};
740+
741+
let asyncJDWP: string = debugSettingsRoot.settings.jdwp.async;
742+
if (asyncJDWP === "auto" && vscode.env?.appName === "Visual Studio Code - Insiders") {
743+
asyncJDWP = "on";
744+
}
740745
const settings = await commands.executeJavaLanguageServerCommand(commands.JAVA_UPDATE_DEBUG_SETTINGS, JSON.stringify(
741746
{
742747
...debugSettingsRoot.settings,
@@ -747,6 +752,7 @@ async function updateDebugSettings(event?: vscode.ConfigurationChangeEvent) {
747752
exceptionFiltersUpdated: event && event.affectsConfiguration("java.debug.settings.exceptionBreakpoint.skipClasses"),
748753
limitOfVariablesPerJdwpRequest: Math.max(debugSettingsRoot.settings.jdwp.limitOfVariablesPerJdwpRequest, 1),
749754
jdwpRequestTimeout: Math.max(debugSettingsRoot.settings.jdwp.requestTimeout, 100),
755+
asyncJDWP,
750756
}));
751757
if (logLevel === "FINE") {
752758
// tslint:disable-next-line:no-console

0 commit comments

Comments
 (0)