Skip to content

Commit 4e73f5b

Browse files
authored
build: vscode improvements and devcontainer support (#15395)
Add devcontainer.json to support one-click development environment. It installs java 25, runs `gradlew eclipse`, and installs the correct extensions. No popups or confirmations required. Only GitHub codespaces has been tested. Set "Standard" launch mode, the "Lightweight" mode initially started by the default "Hybrid" setup will spew nonsensical diagnostic errors. This is very confusing as it makes the setup appear broken, for a potentially long time, until the "Standard" server is finished indexing (takes ~5mins on my machine). Improve the completion speed, by reducing the amount of auto-imported stuff (favorite static members). Enable inlay hints for inferred variable types (`var` keyword), and inferred parameter types (lambdas). Remove telemetry popup for Red Hat Language Server. Local VSCode user must still deal with 3 popups. but 3 is better than 4. Remove ast-grep extension which errors-out if the binary isn't installed locally. User can install themselves if wanted. Fix outdated 'java 23' in gradlew error code.
1 parent 1e43d4f commit 4e73f5b

File tree

6 files changed

+48
-4
lines changed

6 files changed

+48
-4
lines changed

.devcontainer/devcontainer.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json",
3+
"name": "Apache Lucene",
4+
"service": "lucene",
5+
"features": {
6+
"ghcr.io/devcontainers/features/java:1": {
7+
"version": "25",
8+
"installMaven": "false",
9+
"installGradle": "false"
10+
}
11+
},
12+
"customizations": {
13+
"vscode": {
14+
"extensions": [
15+
"redhat.java",
16+
"editorconfig.editorconfig"
17+
],
18+
"settings": {
19+
"extensions.allowed": {
20+
"vscjava.vscode-java-pack": false,
21+
"vscjava.vscode-gradle": false,
22+
"*": true
23+
}
24+
}
25+
}
26+
},
27+
"updateContentCommand": "cd ${containerWorkspaceFolder} && rm -f .classpath && ./gradlew eclipse"
28+
}

.vscode/extensions.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"recommendations": [
33
"redhat.java",
4-
"editorconfig.editorconfig",
5-
"ast-grep.ast-grep-vscode"
4+
"editorconfig.editorconfig"
65
],
76
"unwantedRecommendations": [
87
"vscjava.vscode-java-pack",

.vscode/settings.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
{
2+
"java.server.launchMode": "Standard",
23
"java.import.gradle.enabled": false,
34
"java.import.maven.enabled": false,
45
"java.jdt.ls.lombokSupport.enabled": false,
56
"java.compile.nullAnalysis.mode": "disabled",
67
"java.completion.maxResults": 500,
8+
"java.completion.favoriteStaticMembers": [ "none.*" ],
79
"java.inlayHints.parameterNames.enabled": "all",
8-
"astGrep.configPath": "gradle/validation/ast-grep/sgconfig.yml"
10+
"java.inlayHints.parameterTypes.enabled": true,
11+
"java.inlayHints.variableTypes.enabled": true,
12+
"redhat.telemetry.enabled": false
913
}

build-tools/build-infra/src/main/java/org/apache/lucene/gradle/plugins/licenses/CheckLicensesPlugin.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ private void configureCheckLicenses(CheckLicensesTask task) {
8383
"**/*.xls",
8484
"**/*.zip",
8585

86+
// JSON doesn't support comments
87+
"**/*.json",
88+
8689
// Ignore build infrastructure and misc utility files.
8790
".asf.yaml",
8891
".dir-locals.el",

gradlew

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

help/IDEs.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ Run the following to set up Eclipse project files:
2929

3030
Open the lucene checkout in VSCode.
3131

32+
GitHub Codespaces
33+
=====
34+
35+
Fork the apache/lucene repository
36+
37+
Browse to https://github.com/codespaces/new
38+
39+
Repository: yourfork/lucene
40+
Click "Create codespace"
41+
3242
Neovim
3343
======
3444

0 commit comments

Comments
 (0)