You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit extends the formatting system to support multiple formatter
backends beyond Runic.jl. Users can now choose between preset formatters
("Runic" or "JuliaFormatter") or configure custom formatters with their
own executables.
The formatter configuration has been redesigned from a nested structure
(`formatter.runic.executable`) to a simpler top-level `formatter`
setting that accepts either:
- A preset name string: "Runic" or "JuliaFormatter"
- A custom formatter defined under `formatter.custom` with `executable`
and optional `executable_range` fields
The preset names use proper package names for clarity, while executables
remain as `runic`/`jlfmt` to match the actual binary names.
Due to limitations in Configurations.jl, custom formatters must be
specified in the `[formatter.custom]` section rather than directly as
the `formatter` value. Custom formatters can specify separate
executables for document and range formatting operations.
Additionally, `FormattingOptions` from LSP requests are now propagated
through the formatting pipeline, enabling formatters to respect
client-provided settings like tab size. For JuliaFormatter, the tab size
option is passed via the `--indent` flag. This client-wise setting will
be overwritten by .JuliaFormatter.toml configuration if it's found since
we are using the `--prioritize-config-file` option.
Requires domluna/JuliaFormatter.jl#947 to be merged.
Copy file name to clipboardExpand all lines: package.json
+26-8Lines changed: 26 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -108,19 +108,37 @@
108
108
}
109
109
},
110
110
"formatter": {
111
-
"type": "object",
112
-
"properties": {
113
-
"runic": {
111
+
"oneOf": [
112
+
{
113
+
"type": "string",
114
+
"enum": [
115
+
"Runic",
116
+
"JuliaFormatter"
117
+
],
118
+
"default": "Runic",
119
+
"description": "Preset formatter to use. 'Runic' (default) or 'JuliaFormatter'."
120
+
},
121
+
{
114
122
"type": "object",
115
123
"properties": {
116
-
"executable": {
117
-
"type": "string",
118
-
"default": "",
119
-
"description": "Path to the Runic formatter executable. If empty, uses 'runic' from PATH."
124
+
"custom": {
125
+
"type": "object",
126
+
"properties": {
127
+
"executable": {
128
+
"type": "string",
129
+
"description": "Path to custom formatter executable for document formatting. The formatter should read Julia code from stdin and output formatted code to stdout. Optional."
130
+
},
131
+
"executable_range": {
132
+
"type": "string",
133
+
"description": "Path to custom formatter executable for range formatting. Should accept --lines=START:END argument. Optional."
134
+
}
135
+
}
120
136
}
121
137
}
122
138
}
123
-
}
139
+
],
140
+
"default": "Runic",
141
+
"markdownDescription": "Formatter configuration. Can be a preset name ('Runic' or 'JuliaFormatter') or a custom formatter object. See [Formatting](https://github.com/aviatesk/JETLS.jl#formatting) for details."
0 commit comments