Skip to content

Latest commit

 

History

History
107 lines (87 loc) · 3.37 KB

README.md

File metadata and controls

107 lines (87 loc) · 3.37 KB

VimPlug

if using vimplug

call plug#begin()
if has('nvim')
        Plug 'neovim/nvim-lspconfig'
endif
call plug#end()

then :PlugUpdate

Filetypes

Because nimbleparse_lsp works both with lex/yacc files, as well as the files your that parser parses.

It requires a more complex initialization in the editor client than is typical.

Setting up LSP

The following assumes that you have set up nvim-lspconfig like the Suggested Configuration.

cp nimbleparse.lua .config/nvim/lua/

call require('nimbleparse').setup(on_attach) passing in your on_attach function from nvim-lspconfig, or nil if you don't use one.

Further configuration

nimbleparse_lsp will generate diagnostics even for multiple files, even which are not open. Beyond the builtin diagnostic support, there are neovim plugins worth looking into.

However many of them offer different variations of the same functionality.

Diagnostics

  1. telescope 👍 The Telescope diagnostics can show diagnostics for all files, or Telescope diagnostics bufnr=0 for the current file.

  2. Trouble 👍 Shows diagnostics in it separate pane.

  3. NvimTree 👍 Plug 'kyazdani42/nvim-tree.lua

    When configured to do so, nvim-tree will show diagnostic signs and highlight files with the appropriate color, When you leave the tree open, it will update a diagnostics change.

    nnoremap <leader>t <cmd>NvimTreeToggle<cr>
    lua <<EOF
    require('nvim-tree').setup{
      view = {
        signcolumn = "yes",
      },
      diagnostics = {
        enable = true,
        show_on_dirs = true
      }
    }
    EOF
    

Progress indication

  1. fidget 👍 Progress above the status line.
  2. lsp-status Progress and diagnostic counts info on the status line.
  3. lualine-lsp-progress 👍 Nice unobtrusive, easy to configure.

Notifications

nimbleparse_lsp only emits a few (one?) notification, when it needs to reload due to nimbleparse.toml changes. by default nvim doesn't show them though.

  1. nvim-notify 👍 Add to init.vim

     Plug 'rcarriga/nvim-notify/'
    

    Add the following to nimbleparse.lua and add the key handlers = handler_fns to the default_config table also in nimbleparse.lua

     require("notify").setup{}
     vim.notify = require('notify')
     local severity = {
     	"error",
     	"warn",
     	"info",
     	"info",
     }
    
     local handler_fns = {
             ["window/showMessage"] = function(err, method, params, client_id)
     	   vim.notify(method.message, severity[params.type])
             end,
       }

    It can also be configured to show progress, but currently that appears to be fairly obtrusive when used with nimbleparse (although debounce_text_changes does not currently appear to be functioning at this time which should help).

Testing

watch the log file,

  • :set ft? show filetype.
  • :LspInfo show LSP status
  • :lua print(vim.lsp.get_log_path()) path of log file...