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

bug: deno fmt not recognizing --ext #553

Open
2 tasks done
jakubdonovan opened this issue Oct 21, 2024 · 4 comments
Open
2 tasks done

bug: deno fmt not recognizing --ext #553

jakubdonovan opened this issue Oct 21, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@jakubdonovan
Copy link

jakubdonovan commented Oct 21, 2024

Neovim version (nvim -v)

NVIM v0.10.0

Operating system/version

MacOS 14.6.1

Read debugging tips

Add the debug logs

  • I have set log_level = vim.log.levels.DEBUG and pasted the log contents below.

Log file

2024-10-21 17:05:06[INFO] deno_fmt exited with code 1
2024-10-21 17:05:06[DEBUG] deno_fmt stdout: { "" }
2024-10-21 17:05:06[DEBUG] deno_fmt stderr: { "\27[0m\27[1m\27[31merror\27[0m: a value is required for '--ext ' but none was supplied", " [possible values: ts, tsx, js, jsx, md, json, jsonc, css, scss, sass, less, html, svelte, vue, astro, yml, yaml, ipynb]", "", "" }
2024-10-21 17:05:06[ERROR] Formatter 'deno_fmt' error: �[0m�[1m�[31merror�[0m: a value is required for '--ext ' but none was supplied
[possible values: ts, tsx, js, jsx, md, json, jsonc, css, scss, sass, less, html, svelte, vue, astro, yml, yaml, ipynb]

Formatters for this buffer:
LSP: svelte
deno_fmt ready (svelte, javascriptreact, markdown, jsonc, javascript, typescriptreact, json, html, css, typescript) /Users/jakubdonovan/.local/share/nvim/mason/bin/deno

Describe the bug

Unable to format svelte files with deno_fmt. Here's the relevant extract of my conform setup. All other files format as they should, but svelte files fail to format.

 formatters_by_ft = {
    svelte = {
      "deno_fmt",
      args = { "--ext", "svelte", "--stdin-filepath", "$FILENAME", "--unstable-component" },
    }
  },

  format_on_save = {
    enabled = true,
    timeout_ms = 2000,
    lsp_fallback = true,
  }

As you can see,deno supports formatting of svelte files.

Screenshot 2024-10-21 at 17 09 59

What is the severity of this bug?

minor (annoyance)

Steps To Reproduce

open svelte file and try to format it

Expected Behavior

it should format

Minimal example file

No response

Minimal init.lua

No response

Additional context

No response

@jakubdonovan jakubdonovan added the bug Something isn't working label Oct 21, 2024
@Ryoschin
Copy link

Having the same issue, NixOS. (if it means anything)

@AlbinFrick
Copy link

Same here

@stevearc
Copy link
Owner

I don't know where you got this syntax from, but it is not correct

 formatters_by_ft = {
    svelte = {
      "deno_fmt",
      args = { "--ext", "svelte", "--stdin-filepath", "$FILENAME", "--unstable-component" },
    }
  },

The formatters_by_ft table is for specifying the formatters that run and some options that get passed to conform.format (e.g. stop_after_first or lsp_format). It is not for customizing how a specific formatter will run; that is done with the formatters table.

Another note, the deno_fmt formatter should automatically handle svelte files without any customization of args as of #552. If you are not on the most recent version of conform, try updating.

Lastly, if you're still having trouble please follow the instructions under debugging tips. I notice the logs do not include the line which tells you exactly which arguments are being passed to the deno fmt command. That is kind of important to know if you're trying to figure out what's going wrong.

@stevearc stevearc added the question Further information is requested label Oct 31, 2024
@AlbinFrick
Copy link

I had missed an update to conform. The latest version works fine for svelte files for me now.

@github-actions github-actions bot removed the question Further information is requested label Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants