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: prettierd not installing when using prettier extras #406

Closed
3 tasks done
briandipalma opened this issue Mar 10, 2023 · 12 comments · Fixed by #407
Closed
3 tasks done

bug: prettierd not installing when using prettier extras #406

briandipalma opened this issue Mar 10, 2023 · 12 comments · Fixed by #407
Labels
bug Something isn't working

Comments

@briandipalma
Copy link
Contributor

Did you check docs and existing issues?

  • I have read all the LazyVim docs
  • I have searched the existing issues of LazyVim
  • I have searched the exsiting issues of plugins related to this issue

Neovim version (nvim -v)

NVIM v0.8.3

Operating system/version

Linux

Describe the bug

I saw you added extras for ESLint and Prettier so I uninstalled them and moved my configuration to using them, commit here.

I restart and open a few JS/TS files and the ESLint LSP installs fine and works/fixes a few issues. Prettierd though doesn't install...that's not what I would expect given:

opts: your custom opts will be merged with the default opts

Is it maybe the case that I need to order my plugin imports in a certain fashion or that the merging only happens for top level map values or the merging only happens once?

I've also noticed the dependency string for mason is just "mason.nvim" in some places, is that correct?

Steps To Reproduce

.

Expected Behavior

I'd expect prettierd to be installed.

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  "folke/LazyVim",
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
@briandipalma briandipalma added the bug Something isn't working label Mar 10, 2023
@folke folke closed this as completed in 9f30a2e Mar 10, 2023
@folke
Copy link
Collaborator

folke commented Mar 10, 2023

I was actually overwiting ensure_installed for mason, instead of extending it. Just fixed that.

Maybe you also override it in your personal config?

Check the commit above to see how to fix it

@folke
Copy link
Collaborator

folke commented Mar 10, 2023

https://github.com/briandipalma/ansible/blob/main/roles/common/files/nvim/lua/plugins/mason.lua

Either you should include prettierd there, or use a function as in the commit I referenced to correctly extend the list

@folke
Copy link
Collaborator

folke commented Mar 10, 2023

I've also noticed the dependency string for mason is just "mason.nvim" in some places, is that correct?

Yep, that works too

@briandipalma
Copy link
Contributor Author

OK, the thing I don't understand then is how do all the various opts for "neovim/nvim-lspconfig" work? They are all opts tables and not functions that merge into an opts table.

@folke
Copy link
Collaborator

folke commented Mar 10, 2023

check the docs for vim.tbl_deep_extend

@PetarMetodiev
Copy link

Hey, I am also having the same issue - fresh install of LazyVim following the docs and added these lines:

    { import = "lazyvim.plugins.extras.linting.eslint" },
    { import = "lazyvim.plugins.extras.formatting.prettier" },

Everything besides prettierd gets automatically installed. Manually installing prettierd through mason doesn't seem to help - it still does not get picked up by null ls. Does this mean I have to follow the steps here? If so - what is the point of the prettier extra?

Sorry for hijacking the thread, seemed similar to my issue.

@folke
Copy link
Collaborator

folke commented Jul 6, 2023

same as what I mentioned before. You're overriding ensure_installed etc in your own config

@PetarMetodiev
Copy link

PetarMetodiev commented Jul 6, 2023

I am not sure about this - I did a quick grep in my config and didn't find any LSP related ensure_installed overrides. The only place I have it is here:

{
    "nvim-treesitter/nvim-treesitter",
    opts = {
      ensure_installed = {
        "bash",
        "css",
        "scss",
        "html",
        "javascript",
        "jsdoc",
        "json",
        "json5",
        "lua",
        "tsx",
        "typescript",
        "vim",
      },
    -- ...other ts options
    },
  }

There are some examples in the example.lua file but from what I can gather it is not being loaded.

@briandipalma
Copy link
Contributor Author

I'd try with a clean set of config without any of your changes and only vanilla LazyVim. See if that works.

@PetarMetodiev
Copy link

Ok, so here are the results with a clean config and only modifying lazy.lua to have these lines:

    { import = "lazyvim.plugins.extras.linting.eslint" },
    { import = "lazyvim.plugins.extras.formatting.prettier" },

Looking at :Mason I see that all required LSPs are installed, including prettierd:
image
Looking at :LspInfo I see this:
image
null-ls doesn't seem to start automatically and is running in single file mode. I tried manually uninstalling and then installing prettier through mason but that didn't help. When I press <leader>cf (the default keymap for formatting) I see a message in the lower left corner of the editor which shows prettier but the code does not get formatted:

prettier-not-working.mov

@folke
Copy link
Collaborator

folke commented Jul 7, 2023

Prettierd is not an lsp.

Null-ls will always be shown as not starting automatically and in single file mode, that's all normal.

@PetarMetodiev
Copy link

Ah, I see. Thank you both for the help and thank you folke for making LazyVim - it is awesome!

yacineMTB pushed a commit to yacineMTB/nvim_ that referenced this issue Jun 19, 2024
Revert gitsigns keymaps but fix vimdiff and fugitive conflict
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

Successfully merging a pull request may close this issue.

3 participants