mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-10-24 00:27:57 +00:00
Compare commits
No commits in common. "3f30cef69fb3d667d10575ffa717d5a3386d3d5c" and "6447bdf01348bb51dc3e2fd2158a1bd3ce37c87f" have entirely different histories.
3f30cef69f
...
6447bdf013
2 changed files with 16 additions and 31 deletions
|
|
@ -555,9 +555,3 @@
|
||||||
|
|
||||||
- Add [nvim-highlight-colors] plugin in `vim.ui.nvim-highlight-colors` with
|
- Add [nvim-highlight-colors] plugin in `vim.ui.nvim-highlight-colors` with
|
||||||
`enable` and `setupOpts`
|
`enable` and `setupOpts`
|
||||||
|
|
||||||
[simon-wg](https://github.com/simon-wg):
|
|
||||||
|
|
||||||
- Update `python` language module to use correct lsp binary.
|
|
||||||
- Fix `python` pyright and basedpyright language servers not using default on
|
|
||||||
attach behavior.
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) attrNames;
|
inherit (builtins) attrNames;
|
||||||
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||||
inherit (lib.meta) getExe getExe';
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.modules) mkIf mkMerge;
|
inherit (lib.modules) mkIf mkMerge;
|
||||||
inherit (lib.types) enum package bool;
|
inherit (lib.types) enum package bool;
|
||||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
servers = {
|
servers = {
|
||||||
pyright = {
|
pyright = {
|
||||||
enable = true;
|
enable = true;
|
||||||
cmd = [(getExe' pkgs.pyright "pyright-langserver") "--stdio"];
|
cmd = [(getExe pkgs.pyright) "--stdio"];
|
||||||
filetypes = ["python"];
|
filetypes = ["python"];
|
||||||
root_markers = [
|
root_markers = [
|
||||||
"pyproject.toml"
|
"pyproject.toml"
|
||||||
|
|
@ -42,22 +42,18 @@
|
||||||
};
|
};
|
||||||
on_attach = mkLuaInline ''
|
on_attach = mkLuaInline ''
|
||||||
function(client, bufnr)
|
function(client, bufnr)
|
||||||
default_on_attach(client, bufnr);
|
|
||||||
vim.api.nvim_buf_create_user_command(bufnr, 'LspPyrightOrganizeImports', function()
|
vim.api.nvim_buf_create_user_command(bufnr, 'LspPyrightOrganizeImports', function()
|
||||||
local params = {
|
client:exec_cmd({
|
||||||
command = 'pyright.organizeimports',
|
command = 'pyright.organizeimports',
|
||||||
arguments = { vim.uri_from_bufnr(bufnr) },
|
arguments = { vim.uri_from_bufnr(bufnr) },
|
||||||
}
|
})
|
||||||
|
|
||||||
-- Using client.request() directly because "pyright.organizeimports" is private
|
|
||||||
-- (not advertised via capabilities), which client:exec_cmd() refuses to call.
|
|
||||||
-- https://github.com/neovim/neovim/blob/c333d64663d3b6e0dd9aa440e433d346af4a3d81/runtime/lua/vim/lsp/client.lua#L1024-L1030
|
|
||||||
client.request('workspace/executeCommand', params, nil, bufnr)
|
|
||||||
end, {
|
end, {
|
||||||
desc = 'Organize Imports',
|
desc = 'Organize Imports',
|
||||||
})
|
})
|
||||||
vim.api.nvim_buf_create_user_command(bufnr, 'LspPyrightSetPythonPath', set_python_path, {
|
vim.api.nvim_buf_create_user_command(bufnr, 'LspPyrightSetPythonPath', function(opts)
|
||||||
desc = 'Reconfigure basedpyright with the provided python path',
|
set_python_path('pyright', opts.args)
|
||||||
|
end, {
|
||||||
|
desc = 'Reconfigure pyright with the provided python path',
|
||||||
nargs = 1,
|
nargs = 1,
|
||||||
complete = 'file',
|
complete = 'file',
|
||||||
})
|
})
|
||||||
|
|
@ -67,7 +63,7 @@
|
||||||
|
|
||||||
basedpyright = {
|
basedpyright = {
|
||||||
enable = true;
|
enable = true;
|
||||||
cmd = [(getExe' pkgs.basedpyright "basedpyright-langserver") "--stdio"];
|
cmd = [(getExe pkgs.basedpyright) "--stdio"];
|
||||||
filetypes = ["python"];
|
filetypes = ["python"];
|
||||||
root_markers = [
|
root_markers = [
|
||||||
"pyproject.toml"
|
"pyproject.toml"
|
||||||
|
|
@ -89,22 +85,18 @@
|
||||||
};
|
};
|
||||||
on_attach = mkLuaInline ''
|
on_attach = mkLuaInline ''
|
||||||
function(client, bufnr)
|
function(client, bufnr)
|
||||||
default_on_attach(client, bufnr);
|
|
||||||
vim.api.nvim_buf_create_user_command(bufnr, 'LspPyrightOrganizeImports', function()
|
vim.api.nvim_buf_create_user_command(bufnr, 'LspPyrightOrganizeImports', function()
|
||||||
local params = {
|
client:exec_cmd({
|
||||||
command = 'basedpyright.organizeimports',
|
command = 'basedpyright.organizeimports',
|
||||||
arguments = { vim.uri_from_bufnr(bufnr) },
|
arguments = { vim.uri_from_bufnr(bufnr) },
|
||||||
}
|
})
|
||||||
|
|
||||||
-- Using client.request() directly because "basedpyright.organizeimports" is private
|
|
||||||
-- (not advertised via capabilities), which client:exec_cmd() refuses to call.
|
|
||||||
-- https://github.com/neovim/neovim/blob/c333d64663d3b6e0dd9aa440e433d346af4a3d81/runtime/lua/vim/lsp/client.lua#L1024-L1030
|
|
||||||
client.request('workspace/executeCommand', params, nil, bufnr)
|
|
||||||
end, {
|
end, {
|
||||||
desc = 'Organize Imports',
|
desc = 'Organize Imports',
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.api.nvim_buf_create_user_command(bufnr, 'LspPyrightSetPythonPath', set_python_path, {
|
vim.api.nvim_buf_create_user_command(bufnr, 'LspPyrightSetPythonPath', function(opts)
|
||||||
|
set_python_path('basedpyright', opts.args)
|
||||||
|
end, {
|
||||||
desc = 'Reconfigure basedpyright with the provided python path',
|
desc = 'Reconfigure basedpyright with the provided python path',
|
||||||
nargs = 1,
|
nargs = 1,
|
||||||
complete = 'file',
|
complete = 'file',
|
||||||
|
|
@ -309,8 +301,7 @@ in {
|
||||||
lua
|
lua
|
||||||
*/
|
*/
|
||||||
''
|
''
|
||||||
local function set_python_path(server_name, command)
|
local function set_python_path(server_name, path)
|
||||||
local path = command.args
|
|
||||||
local clients = vim.lsp.get_clients {
|
local clients = vim.lsp.get_clients {
|
||||||
bufnr = vim.api.nvim_get_current_buf(),
|
bufnr = vim.api.nvim_get_current_buf(),
|
||||||
name = server_name,
|
name = server_name,
|
||||||
|
|
@ -321,7 +312,7 @@ in {
|
||||||
else
|
else
|
||||||
client.config.settings = vim.tbl_deep_extend('force', client.config.settings, { python = { pythonPath = path } })
|
client.config.settings = vim.tbl_deep_extend('force', client.config.settings, { python = { pythonPath = path } })
|
||||||
end
|
end
|
||||||
client:notify('workspace/didChangeConfiguration', { settings = nil })
|
client.notify('workspace/didChangeConfiguration', { settings = nil })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue