-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
refactor: rebuild lsp command by api #2051
Conversation
Signed-off-by: Raphael <glephunter@gmail.com>
plugin/lspconfig.lua
Outdated
if vim.fn.exists 'g:lspconfig' == 1 then | ||
return | ||
end | ||
vim.g.lspconfig = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move it to the top? So defining g:lspconfig
will disable it entirely.
plugin/lspconfig.lua
Outdated
@@ -0,0 +1,58 @@ | |||
local api = vim.api | |||
local lspconfig = require 'lspconfig' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can require 'lspconfig'
be inlined in all places where lspconfig
is used? Then we don't force the module to be loaded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
plugin/lspconfig.lua
Outdated
local lspconfig = require 'lspconfig' | ||
local list = lspconfig.available_servers() | ||
return vim.tbl_filter(function(s) | ||
return string.match(s, '^' .. arg) | ||
end, list) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local lspconfig = require 'lspconfig' | |
local list = lspconfig.available_servers() | |
return vim.tbl_filter(function(s) | |
return string.match(s, '^' .. arg) | |
end, list) | |
return vim.tbl_filter(function(s) | |
return s:sub(1, #arg) == arg | |
end, require 'lspconfig'.available_servers()) |
plugin/lspconfig.lua
Outdated
local lspconfig = require 'lspconfig' | ||
lspconfig.lsp_start(args.args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local lspconfig = require 'lspconfig' | |
lspconfig.lsp_start(args.args) | |
require 'lspconfig'.lsp_start(args.args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@glepnir you've missed this one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh sry. fix
plugin/lspconfig.lua
Outdated
local lspconfig = require 'lspconfig' | ||
for _, client in ipairs(lspconfig.util.get_clients_from_cmd_args(cmd_args)) do | ||
client.stop() | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local lspconfig = require 'lspconfig' | |
for _, client in ipairs(lspconfig.util.get_clients_from_cmd_args(cmd_args)) do | |
client.stop() | |
end | |
for _, client in ipairs(require 'lspconfig'.util.get_clients_from_cmd_args(cmd_args)) do | |
client.stop() | |
end |
plugin/lspconfig.lua
Outdated
local lspconfig = require 'lspconfig' | ||
lspconfig.lsp_restart(cmd_args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local lspconfig = require 'lspconfig' | |
lspconfig.lsp_restart(cmd_args) | |
require 'lspconfig'.lsp_restart(cmd_args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
let's revisit after #1984 ? Though maybe this isn't needed if What's the use case that isn't covered by |
This is different from #1984. I just replaced lspconfig.vim. and fixed #2068 now we can use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, this looks like good changes.
This conflicts with #1984 because I would recommend please wait till #1984 is merged. After that, this PR will simply be modifying the |
@ranjithshegde because you don't reply my review so I continue work on this . maybe this will be merge or not @ii14 what do you think? |
My apologies. For whatever reason I wasn't subscribed to this thread. If you could please wait until that is merged, then the job of this PR will be very very simple. All the logic will already have been introduced in #1984, |
this project only provide the server config. not provide any other config should be better. so pass the argument into the cmdline is my way. not use a
I had check your pr when you comment on this pr and I suggest you some changes like this pr. but you didn't reply . |
I don't know, I'm only reviewing the code :) |
cc @justinmk
Fix #2068