Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dprint lsp not formating using exec commands #34

Open
alihammad-gist opened this issue Feb 6, 2024 · 1 comment
Open

dprint lsp not formating using exec commands #34

alihammad-gist opened this issue Feb 6, 2024 · 1 comment

Comments

@alihammad-gist
Copy link

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"
  ]
}
@dsherret
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants