Skip to content

Commit 0a65a5a

Browse files
committed
config: Adjust documentations
1 parent 2945085 commit 0a65a5a

File tree

2 files changed

+61
-30
lines changed

2 files changed

+61
-30
lines changed

docs/src/configuration.md

Lines changed: 57 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,32 @@
33
JETLS supports various configuration options.
44
This documentation uses TOML format to describe the configuration schema.
55

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)
732

833
- [`[full_analysis]`](@ref config/full_analysis)
934
- [`[full_analysis] debounce`](@ref config/full_analysis-debounce)
@@ -37,13 +62,23 @@ debounce = 2.0 # Wait 2 seconds after save before analyzing
3762
- **Type**: string or table
3863
- **Default**: `"Runic"`
3964

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.
4266

4367
Preset options:
4468

4569
- `"Runic"` (default): Uses [Runic.jl](https://github.com/fredrikekre/Runic.jl)
70+
(`"runic"` or `"runic.bat"` on Windows)
4671
- `"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.
4782

4883
Examples:
4984

@@ -104,33 +139,31 @@ match_type = "literal" # "literal" or "regex"
104139
severity = "hint" # severity level
105140
```
106141

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
109146
- `"code"`: Match against [diagnostic code](@ref diagnostic-code) (e.g., `"lowering/unused-argument"`)
110147
- `"message"`: Match against diagnostic message text
111-
- `match_type`: How to interpret the pattern
148+
- `match_type` (**Type**: string): How to interpret the pattern
112149
- `"literal"`: Exact string match
113150
- `"regex"`: Regular expression match
114-
- `severity`: Severity level to apply (see below)
151+
- `severity` (**Type**: string or number): Severity level to apply
115152

116153
##### Severity values
117154

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:
123157

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
127163

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.
134167

135168
##### Pattern matching priority
136169

@@ -230,13 +263,11 @@ additional examples and common use cases.
230263

231264
#### [`[testrunner] executable`](@id config/testrunner-executable)
232265

233-
- **Type**: string (path)
234-
- **Default**: `"testrunner"` (or `"testrunner.bat"` on Windows)
266+
- **Type**: string
267+
- **Default**: `"testrunner"` or `"testrunner.bat"` on Windows
235268

236269
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.
240271

241272
```toml
242273
[testrunner]

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,11 @@
116116
"properties": {
117117
"executable": {
118118
"type": "string",
119-
"description": "Path to custom formatter executable for document formatting. The formatter should read Julia code from stdin and output formatted code to stdout. Optional."
119+
"description": "Path to custom formatter executable for document formatting. Optional."
120120
},
121121
"executable_range": {
122122
"type": "string",
123-
"description": "Path to custom formatter executable for range formatting. Should accept --lines=START:END argument. Optional."
123+
"description": "Path to custom formatter executable for range formatting. Optional."
124124
}
125125
}
126126
}
@@ -208,8 +208,8 @@
208208
"properties": {
209209
"executable": {
210210
"type": "string",
211-
"default": "",
212-
"description": "Path to the TestRunner.jl executable. If empty, uses 'testrunner' from PATH."
211+
"default": "testrunner",
212+
"description": "Path to the TestRunner.jl executable. If not set, uses 'testrunner' from PATH."
213213
}
214214
}
215215
}

0 commit comments

Comments
 (0)