Skip to content

Commit 3c176b8

Browse files
authored
Merge branch 'main' into dependabot/npm_and_yarn/tmp-0.2.4
2 parents c4d4e61 + 64737bc commit 3c176b8

File tree

24 files changed

+928
-29
lines changed

24 files changed

+928
-29
lines changed

.azure-pipelines/nightly.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ extends:
2020
template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate
2121
parameters:
2222
pool:
23-
name: MSEngSS-MicroBuild2022-1ES
23+
name: VSEngSS-MicroBuild2022-1ES
24+
settings:
25+
networkIsolationPolicy: Permissive
2426
stages:
2527
- stage: Build
2628
jobs:
@@ -31,6 +33,7 @@ extends:
3133
signing:
3234
enabled: true
3335
signType: real
36+
signWithProd: true
3437
zipSources: false
3538
feedSource: 'https://mseng.pkgs.visualstudio.com/DefaultCollection/_packaging/MicroBuildToolset/nuget/v3/index.json'
3639
outputs:

.azure-pipelines/rc.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ extends:
1515
template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate
1616
parameters:
1717
pool:
18-
name: MSEngSS-MicroBuild2022-1ES
18+
name: VSEngSS-MicroBuild2022-1ES
19+
settings:
20+
networkIsolationPolicy: Permissive
1921
stages:
2022
- stage: Build
2123
jobs:
@@ -26,6 +28,7 @@ extends:
2628
signing:
2729
enabled: true
2830
signType: real
31+
signWithProd: true
2932
zipSources: false
3033
feedSource: 'https://mseng.pkgs.visualstudio.com/DefaultCollection/_packaging/MicroBuildToolset/nuget/v3/index.json'
3134
outputs:
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# This pipeline is used to release the Project Manager for Java VSCode extension from the nightly/stable build.
2+
# It contains following steps:
3+
# 1. Download the plugin artifact from the nightly/stable build pipeline.
4+
# 2. Publish the plugin to the marketplace.
5+
6+
name: $(Date:yyyyMMdd).$(Rev:r) # Use the current date and a revision number for the build name.
7+
8+
variables:
9+
- name: Codeql.Enabled
10+
value: true
11+
resources:
12+
repositories:
13+
- repository: self
14+
type: git
15+
ref: refs/heads/main
16+
- repository: 1esPipelines
17+
type: git
18+
name: 1ESPipelineTemplates/1ESPipelineTemplates
19+
ref: refs/tags/release
20+
trigger: none
21+
extends:
22+
template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines
23+
parameters:
24+
pool:
25+
os: linux
26+
name: 1ES_JavaTooling_Pool
27+
image: 1ES_JavaTooling_Ubuntu-2004
28+
stages:
29+
- stage: Release
30+
jobs:
31+
- job: Job
32+
displayName: Release Project Manager for Java VSCode Extension
33+
templateContext:
34+
type: releaseJob
35+
isProduction: true
36+
inputs:
37+
- input: pipelineArtifact
38+
buildType: specific
39+
project: $(AzDo.ProjectId) # Azure DevOps project ID
40+
definition: $(AzDo.BuildPipelineId) # artifact build pipeline ID
41+
artifactName: extension
42+
downloadType: specific
43+
targetPath: '$(Build.SourcesDirectory)'
44+
steps:
45+
- task: NodeTool@0
46+
displayName: Use Node 20.x
47+
inputs:
48+
versionSpec: 20.x
49+
- task: AzureCLI@2
50+
displayName: 'Publish Extension'
51+
inputs:
52+
azureSubscription: 'VSCode-Ext-Publishing'
53+
scriptType: pscore
54+
scriptLocation: inlineScript
55+
inlineScript: 'npx @vscode/vsce@latest publish -i ''$(Build.SourcesDirectory)/extension.vsix'' --manifestPath ''$(Build.SourcesDirectory)/extension.manifest'' --signaturePath ''$(Build.SourcesDirectory)/extension.signature.p7s'' --azure-credential'

