Skip to content

Commit 7d91ace

Browse files
Merge remote-tracking branch 'upstream/main' into feature/support-string-cp-splitting
2 parents 888a2cf + 486f915 commit 7d91ace

15 files changed

Lines changed: 849 additions & 4 deletions

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @testforstephen @jdneo
1+
* @testforstephen @jdneo @wenytang-ms @chagong

.github/workflows/triage-agent.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: AI Triage - Label and Comment on New Issues
1+
name: AI Triage
22

33
on:
44
issues:
@@ -9,6 +9,9 @@ on:
99
description: 'Issue number to triage (manual run). e.g. 123'
1010
required: true
1111

12+
run-name: >-
13+
AI Triage for Issue #${{ github.event.issue.number || github.event.inputs.issue_number }}
14+
1215
permissions:
1316
issues: write
1417
contents: read
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: AI Triage - Process All Open Issues
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
dry_run:
6+
description: 'Dry run mode - only list issues without processing'
7+
required: false
8+
default: false
9+
type: boolean
10+
max_issues:
11+
description: 'Maximum number of issues to process (0 = all)'
12+
required: false
13+
default: '0'
14+
type: string
15+
16+
permissions:
17+
issues: write
18+
contents: read
19+
actions: write
20+
21+
jobs:
22+
get_open_issues:
23+
runs-on: ubuntu-latest
24+
outputs:
25+
issue_numbers: ${{ steps.get_issues.outputs.issue_numbers }}
26+
total_count: ${{ steps.get_issues.outputs.total_count }}
27+
28+
steps:
29+
- name: Get all open issues
30+
id: get_issues
31+
uses: actions/github-script@v6
32+
with:
33+
script: |
34+
// Use Search API to filter issues at API level
35+
const { data } = await github.rest.search.issuesAndPullRequests({
36+
q: `repo:${context.repo.owner}/${context.repo.repo} is:issue is:open -label:ai-triaged -label:invalid`,
37+
sort: 'created',
38+
order: 'desc',
39+
per_page: 100
40+
});
41+
42+
const actualIssues = data.items;
43+
44+
let issuesToProcess = actualIssues;
45+
const maxIssues = parseInt('${{ inputs.max_issues }}' || '0');
46+
47+
if (maxIssues > 0 && actualIssues.length > maxIssues) {
48+
issuesToProcess = actualIssues.slice(0, maxIssues);
49+
console.log(`Limiting to first ${maxIssues} issues out of ${actualIssues.length} total`);
50+
}
51+
52+
const issueNumbers = issuesToProcess.map(issue => issue.number);
53+
const totalCount = issuesToProcess.length;
54+
55+
console.log(`Found ${actualIssues.length} open issues, processing ${totalCount}:`);
56+
issuesToProcess.forEach(issue => {
57+
console.log(` #${issue.number}: ${issue.title}`);
58+
});
59+
60+
core.setOutput('issue_numbers', JSON.stringify(issueNumbers));
61+
core.setOutput('total_count', totalCount);
62+
63+
process_issues:
64+
runs-on: ubuntu-latest
65+
needs: get_open_issues
66+
if: needs.get_open_issues.outputs.total_count > 0
67+
68+
strategy:
69+
# Process issues one by one (max-parallel: 1)
70+
max-parallel: 1
71+
matrix:
72+
issue_number: ${{ fromJSON(needs.get_open_issues.outputs.issue_numbers) }}
73+
74+
steps:
75+
- name: Log current issue being processed
76+
run: |
77+
echo "🔄 Processing issue #${{ matrix.issue_number }}"
78+
echo "Total issues to process: ${{ needs.get_open_issues.outputs.total_count }}"
79+
80+
- name: Check if dry run mode
81+
if: inputs.dry_run == true
82+
run: |
83+
echo "🔍 DRY RUN MODE: Would process issue #${{ matrix.issue_number }}"
84+
echo "Skipping actual triage processing"
85+
86+
- name: Trigger triage workflow for issue
87+
if: inputs.dry_run != true
88+
uses: actions/github-script@v6
89+
with:
90+
script: |
91+
const issueNumber = '${{ matrix.issue_number }}';
92+
93+
try {
94+
console.log(`Triggering triage workflow for issue #${issueNumber}`);
95+
96+
const response = await github.rest.actions.createWorkflowDispatch({
97+
owner: context.repo.owner,
98+
repo: context.repo.repo,
99+
workflow_id: 'triage-agent.yml',
100+
ref: 'main',
101+
inputs: {
102+
issue_number: issueNumber
103+
}
104+
});
105+
106+
console.log(`✅ Successfully triggered triage workflow for issue #${issueNumber}`);
107+
108+
} catch (error) {
109+
console.error(`❌ Failed to trigger triage workflow for issue #${issueNumber}:`, error);
110+
core.setFailed(`Failed to process issue #${issueNumber}: ${error.message}`);
111+
}
112+
113+
- name: Wait for workflow completion
114+
if: inputs.dry_run != true
115+
run: |
116+
echo "⏳ Waiting for triage workflow to complete for issue #${{ matrix.issue_number }}..."
117+
echo "Timeout: ${{ vars.TRIAGE_AGENT_TIMEOUT }} seconds"
118+
sleep ${{ vars.TRIAGE_AGENT_TIMEOUT }} # Wait for triage workflow completion
119+
120+
summary:
121+
runs-on: ubuntu-latest
122+
needs: [get_open_issues, process_issues]
123+
if: always()
124+
125+
steps:
126+
- name: Print summary
127+
run: |
128+
echo "## Triage Processing Summary"
129+
echo "Total open issues found: ${{ needs.get_open_issues.outputs.total_count }}"
130+
131+
if [ "${{ inputs.dry_run }}" == "true" ]; then
132+
echo "Mode: DRY RUN (no actual processing performed)"
133+
else
134+
echo "Mode: FULL PROCESSING"
135+
fi
136+
137+
if [ "${{ needs.process_issues.result }}" == "success" ]; then
138+
echo "✅ All issues processed successfully"
139+
elif [ "${{ needs.process_issues.result }}" == "failure" ]; then
140+
echo "❌ Some issues failed to process"
141+
elif [ "${{ needs.process_issues.result }}" == "skipped" ]; then
142+
echo "⏭️ Processing was skipped (no open issues found)"
143+
else
144+
echo "⚠️ Processing completed with status: ${{ needs.process_issues.result }}"
145+
fi

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ 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.3 - 2025-11-03
8+
### Added
9+
- No config debug [[#1530](https://github.com/microsoft/vscode-java-debug/issues/1530)]
10+
711
## 0.58.2 - 2025-04-28
812
### Fixed
913
- Provide graceful shutdown on debug stop action. [#1274](https://github.com/microsoft/vscode-java-debug/issues/1274). Thanks to [Dave Syer](https://github.com/dsyer) for contribution.
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Java No-Config Debug
2+
3+
This feature enables configuration-less debugging for Java applications, similar to the JavaScript Debug Terminal in VS Code.
4+
5+
## How It Works
6+
7+
When you open a terminal in VS Code with this extension installed, the following environment variables are automatically set:
8+
9+
- `VSCODE_JDWP_ADAPTER_ENDPOINTS`: Path to a communication file for port exchange
10+
- `PATH`: Includes the `debugjava` command wrapper
11+
12+
Note: `JAVA_TOOL_OPTIONS` is NOT set globally to avoid affecting other Java tools (javac, maven, gradle). Instead, it's set only when you run the `debugjava` command.
13+
14+
## Usage
15+
16+
### Basic Usage
17+
18+
Instead of running:
19+
```bash
20+
java -cp . com.example.Main
21+
```
22+
23+
Simply run:
24+
```bash
25+
debugjava -cp . com.example.Main
26+
```
27+
28+
The debugger will automatically attach, and breakpoints will work without any launch.json configuration!
29+
30+
### Maven Projects
31+
32+
```bash
33+
debugjava -jar target/myapp.jar
34+
```
35+
36+
### Gradle Projects
37+
38+
```bash
39+
debugjava -jar build/libs/myapp.jar
40+
```
41+
42+
### With Arguments
43+
44+
```bash
45+
debugjava -cp . com.example.Main arg1 arg2 --flag=value
46+
```
47+
48+
### Spring Boot
49+
50+
```bash
51+
debugjava -jar myapp.jar --spring.profiles.active=dev
52+
```
53+
54+
## Advantages
55+
56+
1. **No Configuration Required**: No need to create or maintain launch.json
57+
2. **Rapid Prototyping**: Perfect for quick debugging sessions
58+
3. **Script Debugging**: Debug applications launched by complex shell scripts
59+
4. **Environment Consistency**: Inherits all terminal environment variables
60+
5. **Parameter Flexibility**: Easy to change arguments using terminal history (↑ key)
61+
62+
## How It Works Internally
63+
64+
1. When you run `debugjava`, the wrapper script temporarily sets `JAVA_TOOL_OPTIONS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=0`
65+
2. The wrapper determines which Java executable to use (priority order):
66+
- First: `JAVA_HOME/bin/java` if JAVA_HOME environment variable is set (user's explicit choice)
67+
- Second: `VSCODE_JAVA_EXEC` environment variable (Java path from VS Code's Java Language Server)
68+
- Third: `java` command from system PATH
69+
3. The wrapper launches the Java process with JDWP enabled
70+
4. JVM starts and outputs: "Listening for transport dt_socket at address: 12345"
71+
5. The wrapper captures the JDWP port from this output
72+
6. The port is written to a communication file
73+
7. VS Code's file watcher detects the file and automatically starts an attach debug session
74+
75+
## Troubleshooting
76+
77+
### Port Already in Use
78+
79+
If you see "Address already in use", another Java debug session is running. Terminate it first.
80+
81+
### No Breakpoints Hit
82+
83+
1. Ensure you're running with `debugjava` command (not plain `java`)
84+
2. Check that the `debugjava` command is available: `which debugjava` (Unix) or `Get-Command debugjava` (PowerShell)
85+
3. Verify the terminal was opened AFTER the extension activated
86+
4. Check the Debug Console for error messages
87+
88+
### Node.js Not Found
89+
90+
The wrapper script requires Node.js to be installed and available in PATH.
91+
92+
## Limitations
93+
94+
- Requires Node.js to be installed and available in PATH
95+
- Only works in terminals opened within VS Code
96+
- Requires using the `debugjava` command instead of `java`
97+
- The Java process will suspend (hang) until the debugger attaches
98+
99+
## See Also
100+
101+
- [Debugger for Java Documentation](https://github.com/microsoft/vscode-java-debug)
102+
- [JDWP Documentation](https://docs.oracle.com/javase/8/docs/technotes/guides/jpda/jdwp-spec.html)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
# Java No-Config Debug Wrapper Script for Unix/Linux/macOS
3+
# This script intercepts java commands and automatically enables JDWP debugging
4+
5+
# Get the directory of this script
6+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
7+
8+
# Set environment variables only for the node process, not the current shell
9+
# This ensures JAVA_TOOL_OPTIONS doesn't affect subsequent commands in the terminal
10+
JDWP_ADAPTER_ENDPOINTS=$VSCODE_JDWP_ADAPTER_ENDPOINTS \
11+
JAVA_TOOL_OPTIONS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=0" \
12+
exec node "$SCRIPT_DIR/jdwp-wrapper.js" "$@"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
@echo off
2+
REM Java No-Config Debug Wrapper Script for Windows
3+
REM This script intercepts java commands and automatically enables JDWP debugging
4+
5+
REM Use setlocal to ensure environment variables don't persist after this script exits
6+
setlocal
7+
8+
REM Export the endpoint file path for JDWP port communication
9+
set JDWP_ADAPTER_ENDPOINTS=%VSCODE_JDWP_ADAPTER_ENDPOINTS%
10+
11+
REM Set JDWP options only for this debugjava invocation
12+
REM This overrides the global JAVA_TOOL_OPTIONS to avoid affecting other Java processes
13+
set JAVA_TOOL_OPTIONS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=0
14+
15+
REM Use Node.js wrapper to capture JDWP port
16+
node "%~dp0jdwp-wrapper.js" %*
17+
18+
REM endlocal is implicit at script exit, but we can call it explicitly for clarity
19+
endlocal
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env fish
2+
# Java No-Config Debug Wrapper Script for Fish Shell
3+
# This script intercepts java commands and automatically enables JDWP debugging
4+
5+
# Get the directory of this script
6+
set script_dir (dirname (status -f))
7+
8+
# Set environment variables only for the node process, not the current shell
9+
# This ensures JAVA_TOOL_OPTIONS doesn't affect subsequent commands in the terminal
10+
env JDWP_ADAPTER_ENDPOINTS=$VSCODE_JDWP_ADAPTER_ENDPOINTS \
11+
JAVA_TOOL_OPTIONS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=0" \
12+
node "$script_dir/jdwp-wrapper.js" $argv
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Java No-Config Debug Wrapper Script for PowerShell
2+
# This script intercepts java commands and automatically enables JDWP debugging
3+
4+
# Get the directory of this script
5+
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
6+
7+
# Save current environment variables to restore later
8+
$oldJavaToolOptions = $env:JAVA_TOOL_OPTIONS
9+
$oldJdwpAdapterEndpoints = $env:JDWP_ADAPTER_ENDPOINTS
10+
11+
try {
12+
# Set environment variables only for this debugjava invocation
13+
$env:JDWP_ADAPTER_ENDPOINTS = $env:VSCODE_JDWP_ADAPTER_ENDPOINTS
14+
$env:JAVA_TOOL_OPTIONS = "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=0"
15+
16+
# Use Node.js wrapper to capture JDWP port
17+
& node (Join-Path $scriptDir "jdwp-wrapper.js") $args
18+
}
19+
finally {
20+
# Restore original environment variables to avoid affecting subsequent commands
21+
if ($null -eq $oldJavaToolOptions) {
22+
Remove-Item Env:\JAVA_TOOL_OPTIONS -ErrorAction SilentlyContinue
23+
} else {
24+
$env:JAVA_TOOL_OPTIONS = $oldJavaToolOptions
25+
}
26+
27+
if ($null -eq $oldJdwpAdapterEndpoints) {
28+
Remove-Item Env:\JDWP_ADAPTER_ENDPOINTS -ErrorAction SilentlyContinue
29+
} else {
30+
$env:JDWP_ADAPTER_ENDPOINTS = $oldJdwpAdapterEndpoints
31+
}
32+
}

0 commit comments

Comments
 (0)