Skip to content

Commit 0ae563c

Browse files
authored
Merge branch 'main' into feature/support-string-cp-splitting
2 parents 85d0515 + 359a857 commit 0ae563c

File tree

13 files changed

+2974
-44
lines changed

13 files changed

+2974
-44
lines changed

.github/workflows/build.yml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
timeout-minutes: 30
1414
steps:
15-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v5
1616

1717
- name: Setup Build Environment
1818
run: |
@@ -21,13 +21,14 @@ jobs:
2121
sudo /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
2222
sleep 3
2323
24-
- name: Set up JDK 11
25-
uses: actions/setup-java@v1
24+
- name: Set up JDK 21
25+
uses: actions/setup-java@v5
2626
with:
27-
java-version: '11'
27+
java-version: '21'
28+
distribution: 'temurin'
2829

2930
- name: Setup Node.js environment
30-
uses: actions/setup-node@v2
31+
uses: actions/setup-node@v5
3132
with:
3233
node-version: 20
3334

@@ -55,15 +56,16 @@ jobs:
5556
runs-on: windows-latest
5657
timeout-minutes: 30
5758
steps:
58-
- uses: actions/checkout@v2
59+
- uses: actions/checkout@v5
5960

60-
- name: Set up JDK 11
61-
uses: actions/setup-java@v1
61+
- name: Set up JDK 21
62+
uses: actions/setup-java@v5
6263
with:
63-
java-version: '11'
64+
java-version: '21'
65+
distribution: 'temurin'
6466

6567
- name: Setup Node.js environment
66-
uses: actions/setup-node@v2
68+
uses: actions/setup-node@v5
6769
with:
6870
node-version: 20
6971

@@ -91,15 +93,16 @@ jobs:
9193
runs-on: macos-latest
9294
timeout-minutes: 30
9395
steps:
94-
- uses: actions/checkout@v2
96+
- uses: actions/checkout@v5
9597

96-
- name: Set up JDK 11
97-
uses: actions/setup-java@v1
98+
- name: Set up JDK 21
99+
uses: actions/setup-java@v5
98100
with:
99-
java-version: '11'
101+
java-version: '21'
102+
distribution: 'temurin'
100103

