Coder Social home page Coder Social logo

ray-x / navigator.lua Goto Github PK

View Code? Open in Web Editor NEW
1.3K 7.0 54.0 1.15 MB

Code analysis & navigation plugin for Neovim. Navigate codes like a breeze🎐 Exploring LSP and 🌲Treesitter symbols a piece of 🍰 Take control like a boss 🦍

License: MIT License

Lua 95.62% Makefile 0.04% HTML 0.08% Go 1.76% Scilab 0.12% JavaScript 0.21% Python 0.53% Vim Script 0.59% Rust 0.54% C++ 0.50%
neovim-plugin language-server-client neovim lsp nvim-plugin navigation diagnostics treesitter lspconfig

navigator.lua's People

Contributors

0x7a7a avatar ahorine avatar beauslm avatar beauwilliams avatar behzade avatar blob42 avatar brehen avatar cmarah avatar danielnehrig avatar davincible avatar ddrcode avatar gogoprog avatar hjkatz avatar jim-miller avatar kbwo avatar lc0117 avatar matbme avatar mattbailey avatar michaeladler avatar mkubasz avatar purpleblackferret avatar ray-x avatar rogeryk avatar sbmueller avatar spindensity avatar tani avatar thedelchop avatar yyk avatar zemoreo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

navigator.lua's Issues

inconsistent behavior of Ctrl-N in normal mode and insert mode

question

Ctrl-N opens keyword completion in reference results window in insert mode.

detail

image

navigator.lua open references float window with search row in insert mode by default, when press Ctrl-N after the float window appears, then the keyword completion shows up.
Is this on purpose or not? I expected same behavior of in both normal mode and insert mode. it should jump to next result with preview window when press Ctrl-N in this situation.

nvim version

NVIM v0.5.0
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/cc -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/build/neovim/src/neovim-0.5.0/build/config -I/build/neovim/src/neovim-0.5.0/src -I/usr/include -I/build/neovim/src/neovim-0.5.0/build/src/nvim/auto -I/build/neovim/src/neovim-0.5.0/build/include
Compiled by builduser

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

reproduce config

call plug#begin('~/.vim/plugged')

Plug 'neovim/nvim-lspconfig'
Plug 'ray-x/guihua.lua', {'do': 'cd lua/fzy && make' }
Plug 'ray-x/navigator.lua'

" optional, if you need treesitter symbol support
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'ray-x/aurora'      " for Plug user
" requires
Plug 'kyazdani42/nvim-web-devicons' " for file icons
Plug 'kyazdani42/nvim-tree.lua'
call plug#end()

" No need for rquire('lspconfig'), navigator will configure it for you
lua <<EOF
require'navigator'.setup()
EOF

set termguicolors            " 24 bit color
colorscheme aurora

[Help] Integration with LunarVim

In LunarVim LSP servers are configured this way:

  • config\lua\init.lua (main initialization file):
    ...
    require('my-navigator-lua') -- Settings for `navigator.lua` [1]
    ...
    require('lsp.clangd') -- Settings for clangd LSP server
    ...
  • config\lua\lsp\clangd.lua (clangd settings file):
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
capabilities.textDocument.completion.completionItem.resolveSupport = {
  properties = {
    'documentation',
    'detail',
    'additionalTextEdits',
  }
}

require'lspconfig'.clangd.setup {
    -- cmd = {DATA_PATH .. "/lspinstall/cpp/clangd/bin/clangd"},
    -- cmd = {"clangd", "-ferror-limit=0"},
    cmd = {"clangd", "--limit-results=0", "--enable-config", "--collect-main-file-refs=true"},
    root_dir = require('lspconfig/util').root_pattern("compile_commands.json"),
    on_attach = require'lsp'.common_on_attach,
--     handlers = {
--         ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
--             virtual_text = O.clang.diagnostics.virtual_text,
--             signs = O.clang.diagnostics.signs,
--             underline = O.clang.diagnostics.underline,
--             update_in_insert = true
-- 
--         })
--     }

    capabilities = capabilities,
}
  • config\lua\my-navigator-lua\init.lua (navigator.lua settings file):
require('navigator').setup({})

The issue is that when decommenting the line reported above as [1], then navigator.lua default settings are loaded, overwriting all of the LSP settings specified in the config\lua\lsp\<client>.lua files.

My question is, how to enable navigator.lua but at the same time maintain all of the LSP settings described in those single configuration files?

[Bug] Some VHDL LSP projects make Neovim freeze with navigator active

There is a behaviour that seems to cause Neovim to freeze when indexing an LSP based VHDL project.

As soon as a file of that project is opened, the proper LSP servers start, and it is as all of the project files get briefly opened and scanned in Neovim:

zD1kyxReMZ

Also, many git.exe processes seem to start and terminate:

image

As a result, at the end of this process nvim.exe seems to be frozen doing something:

image

