dprint-plugin-exec
dprint-plugin-exec copied to clipboard
dprint lsp not formating using exec commands
It seems dprint lsp doesn't format using commands provided in exec section. dprint fmt works for exec commands though. I use the following global configuration, which i reference when starting an lsp or using fmt using --config path argument. I am using neovim and I make sure that an lsp client is attached to current buffer, which is connected to dprint lsp, filetypes like markdown and json etc are formatted by dprint lsp fine but perl files aren't which are mentioned in commands exts field, as seen below.
{
"typescript": {
},
"json": {
},
"markdown": {
"lineWidth": 67,
"textWrap": "always"
},
"toml": {
},
"dockerfile": {
},
"exec": {
"commands": [
{
"command": "perltidy -l 67 -i 2",
"exts": ["pl", "pm"]
}
]
},
"excludes": [
"**/node_modules",
"**/*-lock.json"
],
"plugins": [
"https://plugins.dprint.dev/typescript-0.88.10.wasm",
"https://plugins.dprint.dev/json-0.19.1.wasm",
"https://plugins.dprint.dev/markdown-0.16.3.wasm",
"https://plugins.dprint.dev/toml-0.6.0.wasm",
"https://plugins.dprint.dev/dockerfile-0.3.0.wasm",
"https://plugins.dprint.dev/prettier-0.35.0.json@0df49c4d878bb1051af2fa1d1f69ba6400f4b78633f49baa1f38954a6fd32b40",
"https://plugins.dprint.dev/exec-0.4.4.json@c207bf9b9a4ee1f0ecb75c594f774924baf62e8e53a2ce9d873816a408cecbf7"
]
}
Can you try running the following commands in your project:
dprint upgrade && dprint config update
Then add this to the "cwd" setting?
"exec": {
"cwd": "${configDir}",
// ...etc...
}
Maybe that might fix it by causing it to use the config directory for the cwd when launching the executables.