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

feat(tsserver plugins): Allow for path in tsserver_plugins #322

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Parsifa1
Copy link

@Parsifa1 Parsifa1 commented Jan 21, 2025

maybe closed #287

what i did

add a another way to add tsserver_plugins:

{
	name = "xxx",
	path = "xxx",
}

and can be mixed with string.

example:

local mason_path = vim.fn.stdpath "data" .. "/mason/packages/"
local ft = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue", "markdown.mdx" }

return {
    "pmizio/typescript-tools.nvim",
    ft = ft,
    dependencies = "nvim-lua/plenary.nvim",
    opts = {
        filetypes = ft,
        settings = {
            tsserver_plugins = {
                "@vue/typescript-plugin",        
                {
                    name = "@mdxjs/typescript-plugin",
                    path = mason_path .. "mdx-analyzer" .. "/node_modules/@mdx/language-server",
                },
            },
        },
    },
}

@Parsifa1 Parsifa1 changed the title feat(tsserver_plugins): Allow for path in tsserver_plugins feat(tsserver plugins): Allow for path in tsserver_plugins Jan 21, 2025
@Parsifa1
Copy link
Author

ci failed due to codelen not from this pr :X

@wvffle
Copy link

wvffle commented Jan 23, 2025

could we get this merged? It is critical for NixOS users.

@SafariKnight
Copy link

Shouldn't there also be a way to specify specific languages/filetypes for each plugin?

Like the lspconfig docs include this to enable the vue plugins for ts_ls

  init_options = {
    plugins = {
      {
        name = "@vue/typescript-plugin",
        location = "/usr/local/lib/node_modules/@vue/typescript-plugin",
        languages = {"javascript", "typescript", "vue"},
      },
    },
  },

@Parsifa1
Copy link
Author

you are right, this is way more better.

and i think it should be added into doc, some people like me didn't know we can even did it like this🥲

@Parsifa1 Parsifa1 closed this Jan 24, 2025
@wvffle
Copy link

wvffle commented Jan 24, 2025

@Parsifa1 This PR seems to be valid, what's the reason for closing? I think that the project would benefit from it even if the same things can be configured through lspconfig.

@Parsifa1
Copy link
Author

Parsifa1 commented Jan 24, 2025

@wvffle I misunderstood what he meant. I thought TypeScript-tools already had the init_options function, but I realized it now. I will reopen it

@Parsifa1 Parsifa1 reopened this Jan 24, 2025
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

Successfully merging this pull request may close these issues.

Allow for path in tsserver_plugins
3 participants