From d6ff1ed59412929aa82161d2eb433224c6fc2170 Mon Sep 17 00:00:00 2001 From: ray-x Date: Mon, 9 Oct 2023 12:28:02 +1100 Subject: [PATCH] trying to add python virtualenv --- lua/navigator/diagnostics.lua | 6 +----- lua/navigator/lspclient/clients_default.lua | 4 +++- lua/navigator/treesitter.lua | 3 --- lua/navigator/util.lua | 13 +------------ 4 files changed, 5 insertions(+), 21 deletions(-) diff --git a/lua/navigator/diagnostics.lua b/lua/navigator/diagnostics.lua index f01ce61..4f9eceb 100644 --- a/lua/navigator/diagnostics.lua +++ b/lua/navigator/diagnostics.lua @@ -12,11 +12,7 @@ local empty = util.empty local api = vim.api _NG_VT_DIAG_NS = api.nvim_create_namespace('navigator_lua_diag') -if not util.nvim_0_6_1() then - util.warn( - 'Navigator 0.4+ only support nvim-0.6+, please use Navigator 0.3.x or a newer version of neovim' - ) -end +util.nvim_0_8() local diag_map = {} if vim.diagnostic then diff --git a/lua/navigator/lspclient/clients_default.lua b/lua/navigator/lspclient/clients_default.lua index a47729b..f8269ea 100644 --- a/lua/navigator/lspclient/clients_default.lua +++ b/lua/navigator/lspclient/clients_default.lua @@ -159,13 +159,15 @@ M.defaults = function() require('navigator.lspclient.python').on_init(client) end, on_new_config = function(new_config, new_root_dir) - -- require('navigator.lspclient.python').pyenv_path( new_root_dir) + local python_path = require('navigator.lspclient.python').pyenv_path(new_root_dir) + new_config.settings.python.pythonPath = python_path end, cmd = { 'pyright-langserver', '--stdio' }, filetypes = { 'python' }, flags = { allow_incremental_sync = true, debounce_text_changes = 500 }, settings = { python = { + venvPath = '.', formatting = { provider = 'black' }, analysis = { autoSearchPaths = true, diff --git a/lua/navigator/treesitter.lua b/lua/navigator/treesitter.lua index f1fa871..200ddd4 100644 --- a/lua/navigator/treesitter.lua +++ b/lua/navigator/treesitter.lua @@ -28,9 +28,6 @@ local log = require('navigator.util').log local lerr = require('navigator.util').error local trace = function(...) end trace = log -if vim.fn.has('nvim-0.7') == 1 then - local trace = require('navigator.util').trace -end local get_icon = function(kind) if kind == nil or _NgConfigValues.icons.match_kinds[kind] == nil then diff --git a/lua/navigator/util.lua b/lua/navigator/util.lua index a976996..009b517 100644 --- a/lua/navigator/util.lua +++ b/lua/navigator/util.lua @@ -4,7 +4,6 @@ local M = { log_path = vim.lsp.get_log_path() } -- local is_windows = uv.os_uname().version:match("Windows") local guihua = require('guihua.util') -local nvim_0_6_1 local nvim_0_8 local vfn = vim.fn local api = vim.api @@ -386,17 +385,6 @@ function M.get_current_winid() return api.nvim_get_current_win() end -function M.nvim_0_6_1() - if nvim_0_6_1 ~= nil then - return nvim_0_6_1 - end - nvim_0_6_1 = vfn.has('nvim-0.6.1') == 1 - if nvim_0_6_1 == false then - M.warn('Please use navigator 0.3 version for neovim version < 0.6.1') - end - return nvim_0_6_1 -end - function M.nvim_0_8() if nvim_0_8 ~= nil then return nvim_0_8 @@ -404,6 +392,7 @@ function M.nvim_0_8() nvim_0_8 = vfn.has('nvim-0.8') == 1 if nvim_0_8 == false then M.log('Please use navigator 0.4 version for neovim version < 0.8') + vim.notify('Please use navigator 0.4 version for neovim version < 0.8', vim.log.levels.ERROR) end return nvim_0_8 end