This doesn't happen when navigator.lua is disabled: under this condition, the LSP servers start and silently index the project, without really opening each of the project files sequentially into Neovim first.

Separate treesitter setup from lsp setup

I have installed a lot of treesitter language supports, but only installed one language server, for those file types that don't have setup a language server, I would lost the treesitter features in this plugin. I know I could copy some of mapping to my init script, but I don't think this is only case from me. So could we separate the setup into two parts? Like use something like :TSInstallInfo to detect and setup treesitter features, use lsp onattach like now to setup lsp features.

read only warning buffer but I can update it.

Hi
With the "references" floating window I can write on it and I get this error.

Screenshot from 2021-05-29 00-26-34

Error detected while processing TextChangedI Autocommands for "<buffer=7>":                                                                   
E5108: Error executing lua [string ":lua"]:1: module 'guihua.ListViewCtrl' not found:                                                         
        no field package.preload['guihua.ListViewCtrl']                                                                                       
        no file './guihua/ListViewCtrl.lua'                                                                                                   
        no file '/usr/share/luajit-2.1.0-beta3/guihua/ListViewCtrl.lua'                                                                       
        no file '/usr/local/share/lua/5.1/guihua/ListViewCtrl.lua'                                                                            
        no file '/usr/local/share/lua/5.1/guihua/ListViewCtrl/init.lua'                                                                       
        no file '/usr/share/lua/5.1/guihua/ListViewCtrl.lua'                                                                                  
        no file '/usr/share/lua/5.1/guihua/ListViewCtrl/init.lua'                                                                             
        no file '/home/gaetan/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/guihua/ListViewCtrl.lua'                                 
        no file '/home/gaetan/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/guihua/ListViewCtrl/init.lua'                            
        no file '/home/gaetan/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/guihua/ListViewCtrl.lua'                        
        no file '/home/gaetan/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/guihua/ListViewCtrl/init.lua'                   
        no file './guihua/ListViewCtrl.so'                                                                                                    
        no file '/usr/local/lib/lua/5.1/guihua/ListViewCtrl.so'                                                                               
        no file '/usr/lib/x86_64-linux-gnu/lua/5.1/guihua/ListViewCtrl.so'                                                                    
        no file '/usr/local/lib/lua/5.1/loadall.so'                                                                                           
        no file '/home/gaetan/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/guihua/ListViewCtrl.so'                                    
        no file './guihua.so'                                                                                                                 
        no file '/usr/local/lib/lua/5.1/guihua.so'                                                                                            
        no file '/usr/lib/x86_64-linux-gnu/lua/5.1/guihua.so'                                                                                 
        no file '/usr/local/lib/lua/5.1/loadall.so'                                                                                           
        no file '/home/gaetan/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/guihua.so

Add option to disable virtual text

Hi. Thanks for the plugin, I’m a fan.

Currently it doesn’t appear for us to be able to disable virtual text for diagnostics. Can that be made into a configuration option?

More generally, it would be nice if the handlers were composable with my existing set up. Like I’d like to use the code actions handler from this plugin and other handlers from other plugins. Maybe this is too much of an ask though, so consider this a stretch feature request.

Virtual text icon

Virtual text icon shows 3 times.

    require "navigator".setup(
        {
            debug = false, -- log output, set to true and log path: ~/.local/share/nvim/gh.log
            width = 0.75, -- max width ratio (number of cols for the floating window) / (window width)
            height = 0.3, -- max list window height, 0.3 by default
            preview_height = 0.35, -- max height of preview windows
            border = {"╭", "─", "╮", "│", "╯", "─", "╰", "│"}, -- border style, can be one of 'none', 'single', 'double',
            -- 'shadow', or a list of chars which defines the border
            -- put a on_attach of your own here, e.g
            -- The attach code will apply to all LSP clients

            default_mapping = true, -- set to false if you will remap every key
            -- this kepmap gK will override "gD" mapping function declaration()  in default kepmap
            -- please check mapping.lua for all keymaps
            treesitter_analysis = true, -- treesitter variable context
            transparency = 50, -- 0 ~ 100 blur the main window, 100: fully transparent, 0: opaque,  set to nil or 100 to disable it
            code_action_prompt = {enable = true, sign = true, sign_priority = 40, virtual_text = true},
icons = {
    -- Code action
    code_action_icon = " ",
    -- code lens
    code_lens_action_icon = " ",
    -- Diagnostics
    diagnostic_head = '🐛',
    diagnostic_head_severity_1 = " ",
    diagnostic_head_severity_2 = " ",
    diagnostic_head_severity_3 = " ",
    diagnostic_head_description = "",
    diagnostic_virtual_text = " ",
    diagnostic_file = " ",
    -- Values
    value_changed = " ",
    value_definition = "𤋮 ",
    -- Treesitter
    match_kinds = {
      var = "  ", 
      method = " ƒ ",
      ["function"] = "  ", 
      parameter = "  ",
      associated = "  ",
      namespace = "  ",
      type = "  ",
      field = " ﰠ "
    },
    treesitter_defult = "🌲"
  },
            lsp = {
                format_on_save = true, -- set to false to disasble lsp code format on save (if you are using prettier/efm/formater etc)
                diagnostic_scroll_bar_sign = {"▃", "█"}, -- experimental:  diagnostic status in scroll bar area; set to nil to disable the diagnostic sign,
				disable_lsp = 'all',
                -- for other style, set to {'╍', 'ﮆ'} or {'-', '='}
                diagnostic_virtual_text = true, -- show virtual for diagnostic message
                diagnostic_update_in_insert = false, -- update diagnostic message in insert mode
                disply_diagnostic_qf = true, -- always show quickfix if there are diagnostic errors, set to false if you  want to
            }
        }
    )