.azure-pipelines/release.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# This pipeline is used to release the Project Manager for Java VSCode extension from the nightly/stable build.
2+
# It contains following steps:
3+
# 1. Download the plugin artifact from the nightly/stable build pipeline.
4+
# 2. Publish the plugin to the marketplace.
5+
6+
name: $(Date:yyyyMMdd).$(Rev:r) # Use the current date and a revision number for the build name.
7+
8+
variables:
9+
- name: Codeql.Enabled
10+
value: true
11+
resources:
12+
repositories:
13+
- repository: self
14+
type: git
15+
ref: refs/heads/main
16+
- repository: 1esPipelines
17+
type: git
18+
name: 1ESPipelineTemplates/1ESPipelineTemplates
19+
ref: refs/tags/release
20+
trigger: none
21+
extends:
22+
template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines
23+
parameters:
24+
pool:
25+
os: linux
26+
name: 1ES_JavaTooling_Pool
27+
image: 1ES_JavaTooling_Ubuntu-2004
28+
stages:
29+
- stage: Release
30+
jobs:
31+
- job: Job
32+
displayName: Release Project Manager for Java VSCode Extension
33+
templateContext:
34+
type: releaseJob
35+
isProduction: true
36+
inputs:
37+
- input: pipelineArtifact
38+
buildType: specific
39+
project: $(AzDo.ProjectId) # Azure DevOps project ID
40+
definition: $(AzDo.BuildPipelineId) # artifact build pipeline ID
41+
artifactName: extension
42+
downloadType: specific
43+
targetPath: '$(Build.SourcesDirectory)'
44+
steps:
45+
- task: NodeTool@0
46+
displayName: Use Node 20.x
47+
inputs:
48+
versionSpec: 20.x
49+
- task: AzureCLI@2
50+
displayName: 'Publish Extension'
51+
inputs:
52+
azureSubscription: 'VSCode-Ext-Publishing'
53+
scriptType: pscore
54+
scriptLocation: inlineScript
55+
inlineScript: 'npx @vscode/vsce@latest publish -i ''$(Build.SourcesDirectory)/extension.vsix'' --manifestPath ''$(Build.SourcesDirectory)/extension.manifest'' --signaturePath ''$(Build.SourcesDirectory)/extension.signature.p7s'' --azure-credential'

