Browse Source

Add instructions for VS Code integration

pull/44/head
Fredrik Ekre 1 year ago
parent
commit
fa78ba6948
No known key found for this signature in database
GPG Key ID: DE82E6D5E364C0A2
  1. 27
      README.md

27
README.md

@ -130,7 +130,7 @@ require("conform").setup({
formatters = { formatters = {
runic = { runic = {
command = "julia", command = "julia",
args = {"--project=@runic", "-e", "using Runic; exit(Runic.main(ARGS))", "--", "-"}, args = {"--project=@runic", "-e", "using Runic; exit(Runic.main(ARGS))"},
}, },
}, },
formatters_by_ft = { formatters_by_ft = {
@ -150,6 +150,31 @@ enabled by adding the following to your configuration:
vim.o.formatexpr = "v:lua.require('conform').formatexpr()" vim.o.formatexpr = "v:lua.require('conform').formatexpr()"
``` ```
#### VS Code
Runic can be used as a formatter in [VS Code](https://code.visualstudio.com/) using the
extension [Custom Local Formatters](https://marketplace.visualstudio.com/items?itemName=jkillian.custom-local-formatters&ssr=false#overview).
After installing the extension you can configure Runic as a local formatter by adding the
following entry to your `settings.json`:
```json
"customLocalFormatters.formatters": [
{
"command": "julia --project=@runic -e 'using Runic; exit(Runic.main(ARGS))'",
"languages": ["julia"]
}
]
```
Using the "Format Document" VS Code command will now format the file using Runic. Note that
the first time you execute the command you will be prompted to select a formatter since the
Julia language extension also comes with a formatter.
> [!WARNING]
> Note that Custom Local Formatters is a third party extension. It works as advertised but
> use it at your own risk.
## Checking formatting ## Checking formatting
Runic has a check-mode that verifies whether files are correctly formatted or not. This mode Runic has a check-mode that verifies whether files are correctly formatted or not. This mode

Loading…
Cancel
Save