Screenshot from 2021-08-28 19-55-43

The default keymaps override gt for switching to the next tab

Switching to the next tab is definitely a more common use case for me than going to the type definition, and breaking default bindings that are already in people's muscle memory sounds like a bad idea. Would it be possible to change the binding for go to type definition to another key or at least add the ability to turn off certain mappings without needing to remap everything?

How to configure efm together?

I want to format on save (eslint/prettier) for typescript/javascript files.
for that I am trying to setup with efm following but it didnt work:

any suggestions?

USER = vim.fn.expand('$USER')
local lspconfig = require('lspconfig')


-- Efm language server
-- https://github.com/mattn/efm-langserver
local eslint = {
  lintCommand = 'eslint_d -f unix --stdin --stdin-filename ${INPUT}',
  lintIgnoreExitCode = true,
  lintStdin = true,
  lintFormats = {'%f:%l:%c: %m'},
  formatCommand = 'eslint_d --fix-to-stdout --stdin --stdin-filename=${INPUT}',
  formatStdin = true,
}

local prettier = {formatCommand = 'prettier --stdin-filepath ${INPUT}', formatStdin = true}

local luaformatter = {formatCommand = 'lua-format -i', formatStdin = true}


require'navigator'.setup({
 treesitter_analysis = true, -- treesitter variable context
 lsp = {
    format_on_save = true, 
    sumneko_lua = {
      sumneko_root_path = "/Users/" .. USER .. "/.config/nvim/lua-language-server",
      sumneko_binary = "/Users/" .. USER .. "/.config/nvim/lua-language-server/bin/macOS/lua-language-server",
    },
    tsserver = {
      filetypes = {},
    },
    efm = {
      init_options = {documentFormatting = true, codeAction = true, document_formatting = true},
      root_dir = lspconfig.util.root_pattern({'.git/', '.'}),

      filetypes = {
          "javascript",
          "javascriptreact",
          "javascript.jsx",
          "typescript",
          "typescript.tsx",
          "typescriptreact",
          "less",
          "scss",
          "css"
      },
      settings = {
          log_level = 1,
          log_file = '~/efm.log',
          languages = {
            less = {prettier},
            css = {prettier},
            html = {prettier},
            javascript = {prettier, eslint},
            javascriptreact = {prettier, eslint},
            json = {prettier},
            lua = {luaformatter},
            markdown = {prettier},
            scss = {prettier},
            typescript = {prettier, eslint},
            typescriptreact = {prettier, eslint},
            yaml = {prettier},
            ["javascript.jsx"] = {prettier, eslint},
            ["typescript.tsx"] = {prettier, eslint},
          }
      }
    }
  }
})

Multiple Connected Servers With Formatting Ability

I have denols, tsserver, and efm server all installed. This plugin automatically loads all three when I open a js file. This isn't a problem until I save the file, where I get repeatedly asked which language server I'd like to use to format the document.

autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting() is whats causing the problem (I think), it's on line 77 of mapping.lua

guihua error on workspace symbols usage in rust

When i use Workspace Symbols and enter my query this error appears
Error in context

Error detected while processing TextChangedI Autocommands for "<buffer=16>":
E5108: Error executing lua [string ":lua"]:1: module 'guihua.ListViewCtrl' not found:
        no field package.preload['guihua.ListViewCtrl']
        no file './guihua/ListViewCtrl.lua'
        no file '/home/runner/work/neovim/neovim/.deps/usr/share/luajit-2.1.0-beta3/guihua/ListViewCtrl.lua'
        no file '/usr/local/share/lua/5.1/guihua/ListViewCtrl.lua'
        no file '/usr/local/share/lua/5.1/guihua/ListViewCtrl/init.lua'
        no file '/home/runner/work/neovim/neovim/.deps/usr/share/lua/5.1/guihua/ListViewCtrl.lua'
        no file '/home/runner/work/neovim/neovim/.deps/usr/share/lua/5.1/guihua/ListViewCtrl/init.lua'
        no file '/home/dashie/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/guihua/ListViewCtrl.lua'
        no file '/home/dashie/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/guihua/ListViewCtrl/init.lua'
        no file '/home/dashie/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/guihua/ListViewCtrl.lua'
        no file '/home/dashie/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/guihua/ListViewCtrl/init.lua'
        no file './guihua/ListViewCtrl.so'
        no file '/usr/local/lib/lua/5.1/guihua/ListViewCtrl.so'
        no file '/home/runner/work/neovim/neovim/.deps/usr/lib/lua/5.1/guihua/ListViewCtrl.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
        no file '/home/dashie/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/guihua/ListViewCtrl.so'
        no file './guihua.so'
        no file '/usr/local/lib/lua/5.1/guihua.so'
        no file '/home/runner/work/neovim/neovim/.deps/usr/lib/lua/5.1/guihua.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
        no file '/home/dashie/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/guihua.so'