.github/llms.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Extension Pack for Java
2+
Extension Pack for Java is a collection of popular extensions that can help write, test and debug Java applications in Visual Studio Code. By installing Extension Pack for Java, the following extensions are installed:
3+
4+
- [📦 Language Support for Java™ by Red Hat ](https://marketplace.visualstudio.com/items?itemName=redhat.java)
5+
- Code Navigation
6+
- Auto Completion
7+
- Refactoring
8+
- Code Snippets
9+
- [📦 Debugger for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-debug)
10+
- Debugging
11+
- [📦 Test Runner for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-test)
12+
- Run & Debug JUnit/TestNG Test Cases
13+
- [📦 Maven for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-maven)
14+
- Project Scaffolding
15+
- Custom Goals
16+
- [📦 Gradle for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-gradle)
17+
- View Gradle tasks and project dependencies
18+
- Gradle file authoring
19+
- Import Gradle projects via [Gradle Build Server](https://github.com/microsoft/build-server-for-gradle)
20+
- [📦 Project Manager for Java](https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-dependency)
21+
- Manage Java projects, referenced libraries, resource files, packages, classes, and class members
22+
- [📦 Visual Studio IntelliCode](https://marketplace.visualstudio.com/items?itemName=VisualStudioExptTeam.vscodeintellicode)
23+
- AI-assisted development
24+
- Completion list ranked by AI
25+
26+
## Label
27+
When labeling an issue, follow the rules below per label category:
28+
### General Rules
29+
- Analyze if the issue is related with the scope of using extensions for Java development. If not, STOP labelling IMMEDIATELY.
30+
- Assign label per category.
31+
- If a category is not applicable or you're unsure, you may skip it.
32+
- Do not assign multiple labels within the same category, unless explicitly allowed as an exception.
33+
34+
### Issue Type Labels
35+
- [bug]: Primary label for real bug issues
36+
- [enhancement]: Primary label for enhancement issues
37+
- [documentation]: Primary label for documentation issues
38+
- [question]: Primary label for question issues

.github/workflows/triage-agent.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: AI Triage - Label and Comment on New Issues
2+
on:
3+
issues:
4+
types: [opened]
5+
workflow_dispatch:
6+
inputs:
7+
issue_number:
8+
description: 'Issue number to triage (manual run). e.g. 123'
9+
required: true
10+
11+
permissions:
12+
issues: write
13+
contents: read
14+
15+
jobs:
16+
label_and_comment:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v2
22+
23+
- name: Get issue data
24+
id: get_issue
25+
uses: actions/github-script@v6
26+
with:
27+
script: |
28+
const eventName = context.eventName;
29+
let issue;
30+
if (eventName === 'workflow_dispatch') {
31+
const inputs = context.payload.inputs || {};
32+
const issueNumber = inputs.issue_number || inputs.issueNumber;
33+
if (!issueNumber) core.setFailed('Input issue_number is required for manual run.');
34+
const { data } = await github.rest.issues.get({
35+
owner: context.repo.owner,
36+
repo: context.repo.repo,
37+
issue_number: parseInt(issueNumber, 10),
38+
});
39+
issue = data;
40+
} else if (context.payload.issue) {
41+
issue = context.payload.issue;
42+
} else {
43+
core.setFailed('No issue information found in the event payload.');
44+
}
45+
core.setOutput('id', String(issue.number));
46+
core.setOutput('user', String((issue.user && issue.user.login) || ''));
47+
core.setOutput('title', String(issue.title || ''));
48+
core.setOutput('body', String(issue.body || ''));
49+
const labelNames = (issue.labels || []).map(label => label.name);
50+
core.setOutput('labels', JSON.stringify(labelNames));
51+
52+
- name: Call Azure Function
53+
id: call_azure_function
54+
env:
55+
PAYLOAD: >-
56+
{
57+
"authToken": "${{ secrets.GITHUB_TOKEN }}",
58+
"repoId": "microsoft/vscode-java-dependency",
59+
"issueData": {
60+
"id": ${{ steps.get_issue.outputs.id }},
61+
"user": ${{ toJson(steps.get_issue.outputs.user) }},
62+
"title": ${{ toJson(steps.get_issue.outputs.title) }},
63+
"body": ${{ toJson(steps.get_issue.outputs.body) }},
64+
"labels": ${{ steps.get_issue.outputs.labels }}
65+
},
66+
"mode": "DirectUpdate"
67+
}
68+
69+
run: |
70+
# Make the HTTP request with improved error handling and timeouts
71+
echo "Making request to triage agent..."
72+
73+
# Add timeout handling and better error detection
74+
set +e # Don't exit on curl failure
75+
response=$(timeout ${{ vars.TRIAGE_AGENT_TIMEOUT }} curl \
76+
--max-time 0 \
77+
--connect-timeout 30 \
78+
--fail-with-body \
79+
--silent \
80+
--show-error \
81+
--write-out "HTTPSTATUS:%{http_code}" \
82+
--header "Content-Type: application/json" \
83+
--request POST \
84+
--data "$PAYLOAD" \
85+
${{ secrets.TRIAGE_FUNCTION_LINK }} 2>&1)
86+
87+
curl_exit_code=$?
88+
set -e # Re-enable exit on error
89+
90+
echo "Curl exit code: $curl_exit_code"
91+
92+
# Check if curl command timed out or failed
93+
if [ $curl_exit_code -eq 124 ]; then
94+
echo "❌ Request timed out after 650 seconds"
95+
exit 1
96+
elif [ $curl_exit_code -ne 0 ]; then
97+
echo "❌ Curl command failed with exit code: $curl_exit_code"
98+
echo "Response: $response"
99+
exit 1
100+
fi
101+
102+
# Extract HTTP status code and response body
103+
http_code=$(echo "$response" | grep -o "HTTPSTATUS:[0-9]*" | cut -d: -f2)
104+
response_body=$(echo "$response" | sed 's/HTTPSTATUS:[0-9]*$//')
105+
106+
echo "HTTP Status Code: $http_code"
107+
108+
# Validate HTTP status code
109+
if [ -z "$http_code" ]; then
110+
echo "❌ Failed to extract HTTP status code from response"
111+
echo "Raw response: $response"
112+
exit 1
113+
fi
114+
115+
# Check if the request was successful
116+
if [ "$http_code" -ge 200 ] && [ "$http_code" -lt 300 ]; then
117+
echo "✅ Azure Function call succeeded"
118+
else
119+
echo "❌ Azure Function call failed with status code: $http_code"
120+
echo "Response: $response_body"
121+
exit 1
122+
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-dependency" extension will be documented
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## 0.25.0
8+
- feat - Remind users to upgrade old (<21) Java and EOL Spring Boot/Framework versions by @FluoriteCafe-work in https://github.com/microsoft/vscode-java-dependency/pull/901
9+
- feat - Improve ProjectCommand.getMainClasses by @snjeza in https://github.com/microsoft/vscode-java-dependency/pull/883
10+
711
## 0.24.1
812
* Graal Cloud Native Launcher extension renamed. by @dbalek in https://github.com/microsoft/vscode-java-dependency/pull/849
913
* ux - display maven and gradle dependencies with pattern 'groupId:artifactId:version ' by @mamilic in https://github.com/microsoft/vscode-java-dependency/pull/859

jdtls.ext/com.microsoft.jdtls.ext.core/src/com/microsoft/jdtls/ext/core/ProjectCommand.java

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.io.IOException;
2020
import java.util.ArrayList;
2121
import java.util.Arrays;
22+
import java.util.Collections;
2223
import java.util.HashSet;
2324
import java.util.List;
2425
import java.util.Objects;
@@ -65,6 +66,7 @@
6566
import org.eclipse.jdt.ls.core.internal.managers.ProjectsManager;
6667
import org.eclipse.jdt.ls.core.internal.managers.UpdateClasspathJob;
6768
import org.eclipse.jdt.ls.core.internal.preferences.Preferences.ReferencedLibraries;
69+
import org.eclipse.jdt.ls.core.internal.preferences.Preferences.SearchScope;
6870
import org.eclipse.lsp4j.jsonrpc.json.adapters.CollectionTypeAdapter;
6971
import org.eclipse.lsp4j.jsonrpc.json.adapters.EnumTypeAdapter;
7072

@@ -232,23 +234,32 @@ private static boolean exportJarExecution(String mainClass, Classpath[] classpat
232234
}
233235

234236
public static List<MainClassInfo> getMainClasses(List<Object> arguments, IProgressMonitor monitor) throws Exception {
235-
List<PackageNode> projectList = listProjects(arguments, monitor);
236-
final List<MainClassInfo> res = new ArrayList<>();
237-
List<IJavaElement> searchRoots = new ArrayList<>();
237+
List<Object> args = new ArrayList<>(arguments);
238+
if (args.size() <= 1) {
239+
args.add(Boolean.TRUE);
240+
} else {
241+
args.set(1, Boolean.TRUE);
242+
}
243+
List<PackageNode> projectList = listProjects(args, monitor);
238244
if (projectList.size() == 0) {
239-
return res;
245+
return Collections.emptyList();
240246
}
241-
for (PackageNode project : projectList) {
247+
final List<MainClassInfo> res = new ArrayList<>();
248+
List<IJavaProject> javaProjects = new ArrayList<>();
249+
for (PackageNode project: projectList) {
242250
IJavaProject javaProject = PackageCommand.getJavaProject(project.getUri());
243-
for (IPackageFragmentRoot packageFragmentRoot : javaProject.getAllPackageFragmentRoots()) {
244-
if (!packageFragmentRoot.isArchive()) {
245-
searchRoots.add(packageFragmentRoot);
246-
}
251+
if (javaProject != null && javaProject.exists()) {
252+
javaProjects.add(javaProject);
247253
}
248254
}
249-
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(searchRoots.toArray(new IJavaElement[0]));
250-
SearchPattern pattern = SearchPattern.createPattern("main(String[]) void", IJavaSearchConstants.METHOD,
251-
IJavaSearchConstants.DECLARATIONS, SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE);
255+
int includeMask = IJavaSearchScope.SOURCES;
256+
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(javaProjects.toArray(new IJavaProject[0]),
257+
includeMask);
258+
SearchPattern pattern1 = SearchPattern.createPattern("main(String[]) void", IJavaSearchConstants.METHOD,
259+
IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CASE_SENSITIVE | SearchPattern.R_EXACT_MATCH);
260+
SearchPattern pattern2 = SearchPattern.createPattern("main() void", IJavaSearchConstants.METHOD,
261+
IJavaSearchConstants.DECLARATIONS, SearchPattern.R_CASE_SENSITIVE | SearchPattern.R_EXACT_MATCH);
262+
SearchPattern pattern = SearchPattern.createOrPattern(pattern1, pattern2);
252263
SearchRequestor requestor = new SearchRequestor() {
253264
@Override
254265
public void acceptSearchMatch(SearchMatch match) {
@@ -275,7 +286,7 @@ public void acceptSearchMatch(SearchMatch match) {
275286
SearchEngine searchEngine = new SearchEngine();
276287
try {
277288
searchEngine.search(pattern, new SearchParticipant[] {SearchEngine.getDefaultSearchParticipant()}, scope,
278-
requestor, new NullProgressMonitor());
289+
requestor, monitor);
279290
} catch (CoreException e) {
280291
// ignore
281292
}

0 commit comments

Comments
 (0)