AstroNvim / astrocommunity

A community repository of common plugin specifications
GNU General Public License v3.0
1.19k stars 240 forks source link

[Typescript Pack] Formatting problems #404

Closed rawnly closed 1 year ago

rawnly commented 1 year ago

I'm using the typescript pack (no deno) and I can't figure out how to make prettierd follow the config file. I had to install prettier from mason in order to have formatting enabled following the file.

Also eslint_d warnings are not displayed in the editor, even there I had to install eslint_lsp from maso.

Is this expected?

Uzaaft commented 1 year ago

Do you have a link to your config?

Uzaaft commented 1 year ago

closing the issue due to no answer. Feel free to reopen once you've provided your config.

rawnly commented 1 year ago

Hey @Uzaaft sorry i've been away. here it is https://github.com/rawnly/nvim-config

Uzaaft commented 1 year ago

prettierd follows my config locally.

skriems commented 1 year ago

in your plugins/null-ls.lua file try setting up formatters/linters like

  "jose-elias-alvarez/null-ls.nvim",
  opts = function(_, config)
    -- config variable is the default configuration table for the setup function call
    -- local null_ls = require "null-ls"

    -- Check supported formatters and linters
    -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
    -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
    config.sources = {
      -- Set a formatter
      require("null-ls").builtins.code_actions.eslint_d,
      require("null-ls").builtins.diagnostics.eslint_d,
      require("null-ls").builtins.formatting.eslint_d,
      require("null-ls").builtins.formatting.stylua,
    }
    return config -- return final config table
  end,
}

I had the same problems, eslint not working, prettier not working... So I added those lines above. Notice, that I use eslint_d for formatting here (and not prettier). I normally use eslint-plugin-prettier to configure eslint to use prettier for formatting and eslint-config-prettier to harmonise the linting rules. Not sure if this is working as I would expect. I'm still not completely happy with my setup...

Uzaaft commented 1 year ago

i'm going to go ahead and close this issue, since I can't replicate it.