setup with packer

    use {"ray-x/navigator.lua", requires = {"ray-x/guihua.lua", run = "cd lua/fzy && make"}}

navigator setup

            rust_analyzer = {
                on_attach = function(client, bufnr)
                    custom_attach(client, bufnr)
                end
            },

[Bug] The latest update broke symbol references in search window

Before update 05e51f2e7404cea4413baf03231a7de577c4887d:

image

Now:

image

Also, sometimes this error occurs when selecting the next non-visible item of the preview window:

E5108: Error executing lua ...e\pack\packer\opt\guihua.lua\lua\guihua\ListViewCtrl.lua:368: attempt to index field '_viewctlobject' (a nil value)

EDIT: the error also happens for some of the already visible items of the list. It seems to depend on the presence of items hidden from the list (for example when many of them have been found).

EDIT2: if I activate one of the items which generate the error by making use of the <CR> key, then the error is effectively generated.
But, if I activate the same item with <C-o>, then the jump occurs with no errors, but at the wrong position (not at the first character of the searched symbol, but always at the previous character).

Run external LSP extension

Is there any way to run external LSP extensions while disabling lsp setup calls from navigator.lua? I want to run nvim-jdlts and on the README it is specifically mentioned not to run require'nvim_lsp'.jdtls.setup{}.

Unable to load a local module

I tried adding this plugin to work with my Typescript project and it seems to work within the local file but not between files. So showing references works for the file but every import has an error next to it saying it can't load a local module.

Screen Shot 2021-06-18 at 9 38 54 AM

I'm not sure where to begin debugging this. Is this an LSP issue? Treesitter? Running :LspInfo says somehow denols started running alongside the default Typescript language server but that wasn't happening earlier this week afaik.

Diagnostics lingering after they are fixed.

Hi. I've started to notice this problem that diagnostic floating texts don't get removed after I've fixed the problem.
image
image

The workaround I'm currently using is running LspRestart to get rid of the extra texts.

custom mapping

Hi.

You did a great job with this plugin!

I want to know if it's possible to create a custom mapping?

Close remap

Is it possible to map close window to <Esc> like in telescope

Lua error on "Backspace" in prompt: Error executing lua [string ":lua"]:1: module 'guihua.ListViewCtrl' not found:

Issue

Pressing "Backspace" to delete a character in the document symbol window results in a lua error:

E5108: Error executing lua [string ":lua"]:1: module 'guihua.ListViewCtrl' not found:                                                                                                
        no field package.preload['guihua.ListViewCtrl']
        no file './guihua/ListViewCtrl.lua'
        no file '/usr/share/luajit-2.0.5/guihua/ListViewCtrl.lua'
        no file '/usr/local/share/lua/5.1/guihua/ListViewCtrl.lua'
        no file '/usr/local/share/lua/5.1/guihua/ListViewCtrl/init.lua'
        no file '/usr/share/lua/5.1/guihua/ListViewCtrl.lua'
        no file '/usr/share/lua/5.1/guihua/ListViewCtrl/init.lua'
        no file './guihua/ListViewCtrl.so'
        no file '/usr/local/lib/lua/5.1/guihua/ListViewCtrl.so'
        no file '/usr/lib/lua/5.1/guihua/ListViewCtrl.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
        no file './guihua.so'
        no file '/usr/local/lib/lua/5.1/guihua.so'
        no file '/usr/lib/lua/5.1/guihua.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'

Screenshot

Result of pressing "Backspace" in the document symbols (g0) window.
Screenshot from 2021-07-19 10-04-24

Setup

Tested with this minimal config and neovim-0.5 on archlinux. Language server is clangd.

set termguicolors
call plug#begin('~/.local/share/nvim/plugged')
Plug 'neovim/nvim-lspconfig'
Plug 'nvim-treesitter/nvim-treesitter'

Plug 'ray-x/guihua.lua'
Plug 'ray-x/navigator.lua'

call plug#end()

lua <<EOF
local single = {"╭", "─", "╮", "│", "╯", "─", "╰", "│"}
require"navigator".setup({
  debug = true,
  width = 0.7,
  border = single, -- "single"
})
EOF
set mouse=a

