Implement Lua ALE setup & overhaul documentation

1. Add ale.setup and ale.setup.buffer for pure Lua configuration.
2. Update many global settings to use Booleans instead of numbers to
   make types easiert to work with in Lua.
3. Radically reformat documentation and fix errors to make
   documentation more usable for Neovim users.
This commit is contained in:
w0rp
2025-03-20 21:33:12 +00:00
parent 2280d41b30
commit 400857d758
146 changed files with 5469 additions and 2642 deletions

View File

@@ -5,9 +5,11 @@ ALE Java Integration *ale-java-options*
===============================================================================
checkstyle *ale-java-checkstyle*
g:ale_java_checkstyle_config *g:ale_java_checkstyle_config*
*ale-options.java_checkstyle_config*
*g:ale_java_checkstyle_config*
*b:ale_java_checkstyle_config*
java_checkstyle_config
g:ale_java_checkstyle_config
Type: |String|
Default: `'/google_checks.xml'`
@@ -19,19 +21,21 @@ g:ale_java_checkstyle_config *g:ale_java_checkstyle_config*
The path to the configuration file can be an absolute path or a relative
path. ALE will search for the relative path in parent directories.
g:ale_java_checkstyle_executable *g:ale_java_checkstyle_executable*
*ale-options.java_checkstyle_executable*
*g:ale_java_checkstyle_executable*
*b:ale_java_checkstyle_executable*
java_checkstyle_executable
g:ale_java_checkstyle_executable
Type: |String|
Default: `'checkstyle'`
This variable can be changed to modify the executable used for checkstyle.
g:ale_java_checkstyle_options *g:ale_java_checkstyle_options*
*ale-options.java_checkstyle_options*
*g:ale_java_checkstyle_options*
*b:ale_java_checkstyle_options*
java_checkstyle_options
g:ale_java_checkstyle_options
Type: |String|
Default: `''`
@@ -57,68 +61,80 @@ See |ale-cspell-options|
===============================================================================
javac *ale-java-javac*
g:ale_java_javac_classpath *g:ale_java_javac_classpath*
*ale-options.java_javac_classpath*
*g:ale_java_javac_classpath*
*b:ale_java_javac_classpath*
java_javac_classpath
g:ale_java_javac_classpath
Type: |String| or |List|
Default: `''`
This variable can be set to change the global classpath for Java.
g:ale_java_javac_executable *g:ale_java_javac_executable*
*ale-options.java_javac_executable*
*g:ale_java_javac_executable*
*b:ale_java_javac_executable*
java_javac_executable
g:ale_java_javac_executable
Type: |String|
Default: `'javac'`
This variable can be set to change the executable path used for javac.
g:ale_java_javac_options *g:ale_java_javac_options*
*ale-options.java_javac_options*
*g:ale_java_javac_options*
*b:ale_java_javac_options*
java_javac_options
g:ale_java_javac_options
Type: |String|
Default: `''`
This variable can be set to pass additional options to javac.
g:ale_java_javac_sourcepath *g:ale_java_javac_sourcepath*
*ale-options.java_javac_sourcepath*
*g:ale_java_javac_sourcepath*
*b:ale_java_javac_sourcepath*
java_javac_sourcepath
g:ale_java_javac_sourcepath
Type: |String| or |List|
Default: `''`
This variable can set multiple source code paths, the source code path is a
relative path (relative to the project root directory).
This variable can set multiple source code paths, the source code path is a
relative path (relative to the project root directory).
Example:
The source path can be set as a String with a system-dependent path
separator. Note that the Unix path separator is a colon (`:`), and on
Windows the path separator is a semicolon (`;`). >
String type:
Note that the unix system separator is a colon(`:`) window system
is a semicolon(`;`).
>
let g:ale_java_javac_sourcepath = 'build/gen/source/xx/main:build/gen/source'
<
List type:
>
The source path can be set as a List so ALE will add the appropriate path
separator for the host system automatically. >
let g:ale_java_javac_sourcepath = [
\ 'build/generated/source/querydsl/main',
\ 'target/generated-sources/source/querydsl/main'
\ ]
\ 'build/generated/source/querydsl/main',
\ 'target/generated-sources/source/querydsl/main',
\]
<
===============================================================================
google-java-format *ale-java-google-java-format*
g:ale_java_google_java_format_executable
*ale-options.java_google_java_format_executable*
*g:ale_java_google_java_format_executable*
*b:ale_java_google_java_format_executable*
java_google_java_format_executable
g:ale_java_google_java_format_executable
Type: |String|
Default: `'google-java-format'`
See |ale-integrations-local-executables|
g:ale_java_google_java_format_options *g:ale_java_google_java_format_options*
*ale-options.java_google_java_format_options*
*g:ale_java_google_java_format_options*
*b:ale_java_google_java_format_options*
java_google_java_format_options
g:ale_java_google_java_format_options
Type: |String|
Default: `''`
@@ -128,9 +144,11 @@ g:ale_java_google_java_format_options *g:ale_java_google_java_format_options*
===============================================================================
pmd *ale-java-pmd*
g:ale_java_pmd_options *g:ale_java_pmd_options*
*ale-options.java_pmd_options*
*g:ale_java_pmd_options*
*b:ale_java_pmd_options*
java_pmd_options
g:ale_java_pmd_options
Type: |String|
Default: `'-R category/java/bestpractices'`
@@ -151,56 +169,77 @@ set.
After downloading the source code and installing all pre-requisites you can
build the language server with the included build.sh script:
scripts/build.sh
`scripts/build.sh`
This will create launch scripts for Linux, Mac, and Windows in the dist folder
within the repo:
- lang_server_linux.sh
- lang_server_mac.sh
- lang_server_windows.sh
- `lang_server_linux.sh`
- `lang_server_mac.sh`
- `lang_server_windows.sh`
To let ALE use this language server you need to set the
g:ale_java_javalsp_executable variable to the absolute path of the launcher
executable for your platform.
To let ALE use this language server you need to set the executable, as
documented below.
g:ale_java_javalsp_executable *g:ale_java_javalsp_executable*
*ale-options.java_javalsp_executable*
*g:ale_java_javalsp_executable*
*b:ale_java_javalsp_executable*
java_javalsp_executable
g:ale_java_javalsp_executable
Type: |String|
Default: `''`
This variable must be set to the absolute path of the language server launcher
executable. For example:
>
let g:ale_java_javalsp_executable=/java-language-server/dist/lang_server_linux.sh
<
This variable must be set to the absolute path of the language server
launcher executable. For example: >
g:ale_java_javalsp_config *g:ale_java_javalsp_config*
let g:ale_java_javalsp_executable = '/java-language-server/dist/lang_server_linux.sh'
<
*ale-options.java_javalsp_config*
*g:ale_java_javalsp_config*
*b:ale_java_javalsp_config*
java_javalsp_config
g:ale_java_javalsp_config
Type: |Dictionary|
Default: `{}`
The javalsp linter automatically detects external dependencies for Maven and
Gradle projects. In case the javalsp fails to detect some of them, you can
specify them setting a dictionary to |g:ale_java_javalsp_config| variable.
>
let g:ale_java_javalsp_config =
\ {
\ 'java': {
\ 'externalDependencies': [
\ 'junit:junit:jar:4.12:test', " Maven format
\ 'junit:junit:4.1' " Gradle format
\ ],
\ 'classPath': [
\ 'lib/some-dependency.jar',
\ '/android-sdk/platforms/android-28.jar'
\ ]
\ }
\ }
The javalsp linter automatically detects external dependencies for Maven and
Gradle projects. In case the javalsp fails to detect some of them, you can
specify them configuring settings for the language server, such as in your
ftplugin file. >
The Java language server will look for the dependencies you specify in
`externalDependencies` array in your Maven and Gradle caches ~/.m2 and
~/.gradle.
let b:ale_java_javalsp_config = {
\ 'java': {
\ 'externalDependencies': [
\ 'junit:junit:jar:4.12:test',
\ 'junit:junit:4.1'
\ ],
\ 'classPath': [
\ 'lib/some-dependency.jar',
\ '/android-sdk/platforms/android-28.jar',
\ ],
\ },
\}
<
Or in Lua: >
require("ale").setup.buffer({
java_lsp_config = {
java = {
externalDependencies = {
"junit:junit:jar:4.12:test",
"junit:junit:4.1"
},
classPath = {
"lib/some-dependency.jar",
"/android-sdk/platforms/android-28.jar",
},
},
}
})
<
The Java language server will look for the dependencies you specify in
`externalDependencies` array in your Maven and Gradle caches ~/.m2 and
~/.gradle.
===============================================================================
@@ -210,7 +249,7 @@ To enable Eclipse JDT LSP linter you need to clone and build the eclipse.jdt.ls
language server from https://github.com/eclipse/eclipse.jdt.ls. Simply
clone the source code repo and then build the plugin:
./mvnw clean verify
`./mvnw clean verify`
Note: currently, the build can only run when launched with JDK 11. More
recent versions can be used to run the server though.
@@ -224,9 +263,11 @@ Under your project folder, modify the file `.settings/org.eclipse.jdt.core.prefs
with options presented at
https://help.eclipse.org/neon/topic/org.eclipse.jdt.doc.isv/reference/api/org/eclipse/jdt/core/JavaCore.html.
g:ale_java_eclipselsp_path *g:ale_java_eclipselsp_path*
*ale-options.java_eclipselsp_path*
*g:ale_java_eclipselsp_path*
*b:ale_java_eclipselsp_path*
java_eclipselsp_path
g:ale_java_eclipselsp_path
Type: |String|
Default: `'$HOME/eclipse.jdt.ls'`
@@ -235,32 +276,37 @@ g:ale_java_eclipselsp_path *g:ale_java_eclipselsp_path*
extensions folder (e.g. $HOME/.vscode/extensions/redhat.java-0.4x.0 in
Linux).
g:ale_java_eclipselsp_executable *g:ale_java_eclipse_executable*
*ale-options.java_eclipselsp_executable*
*g:ale_java_eclipselsp_executable*
*b:ale_java_eclipse_executable*
java_eclipselsp_executable
g:ale_java_eclipselsp_executable
Type: |String|
Default: `'java'`
This variable can be set to change the executable path used for java.
g:ale_java_eclipselsp_config_path *g:ale_java_eclipse_config_path*
*ale-options.java_eclipselsp_config_path*
*g:ale_java_eclipselsp_config_path*
*b:ale_java_eclipse_config_path*
java_eclipselsp_config_path
g:ale_java_eclipselsp_config_path
Type: |String|
Default: `''`
Set this variable to change the configuration directory path used by
eclipselsp (e.g. `$HOME/.jdtls` in Linux).
By default ALE will attempt to use the configuration within the installation
directory.
eclipselsp (e.g. `$HOME/.jdtls` in Linux). By default ALE will attempt to
use the configuration within the installation directory.
This setting is particularly useful when eclipselsp is installed in a
non-writable directory like `/usr/share/java/jdtls`, as is the case when
installed via system package.
g:ale_java_eclipselsp_workspace_path *g:ale_java_eclipselsp_workspace_path*
*ale-options.java_eclipselsp_workspace_path*
*g:ale_java_eclipselsp_workspace_path*
*b:ale_java_eclipselsp_workspace_path*
java_eclipselsp_workspace_path
g:ale_java_eclipselsp_workspace_path
Type: |String|
Default: `''`
@@ -268,16 +314,18 @@ g:ale_java_eclipselsp_workspace_path *g:ale_java_eclipselsp_workspace_path*
absolute path of the Eclipse workspace. If not set this value will be set to
the parent folder of the project root.
g:ale_java_eclipselsp_javaagent *g:ale_java_eclipselsp_javaagent*
*ale-options.java_eclipselsp_javaagent*
*g:ale_java_eclipselsp_javaagent*
*b:ale_java_eclipselsp_javaagent*
java_eclipselsp_javaagent
g:ale_java_eclipselsp_javaagent
Type: |String|
Default: `''`
A variable to add java agent for annotation processing such as Lombok.
If you have multiple java agent files, use space to separate them.
For example:
>
For example: >
let g:ale_java_eclipselsp_javaagent='/eclipse/lombok.jar /eclipse/jacoco.jar'
<