summary refs log tree commit diff
path: root/.vim/lua/lsp.lua
diff options
context:
space:
mode:
Diffstat (limited to '.vim/lua/lsp.lua')
-rw-r--r--.vim/lua/lsp.lua30
1 files changed, 18 insertions, 12 deletions
diff --git a/.vim/lua/lsp.lua b/.vim/lua/lsp.lua
index 9d80889..e134cff 100644
--- a/.vim/lua/lsp.lua
+++ b/.vim/lua/lsp.lua
@@ -1,5 +1,6 @@
 local lsp         = require('lspconfig')
 local lspstatus   = require('lsp-status')
+local navic       = require('nvim-navic')
 
 local my_attach = function(client, bufnr)
   if vim.opt.diff:get() then
@@ -27,6 +28,9 @@ local my_attach = function(client, bufnr)
   })
 
   lspstatus.on_attach(client)
+  if client.supports_method('textDocument/symbols') then
+    navic.attach(client, bufnr)
+  end
 
   if client.supports_method('textDocument/definition') then
     vim.keymap.set('n', '<C-]>'     , vim.lsp.buf.definition)
@@ -247,21 +251,23 @@ local setup = function()
   end
 end
 
+local format = function(afile)
+  if vim.g.nofmt then return end
+  if not string.match(afile, '^/home/robert/devel/upstream') then
+    vim.lsp.buf.format()
+    if string.match(afile, '.go$') then
+      vim.lsp.buf.code_action({ only = {'source.organizeImports'} })
+    end
+    -- vim.notify('%#MoreMsg#󰃢%#Italic# fmt')
+    vim.notify('%#MoreMsg#󰃢%#Italic# fmt')
+  end
+end
+
 return {
   my_attach    = my_attach,
   my_exit      = my_exit,
   capabilities = capabilities,
   setup        = setup,
-
-  format = function(afile)
-    if vim.g.nofmt then return end
-    if not string.match(afile, '^/home/robert/devel/upstream') then
-      vim.lsp.buf.format()
-      if string.match(afile, '.go$') then
-        vim.lsp.buf.code_action({ only = {'source.organizeImports'} })
-      end
-      -- vim.notify('%#MoreMsg#󰃢%#Italic# fmt')
-      vim.notify('%#MoreMsg#󰃢%#Italic# fmt')
-    end
-  end,
+  format       = format,
+  symbols       = symbols,
 }