Broken via guihua with

Stripped down config to just the example in the README:

call plug#begin('~/.vim/plugged')

Plug 'neovim/nvim-lspconfig'
Plug 'ray-x/guihua.lua', {'do': 'cd lua/fzy && make' }
Plug 'ray-x/navigator.lua'

" Plug 'hrsh7th/nvim-compe' and other plugins you commenly use...

" optional, if you need treesitter symbol support
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}

call plug#end()

" No need for rquire('lspconfig'), navigator will configure it for you
lua <<EOF
require'navigator'.setup()
EOF

Tried with neovim-0.5.0 and the current nightly 0.6.0-... but every thing I try with navigator just throws the error:

gp throws:

E5108: Error executing lua .../matt.bailey/.vim/plugged/guihua.lua/lua/guihua/rect.lua:13: attempt to index field 'rect' (a nil value)

gs throws:

Error executing vim.schedule lua callback: ...y/.vim/plugged/navigator.lua/lua/navigator/signature.lua:61: attempt to index local 'config' (a nil value)

Can confirm with :LspInfo that LSP is attached and working otherwise.

Automatic location list issues

Navigator currently sets up the following autocmd:

              silent! lua vim.lsp.diagnostic.set_loclist({open_loclist = false})
	Last set from ~/.config/nvim/init.lua

But it has a few issues for me:

  • The list of filetypes is hard coded and does not correspond to the filetypes I use neovim with lsp.
  • Although open_loclist is false, an empty location list is still opened on every save if there is no language server in the buffer.
  • As far as I can tell, there's no way to customize this behavior at all. For example, I don't see how this feature can be turned off.

Multiple Connected Servers With Formatting Ability

I have denols, tsserver, and efm server all installed. This plugin automatically loads all three when I open a js file. This isn't a problem until I save the file, where I get repeatedly asked which language server I'd like to use to format the document.

autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting() is whats causing the problem (I think), it's on line 77 of mapping.lua

Navigator.lua broken

Plugin Broken on commit 0d29116
jumping back to 7514fa9 works fine for me

Lsp does not startup on loading filetype

update

git bisect good 7514fa9f                                                                                       
You need to start by "git bisect start"

Do you want me to do it for you [Y/n]? Y
git bisect good 7514fa9f
git bisect bad 0d29116b18a0b8321d4c4023e0c96ce014f56b65
Bisecting: 6 revisions left to test after this (roughly 3 steps)
[baad5112d87d61a9d5a07941c6a24a15ce80de40] optimize jump to position
git bisect good
Bisecting: 3 revisions left to test after this (roughly 2 steps)
[05e51f2e7404cea4413baf03231a7de577c4887d] postphone the treesitter loading
git bisect good                                                                                              
Bisecting: 1 revision left to test after this (roughly 1 step)
[f30e5a290d2f1eb4e04c61051808b255488e6650] gopls flags->allow_incremental_sync/debounce update                                                                                                          git bisect good                                                                                              
Bisecting: 0 revisions left to test after this (roughly 0 steps)
[b08bfd68396b4f0afe6bffe6939760d876e487ea] improve launching time                                                                                                       
git bisect bad                                                                                               
b08bfd68396b4f0afe6bffe6939760d876e487ea is the first bad commit
commit b08bfd68396b4f0afe6bffe6939760d876e487ea
Author: ray-x <[email protected]>
Date:   Fri Jul 2 19:32:19 2021 +1000

    improve launching time

 lua/navigator/lspclient/clients.lua | 74 ++++++++++++++++++-------------------
 lua/navigator/lspclient/mapping.lua |  3 +-
 lua/navigator/lspwrapper.lua        |  2 +-
 3 files changed, 38 insertions(+), 41 deletions(-)

the breaking commit is b08bfd6

tested with

  • typescript
  • rust

Rust lifetimes break highlighting in list view

Rust uses a single ' to signify lifetime names and list view highlights everything between two lifetimes as a string (the block of yellow text in the screenshot from vim.lsp.buf.document_symbol()).

Screenshot_20210608_143526

Missing preview window when showing references

Issue

When pressing "gr" on a symbol to list it's references a popup window with the list of references appears. However, there is no preview window when selecting an entry of that list. Pressing "Enter" on an entry will open the respective entry in the same window without changing it's size. See the screenshots attached.

Screenshot

Result of "gr" on the function "ccp_reverse_buf":
Screenshot from 2021-07-19 09-43-38

Result of pressing "Enter" on an entry:
Screenshot from 2021-07-19 09-56-54

Expected result

I'd expect that a preview window that displays the respective entry is created. Upon selecting an entry via "Enter" the respective location is opened in the current buffer.

Please close this issue if the shown behavior is indeed expected.

Setup

Tested with this minimal config and neovim-0.5 on archlinux. Language server is clangd.

set termguicolors
call plug#begin('~/.local/share/nvim/plugged')
Plug 'neovim/nvim-lspconfig'
Plug 'nvim-treesitter/nvim-treesitter'