101104
- name: Setup Node.js environment
102-
uses: actions/setup-node@v2
105+
uses: actions/setup-node@v5
103106
with:
104107
node-version: 20
105108

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to the "vscode-java-debugger" extension will be documented i
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## 0.58.5 - 2025-12-17
8+
### Added
9+
- Support custom debug java agent. [#1593](https://github.com/microsoft/vscode-java-debug/pull/1593).
10+
11+
### Fixed
12+
- Fix `lspFrame.source.path` is null. [java-debug#618](https://github.com/microsoft/java-debug/pull/618).
13+
714
## 0.58.4 - 2025-12-09
815
### Added
916
- Add command to manage breakpoint exception types in command palette. [#1566](https://github.com/microsoft/vscode-java-debug/pull/1566). Thanks to [Roland Schaer](https://github.com/roele) for contribution.

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ A lightweight Java Debugger based on [Java Debug Server](https://github.com/Micr
1717
- Debug console
1818
- Evaluation
1919
- Hot Code Replace
20+
- No-Config Debug (debug Java apps without launch.json)
21+
- **[AI]** AI-Assisted Debugging (GitHub Copilot integration)
2022

2123
## Requirements
2224
- JDK (version 1.8.0 or later)
@@ -41,6 +43,38 @@ ext install vscode-java-debug
4143

4244
Please also check the documentation of [Language Support for Java by Red Hat](https://marketplace.visualstudio.com/items?itemName=redhat.java) if you have trouble setting up your project.
4345

46+
## No-Config Debug
47+
48+
You can now debug Java applications without creating a `launch.json` file! Simply open a terminal in VS Code and use the `debugjava` command:
49+
50+
```bash
51+
# Debug a main class
52+
debugjava -cp bin com.example.Main
53+
54+
# Debug a JAR file
55+
debugjava -jar target/myapp.jar
56+
57+
# Debug with arguments
58+
debugjava -cp bin com.example.Main arg1 arg2
59+
```
60+
61+
The debugger will automatically attach. See [No-Config Debug Documentation](bundled/scripts/noConfigScripts/README.md) for more details.
62+
63+
## AI-Assisted Debugging
64+
65+
When using GitHub Copilot Chat, you can now ask AI to help you debug Java applications! The extension provides a Language Model Tool that enables natural language debugging:
66+
67+
- "Debug my Spring Boot application"
68+
- "Debug the Main class in this project"
69+
- "Debug Calculator with arguments 10 and 5"
70+
71+
The AI will automatically:
72+
1. Detect your project type (Maven/Gradle/VS Code)
73+
2. Build/compile your project
74+
3. Start debugging with appropriate configuration
75+
76+
See [Language Model Tool Documentation](bundled/agents/README.md) for more details.
77+
4478
## Options
4579

4680
### Launch

bundled/agents/README.md

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
# Java Debug Agent
2+
3+
The Java Debug Agent is an AI-powered debugging assistant that integrates with GitHub Copilot Chat to help you debug Java applications using natural language.
4+
5+
## Overview
6+
7+
Instead of manually setting breakpoints and inspecting variables, you can simply describe your debugging task in natural language. The agent will:
8+
9+
1. Analyze your code to form hypotheses
10+
2. Set targeted breakpoints
11+
3. Inspect variables and evaluate expressions
12+
4. Find the root cause of bugs
13+
14+
## Requirements
15+
16+
- VS Code 1.95.0 or later
17+
- [Language Support for Java by Red Hat](https://marketplace.visualstudio.com/items?itemName=redhat.java)
18+
- [Debugger for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-debug)
19+
- GitHub Copilot Chat extension
20+
21+
## Getting Started
22+
23+
### 1. Open Copilot Chat
24+
25+
Press `Ctrl+Shift+I` (Windows/Linux) or `Cmd+Shift+I` (macOS) to open Copilot Chat.
26+
27+
### 2. Switch to JavaDebug Agent Mode
28+
29+
In the Copilot Chat panel, click on the agent selector (usually shows "Copilot" or current agent name) and select **JavaDebug** from the dropdown list.
30+
31+
![Select Agent](images/javadebug.png)
32+
<!-- TODO: Add screenshot showing agent selector dropdown -->
33+
34+
### 3. Enter Your Debugging Request
35+
36+
Once in JavaDebug mode, simply type your debugging request:
37+
38+
```
39+
Why am I getting a NullPointerException in OrderService?
40+
```
41+
42+
![Invoke Agent](images/invoke-agent.png)
43+
<!-- TODO: Add screenshot showing chat input -->
44+
45+
### 4. Let the Agent Work
46+
47+
The agent will:
48+
- Read relevant code files
49+
- Form a hypothesis about the bug
50+
- Set breakpoints at strategic locations
51+
- Start or attach to a debug session
52+
- Inspect variables to verify the hypothesis
53+
- Report the root cause
54+
55+
![Agent Working](images/agent-working.png)
56+
<!-- TODO: Add screenshot showing agent analyzing code -->
57+
58+
## Example Usage
59+
60+
### Debug a NullPointerException
61+
62+
```
63+
I'm getting NPE when calling userService.getUser()
64+
```
65+
66+
The agent will:
67+
1. Read `UserService.java`
68+
2. Hypothesize which variable might be null
69+
3. Set a breakpoint before the NPE
70+
4. Check variable values
71+
5. Report: "The `user` variable is null because `findById()` returns null when ID doesn't exist"
72+
73+
### Debug Wrong Calculation Result
74+
75+
```
76+
The calculateTotal() method returns wrong value
77+
```
78+
79+
### Debug with Specific Input
80+
81+
```
82+
Debug processOrder with orderId=456
83+
```
84+
85+
### Debug Multi-threaded Issues
86+
87+
```
88+
I suspect a race condition in the worker threads
89+
```
90+
91+
## Agent Capabilities
92+
93+
| Capability | Description |
94+
|------------|-------------|
95+
| **Start Debug Session** | Launch or attach to Java applications |
96+
| **Set Breakpoints** | Set conditional or unconditional breakpoints |
97+
| **Inspect Variables** | View local variables, fields, and objects |
98+
| **Evaluate Expressions** | Execute Java expressions in debug context |
99+
| **Step Through Code** | Step over, step into, step out |
100+
| **Multi-thread Support** | Debug concurrent applications |
101+
| **Stack Trace Analysis** | View and navigate call stacks |
102+
103+
## How It Works
104+
105+
The agent uses **hypothesis-driven debugging**:
106+
107+
```
108+
┌─────────────────────────────────────────┐
109+
│ 1. STATIC ANALYSIS │
110+
│ Read code, understand the problem │
111+
└─────────────────┬───────────────────────┘
112+
113+
┌─────────────────────────────────────────┐
114+
│ 2. FORM HYPOTHESIS │
115+
│ "Variable X is null at line Y" │
116+
└─────────────────┬───────────────────────┘
117+
118+
┌─────────────────────────────────────────┐
119+
│ 3. SET BREAKPOINT │
120+
│ At the location to verify │
121+
└─────────────────┬───────────────────────┘
122+
123+
┌─────────────────────────────────────────┐
124+
│ 4. VERIFY │
125+
│ Check if hypothesis is correct │
126+
│ ├─ YES → Report root cause │
127+
│ └─ NO → Form new hypothesis │
128+
└─────────────────────────────────────────┘
129+
```
130+
131+
## Tips for Best Results
132+
133+
### Stay in Agent Mode
134+
135+
Make sure you're in **JavaDebug** agent mode (check the agent selector in Chat panel). If you switch back to default Copilot mode, the debugging tools won't be available.
136+
137+
### Be Specific
138+
139+
```
140+
✅ Good: "Why does getUserById return null when id=123?"
141+
❌ Vague: "Something is wrong"
142+
```
143+
144+
### Mention the Error
145+
146+
```
147+
✅ Good: "Getting ArrayIndexOutOfBoundsException in processItems()"
148+
❌ Vague: "Debug processItems"
149+
```
150+
151+
### Provide Context
152+
153+
```
154+
✅ Good: "The order total is $0 instead of $150 for order 456"
155+
❌ Vague: "Wrong calculation"
156+
```
157+
158+
## Troubleshooting
159+
160+
### Agent Can't Find the File
161+
162+
Make sure the Java project is properly loaded. Check that:
163+
- The Java extension is activated (look for Java icon in status bar)
164+
- The project is imported (check Java Projects view)
165+
166+
### Debug Session Won't Start
167+
168+
Ensure:
169+
- Your project compiles successfully
170+
- No other debug session is running
171+
- The main class can be found
172+
173+
### Breakpoint Not Hit
174+
175+
The agent will tell you to trigger the scenario. You need to:
176+
1. Run the part of your application that executes the code
177+
2. The breakpoint will be hit when the code path is executed
178+
179+
## Limitations
180+
181+
- Requires an active Java project with proper configuration
182+
- Cannot debug remote applications without proper attach configuration
183+
- Performance may vary with large codebases
184+
185+
## Feedback
186+
187+
If you encounter issues or have suggestions, please:
188+
- File an issue on [GitHub](https://github.com/microsoft/vscode-java-debug/issues)
189+
- Include the agent's response and your debugging request
190+
191+
## See Also
192+
193+
- [Debugger for Java Documentation](https://github.com/microsoft/vscode-java-debug)
194+
- [No-Config Debug](../scripts/noConfigScripts/README.md)
195+
- [Troubleshooting Guide](../../Troubleshooting.md)

0 commit comments

Comments
 (0)