|
3 | 3 | JETLS supports various configuration options. |
4 | 4 | This documentation uses TOML format to describe the configuration schema. |
5 | 5 |
|
6 | | -## Available configurations |
| 6 | +## [Configuration schema](@id config/schema) |
| 7 | + |
| 8 | +```toml |
| 9 | +[full_analysis] |
| 10 | +debounce = 1.0 # number (seconds), default: 1.0 |
| 11 | + |
| 12 | +formatter = "Runic" # String preset: "Runic" (default) or "JuliaFormatter" |
| 13 | + |
| 14 | +[formatter.custom] # Or custom formatter configuration |
| 15 | +executable = "" # string (path), optional |
| 16 | +executable_range = "" # string (path), optional |
| 17 | + |
| 18 | +[diagnostic] |
| 19 | +enabled = true # boolean, default: true |
| 20 | + |
| 21 | +[[diagnostic.patterns]] |
| 22 | +pattern = "" # string, required |
| 23 | +match_by = "" # string, required, "code" or "message" |
| 24 | +match_type = "" # string, required, "literal" or "regex" |
| 25 | +severity = "" # string or number, required, "error"/"warning"/"warn"/"information"/"info"/"hint"/"off" or 0/1/2/3/4 |
| 26 | + |
| 27 | +[testrunner] |
| 28 | +executable = "testrunner" # string, default: "testrunner" (or "testrunner.bat" on Windows) |
| 29 | +``` |
| 30 | + |
| 31 | +## [Configuration reference](@id config/reference) |
7 | 32 |
|
8 | 33 | - [`[full_analysis]`](@ref config/full_analysis) |
9 | 34 | - [`[full_analysis] debounce`](@ref config/full_analysis-debounce) |
@@ -37,13 +62,23 @@ debounce = 2.0 # Wait 2 seconds after save before analyzing |
37 | 62 | - **Type**: string or table |
38 | 63 | - **Default**: `"Runic"` |
39 | 64 |
|
40 | | -Configures the formatter backend for document and range formatting. Accepts |
41 | | -either a preset formatter name or a custom formatter configuration. |
| 65 | +Formatter configuration. Can be a preset name or a custom formatter object. |
42 | 66 |
|
43 | 67 | Preset options: |
44 | 68 |
|
45 | 69 | - `"Runic"` (default): Uses [Runic.jl](https://github.com/fredrikekre/Runic.jl) |
| 70 | + (`"runic"` or `"runic.bat"` on Windows) |
46 | 71 | - `"JuliaFormatter"`: Uses [JuliaFormatter.jl](https://github.com/domluna/JuliaFormatter.jl) |
| 72 | + (`"jlfmt"` or `"jlfmt.bat"` on Windows) |
| 73 | + |
| 74 | +Custom formatter configuration: |
| 75 | + |
| 76 | +- `formatter.custom.executable` (string, optional): Path to custom formatter |
| 77 | + executable for document formatting. The formatter should read Julia code from |
| 78 | + stdin and output formatted code to stdout. |
| 79 | +- `formatter.custom.executable_range` (string, optional): Path to custom |
| 80 | + formatter executable for range formatting. Should accept `--lines=START:END` |
| 81 | + argument. |
47 | 82 |
|
48 | 83 | Examples: |
49 | 84 |
|
@@ -104,33 +139,31 @@ match_type = "literal" # "literal" or "regex" |
104 | 139 | severity = "hint" # severity level |
105 | 140 | ``` |
106 | 141 |
|
107 | | -- `pattern`: The pattern to match (string) |
108 | | -- `match_by`: What to match against |
| 142 | +- `pattern` (**Type**: string): The pattern to match. For code matching, use diagnostic |
| 143 | + codes like `"lowering/unused-argument"`. For message matching, use text |
| 144 | + patterns like `"Macro name .* not found"`. |
| 145 | +- `match_by` (**Type**: string): What to match against |
109 | 146 | - `"code"`: Match against [diagnostic code](@ref diagnostic-code) (e.g., `"lowering/unused-argument"`) |
110 | 147 | - `"message"`: Match against diagnostic message text |
111 | | -- `match_type`: How to interpret the pattern |
| 148 | +- `match_type` (**Type**: string): How to interpret the pattern |
112 | 149 | - `"literal"`: Exact string match |
113 | 150 | - `"regex"`: Regular expression match |
114 | | -- `severity`: Severity level to apply (see below) |
| 151 | +- `severity` (**Type**: string or number): Severity level to apply |
115 | 152 |
|
116 | 153 | ##### Severity values |
117 | 154 |
|
118 | | -JETLS supports four severity levels defined by the [LSP specification](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnosticSeverity): |
119 | | -- `Error` (`1`): Critical issues that prevent code from working correctly |
120 | | -- `Warning` (`2`): Potential problems that should be reviewed |
121 | | -- `Information` (`3`): Informational messages about code that may benefit from attention |
122 | | -- `Hint` (`4`): Suggestions for improvements or best practices |
| 155 | +[Severity level](@ref diagnostic-severity) to apply. |
| 156 | +Can be specified using either string or number values: |
123 | 157 |
|
124 | | -Additionally, JETLS defines a special severity value `"off"` (or `0`) for disabling |
125 | | -diagnostics entirely. This is a JETLS-specific extension not defined in the LSP |
126 | | -specification. |
| 158 | +- `"error"` or `1`: Critical issues that prevent code from working correctly |
| 159 | +- `"warning"` or `"warn"` or `2`: Potential problems that should be reviewed |
| 160 | +- `"information"` or `"info"` or `3`: Informational messages about code that may benefit from attention |
| 161 | +- `"hint"` or `4`: Suggestions for improvements or best practices |
| 162 | +- `"off"` or `0`: Disable the diagnostic |
127 | 163 |
|
128 | | -You can specify severity using either string or integer values (case-insensitive for strings): |
129 | | -- `"error"` or `1` for `Error` |
130 | | -- `"warning"` or `"warn"` or `2` for `Warning` |
131 | | -- `"information"` or `"info"` or `3` for `Information` |
132 | | -- `"hint"` or `4` for `Hint` |
133 | | -- `"off"` or `0` for `Disabled` |
| 164 | +String values are case-insensitive. The numeric values correspond to the |
| 165 | +[LSP specification](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnosticSeverity), |
| 166 | +while `"off"`/`0` is a JETLS-specific extension for disabling diagnostics. |
134 | 167 |
|
135 | 168 | ##### Pattern matching priority |
136 | 169 |
|
@@ -230,13 +263,11 @@ additional examples and common use cases. |
230 | 263 |
|
231 | 264 | #### [`[testrunner] executable`](@id config/testrunner-executable) |
232 | 265 |
|
233 | | -- **Type**: string (path) |
234 | | -- **Default**: `"testrunner"` (or `"testrunner.bat"` on Windows) |
| 266 | +- **Type**: string |
| 267 | +- **Default**: `"testrunner"` or `"testrunner.bat"` on Windows |
235 | 268 |
|
236 | 269 | Path to the [TestRunner.jl](https://github.com/aviatesk/TestRunner.jl) |
237 | | -executable for running individual `@testset` blocks and `@test` cases. If not |
238 | | -specified, JETLS looks for `testrunner` in your `PATH` (typically |
239 | | -`~/.julia/bin/testrunner`). |
| 270 | +executable for running individual `@testset` blocks and `@test` cases. |
240 | 271 |
|
241 | 272 | ```toml |
242 | 273 | [testrunner] |
|
0 commit comments