Plug 'ray-x/guihua.lua'
Plug 'ray-x/navigator.lua'

call plug#end()

lua <<EOF
local single = {"╭", "─", "╮", "│", "╯", "─", "╰", "│"}
require"navigator".setup({
  debug = true,
  width = 0.7,
  border = single, -- "single"
})
EOF
set mouse=a

[Question] ccls call hierarchy support

Does this plugin support incoming/outgoing call hierarchies when using ccls?

If not, is there any plan to support it? This would allow displaying call hierarchy for C/C++ code, too.

The floating window for symbols not work functionally

When I use document_symbol or workspace_symbol, a very nice floating window pops, but either the navigation or search doesn't work, searching always highlight the first item, and backspace in insert mode doesn't work either. Navigation or enter/ don't navigation to a correct place.

[Bug] Error with clangd and vim.lsp.buf.references() request

When navigator.lua is disabled, I'm successfully able to search for references in C code using clangd (quickfix window gets populated as a result).

When I enable navigator.lua, this error message is reported:

Error executing vim.schedule lua callback: ...ite\pack\packer\opt\navigator.lua\lua\navigator\util.lua:111: attempt to concatenate a nil value

Mapping:

vim.cmd("nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>")

Neovim version:

NVIM v0.5.0-dev+1384-gf2906a466
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe /DWIN32 /D_WINDOWS /W3 /MD /Zi /O2 /Ob1 /DNDEBUG /W3 -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -DWIN32 -D_WIN32_WINNT=0x0600 -DINCLUDE_GENERATED_DECLARATIONS -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -ID:/a/neovim/neovim/build/config -ID:/a/neovim/neovim/src -ID:/a/neovim/neovim/nvim-deps/usr/include -ID:/a/neovim/neovim/build/src/nvim/auto -ID:/a/neovim/neovim/build/include
Compilato da runneradmin@fv-az152-886

Features: -acl +iconv +tui
See ":help feature-compile"

   file vimrc di sistema: "$VIM\sysinit.vim"
         $VIM di riserva: "C:/Program Files/nvim/share/nvim"

Run :checkhealth for more info

Os: Windows 10 x64 Pro

navigator error on nvim startup

Seeing this when I nvim file.rs:

Error detected while processing FileType Autocommands for "*":
E5108: Error executing lua .../start/navigator.lua/lua/navigator/lspclient/clients.lua:323: attempt to index a nil value

Used to work fine, so looks like it was introduced with [a85c3e8].

Am I missing some config or something?

cannot find package "unsafe" with golang

setting

lua <<EOF
require'navigator'.setup({
debug = true
})
EOF

gh.log

[INFO  Thu Sep  2 00:22:39 2021] .../nvim/plugged/navigator.lua/lua/navigator/definition.lua:50: { {
    error = {
      code = 0,
      message = 'err: exit status 1: stderr: cannot find package "unsafe" in any of:\n\t/usr/local/Cellar/go/1.16.2/bin/src/unsafe (from $GOROOT)\n\t/Users/bigduu/Documents/git/goproject/src/unsafe (from $GOPATH)\n: packages.Load error',
      <metatable> = {
        __tostring = <function 1>
      }
    }
  } }

How to configure/debug formatting?

I've set up navigator and it seems to be working for most features, but I'm not getting format on save functionality in Python or Typescript projects. When I was using coc, I had to set python.formatting.provider to black, and eslint.autoFixOnSave. I'm not sure how to configure these for lsp/navigator. From the docs it sounds like this should work out of the box, but my files are stubbornly refusing to format! My navigator config:

require('navigator').setup {
  lsp = {
    format_on_save = true,
    disable_lsp = {'denols'}
  }
}

I know it's not much to go on, but any advice on how to debug the problem would be most welcome.

[Bug] Wrong, obsolete or no effect settings in README.md

  1. There is an error here:
icons = {
    -- Code action
    code_action_icon = "",
    -- Diagnostics
    diagnostic_head = '🐛',
    diagnostic_head_severity_1 = "🈲",
    -- refer to lua/navigator.lua for more icons setups
  }
  lsp = {
    format_on_save = true, -- set to false to disasble lsp code format on save (if you are using prettier/efm/formater etc)
    tsserver = {
      filetypes = {'typescript'} -- disable javascript etc,
      -- set to {} to disable the lspclient for all filetypes
    },

the block right before lsp, needs a comma:

...
  },
  lsp = {
...
  1. Also, if this setting is applied:
  width = 0.75, -- number of cols for the floating window
  height = 0.3, -- preview window size, 0.3 by default

Then, when opening the preview window (for example when looking for references), this error is generated:

Error executing vim.schedule lua callback: ...\site\pack\packer\opt\guihua.lua\lua\guihua\floating.lua:49: 'height' key must be a positive Integer

It is solved by using a positive integer value.

  1. Finally, modifying width setting has no effect on the preview window (no matter even it is set to a floating negative number).

no ui showing

The Plugin is not working for me.
Could it be related to the following ?

issue

occur error of workspace three keymaps

Hi.

Thank you for making a great plugin.

I'm getting an error on the workspace three keymaps.
The error message is same on three keymaps.
I get the following error message.

E5521: <Cmd> mapping must end with <CR> before second <Cmd>

The three keymaps that the error occurs was configured as follows.

:map <space>
n  <Space>wl   * <Cmd>lua vim.lsp.buf.<Cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR><CR>
n  <Space>wr   * <Cmd>lua vim.lsp.buf.<Cmd>lua vim.lsp.buf.remove_workspace_folder()<CR><CR>
n  <Space>wa   * <Cmd>lua vim.lsp.buf.<Cmd>lua vim.lsp.buf.add_workspace_folder()<CR><CR>

I am using this plugin default keymaps.

I think that the following code is related to this issue.

{key = '<Space>wa', func = '<cmd>lua vim.lsp.buf.add_workspace_folder()'},
{key = '<Space>wr', func = '<cmd>lua vim.lsp.buf.remove_workspace_folder()'},
{key = '<Space>wl', func = '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))'},

Thank you.

Not working with LunarVim

The plugin does not work with LunarVim.

LunarVim gd stopped working for going to the definition
Navigator gD also does not work

I'm using LunarVim https://github.com/LunarVim/LunarVim. And the following lines to setup Navigator

{"ray-x/guihua.lua", run = "cd lua/fzy && make"},
{"ray-x/navigator.lua",
config = function()
require'navigator'.setup({
lspinstall = false
})
end
},

lspinstall = true has the same behavior

[Bug] LunarNvim integration issues

Hi, first of all, congratulations on this great plugin.

I'm encountering some difficulties integrating it in the LunarVim config package.

lua\plugins.lua:

return require("packer").startup(function(use)
    ....
    use {'ray-x/navigator.lua', requires = {'ray-x/guihua.lua', run = 'cd lua/fzy && make'}, opt = true}
    ....
    require_plugin("navigator.lua")
    ....
end)

lua\init.lua:

....
require('my-navigator-lua')
....

lua\my-navigator-lua\init.lua:

require'navigator'.setup()

The fact is that it seems to install correctly (no errors reported), but it reports an error when starting Neovim:

Errore/i eseguendo C:\Work\MEGA\Portable\Neovim\config\init.vim:
riga  511:
E5108: Error executing lua ...er\opt\navigator.lua\lua\navigator\lspclient\clients.lua:49: table index is nil

Help with running it in LunarVim would be greatly appreciated!

null_ls formatting not working

after moving my lsp config to navigator, formatting of luastyle in null_ls is not working.

my navigator config:

local lspconfig = require("lspconfig")
local lsp_status = require("lsp-status")
local null_ls = require("null-ls")
local utils = require("personal.utils")
local api = vim.api

lsp_status.register_progress()

require("navigator").setup({
    keymaps = {
        { key = "gd", func = "definition()" },
        { key = "ga", func = "code_action()" },
    },
    on_attach = function(client, bufnr)
        require("lsp_signature").on_attach({
            bind = true,
            hint_enable = true,
            handler_opts = { border = "shadow" },
        })
        lsp_status.on_attach(client, bufnr)
    end,
    lsp = {
        sumneko_lua = {
            sumneko_root_path = vim.fn.expand("$HOME") .. "/github/lua-language-server",
            sumneko_binary = vim.fn.expand("$HOME")
                .. "/github/lua-language-server/bin/"
                .. utils.get_os_for_lua_lsp()
                .. "/lua-language-server",
        },
        tsserver = {
            on_attach = function(client)
                client.resolved_capabilities.document_formatting = false
            end,
        },
        gopls = {
            settings = {
                gopls = {
                    analyses = {
                        unusedparams = true,
                        fieldalignment = true,
                        nilness = true,
                        shadow = true,
                        unusedwrite = true,
                    },
                    staticcheck = true,
                    usePlaceholders = false,
                    completeUnimported = true,
                },
            },
        },
    },
})

-- Null ls
null_ls.config({
    sources = {
        null_ls.builtins.formatting.stylua.with({
            args = {
                "--indent-type",
                "Spaces",
                "-",
            },
        }),
        null_ls.builtins.formatting.prettierd.with({
            filetypes = {
                "javascript",
                "javascriptreact",
                "typescript",
                "typescriptreact",
                "vue",
                "css",
                "html",
                "json",
                "yaml",
                "markdown",
                "vimwiki",
            },
        }),
    },
})
lspconfig["null-ls"].setup({
    capabilities = lsp_status.capabilities,
})

api.nvim_command("hi default LspReferenceRead cterm=bold gui=Bold ctermbg=yellow guifg=none guibg=Black")
api.nvim_command("hi default LspReferenceText cterm=bold gui=Bold ctermbg=yellow guifg=none guibg=Black")
api.nvim_command("hi default LspReferenceWrite cterm=bold gui=Bold ctermbg=yellow guifg=none guibg=Black")

I can't figure out what is exactly the problem is, plz help.

Known issues, new features and breaking changes

Issue:

(Fixed)
(1) Open preview when split windows present may close the split window. It might be caused by an incorrect window id.

(Fixed)
(2) Breaking changes: neovim/neovim#13664. (Fixed)

(merged)
(3) gopls report error 'file://' not found in workspace. This is caused gopls is thinking floating windows with syntax on is a 'go' file. Fix is under testing. PR : neovim/nvim-lspconfig#944.

(merged)
(4) Breaking changes neovim floating_windows. neovim changed its' API neovim/neovim#14649
it has some side effects include the position of "apply action" floating window. Will working on them. (May 25)

Improvements

1) Backspace in search prompt
2) Fully configurable
3) PHP, dockerls support

PR welcome

java with jdtls

I have nvim-jdtls installed.
I also have use lspinstall.

When i try to run a command like signature_help() navigator shows me something like "man.vim: no manual entry".
Sometimes the plugin even shows me man entrys that are not related to java. The native LSP is working like expected.
Diagnostics are even working. LspSaga also shows right results.

I think navigator just not registers the server, or is maybe conflicting with nvim-jdtls.

My config fo navigator is :

require "navigator".setup(
  {
    debug = false,
    code_action_icon = " ",
    width = 0.75,
    height = 0.3,
    preview_height = 0.35,
    lspinstall = true,
    border = {"╭", "─", "╮", "│", "╯", "─", "╰", "│"},
    on_attach = function(client, bufnr)
    end,
    default_mapping = true,
    keymaps = {{key = "gs", func = "signature_help()"}},
    treesitter_analysis = true,
    code_action_prompt = {enable = true, sign = true, sign_priority = 40, virtual_text = true},
    icons = {
      code_action_icon = " ",
      diagnostic_head = "🐛",
      diagnostic_head_severity_1 = "🈲"
    },
    lsp = {
      jdlts = {
        filetypes = {} -- disable javascript etc,
      },
      format_on_save = true
    }
  }
)

i also tried it before without the part below, it did not work too

    lsp = {
      jdlts = {
        filetypes = {} -- disable javascript etc,
      },
      format_on_save = true
    }

Setup with Folke Lua Dev?

How would one setup navigator.lua with the lua dev plugin setup by folke?
my cfg:

local luadev =
    require("lua-dev").setup(
    {
        -- add any options here, or leave empty to use the default settings
        lspconfig = {
            on_attach = custom_attach,
            cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"}
        }
    }
)

lspconfig.sumneko_lua.setup(luadev)

require("navigator").setup(
    {
        default_mapping = false,
        sumneko_root_path = sumneko_root_path,
        sumneko_binary = sumneko_binary,
        code_action_prompt = {enable = false, sign = true, sign_priority = 40, virtual_text = true},
        lsp = {
            format_on_save = false,
            sumneko_lua = luadev,
            tsserver = {
                filetypes = {"typescript", "typescriptreact"},
                on_attach = function(client, bufnr)
                    vim.cmd [[packadd nvim-lsp-ts-utils]]
                    local ts_utils = require("nvim-lsp-ts-utils")

                    -- disable TS formatting since we use efm
                    client.resolved_capabilities.document_formatting = false

                    -- ts utils code action and file import update
                    ts_utils.setup {
                        debug = false,
                        disable_commands = false,
                        enable_import_on_completion = false,
                        import_on_completion_timeout = 5000,
                        -- eslint
                        eslint_enable_code_actions = true,
                        eslint_bin = "eslint_d",
                        eslint_args = {"-f", "json", "--stdin", "--stdin-filename", "$FILENAME"},
                        eslint_enable_disable_comments = true,
                        -- experimental settings!
                        -- eslint diagnostics
                        eslint_enable_diagnostics = false,
                        eslint_diagnostics_debounce = 250,
                        -- formatting
                        enable_formatting = false,
                        formatter = "prettier_d_slim",
                        formatter_args = {"--stdin-filepath", "$FILENAME"},
                        format_on_save = true,
                        no_save_after_format = false,
                        -- parentheses completion
                        complete_parens = false,
                        signature_help_in_parens = false,
                        -- update imports on file move
                        update_imports_on_move = true,
                        require_confirmation_on_move = false,
                        watch_dir = "/domain"
                    }

                    ts_utils.setup_client(client)
                    custom_attach(client, bufnr)
                    vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>gi", ":TSLspImportAll<CR>", {silent = true})
                    vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>ae", ":TSLspRenameFile<CR>", {silent = true})
                end
            }
        },
        on_attach = function(client, _)
            require "illuminate".on_attach(client)
        end
    }
)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.