-
Notifications
You must be signed in to change notification settings - Fork 167
Using typescript plugins through neovim-lsp #277
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
Comments
Haven't tried personally but README.md mentions that you need to specify the plugin location also: I believe it's a location of a directory and not the plugin itself. |
Having plugins in I tried using name as location and yarn's location like this: init_options = {
plugins = {
{
name = "typescript-svelte-plugin";
location = "./.yarn/unplugged/typescript-svelte-plugin-npm-0.2.5-0efec0bddd/node_modules/typescript-svelte-plugin/";
};
};
}; No success. Even with direct path to Googled |
Can you provide a simple project that I can test this on? |
try ./.yarn/unplugged/typescript-svelte-plugin-npm-0.2.5-0efec0bddd/ @non25 |
Both plugins work fine in simple project which I made for testing. |
Here's my testbench: https://github.com/non25/typescript-ls-testbench My observation is that {
name: "anything-non-empty",
location: "anything-non-empty"
} Language server plugin can also work without being specified in |
I gues you've probably seen the code handling this in this server but if not I'll just mention that it passes names of the plugins through the Here is relevant typescript's code for loading the plugins: https://github.com/microsoft/TypeScript/blob/39ff1568e9676d40cf545477e9fd04077eff9b78/src/server/project.ts#L2277-L2295 With your example project, it works for me without having any plugin specified in init_options. For example here is with only And with |
It is really strange that plugins stop working once I remove lspconfig.tsserver.setup{
handlers = {
["textDocument/definition"] = require('tsreact').handle_gtd
};
cmd = { "yarn", "typescript-language-server", "--stdio" };
on_attach = ts_utils_on_attach;
-- these guys
init_options = {
plugins = {
{
name = "anything";
location = "anything";
};
};
};
--
} https://asciinema.org/a/CLmXeVsYki4X5EJPlKwkwV7yW 🤷♂️ Feel free to close I guess, thanks for the help. |
If there is a way to log the whole LSP communication with the server then that might reveal something. Might be useful to log both the logs with and without |
I don't use For reference, I've tried with the options below. Tried both with and without syntax on
" Specify a directory for plugins
" - For Neovim: stdpath('data') . '/plugged'
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged')
" Make sure you use single quotes
Plug 'neovim/nvim-lspconfig'
" Initialize plugin system
call plug#end()
lua << EOF
require'lspconfig'.tsserver.setup{}
vim.lsp.set_log_level("debug")
local lspconfig = require('lspconfig')
lspconfig.tsserver.setup{
cmd = { "yarn", "typescript-language-server", "--stdio" };
on_attach = ts_utils_on_attach;
-- these guys
init_options = {
plugins = {
{
name = "anything";
location = "anything";
};
};
};
--
}
EOF |
Seems like TS really wants it to exist in a node_modules/ dir. This is the most useful info I found: typescript-language-server/typescript-language-server#277
Hi, thanks for the work. 🙂
It seems that I can't find a way to make plugins like typescript-plugin-css-modules, or typescript-svelte-plugin work through neovim-lsp.
I tried to configure them through
tsconfig.json
like thisand also through neovim lsp config
Can't see expected plugin functionality by doing that. Other LS functionality works fine.
Any help appreciated, thanks. 🙂
The text was updated successfully, but these errors were encountered: