commit 5dc5a82caa4ab55ba085977c6d071cf7c7153b02
parent bfaa6d9116c0c11c772d1a9226e223b3080eb968
Author: Tomas Nemec <nemi@skaut.cz>
Date: Mon, 29 Nov 2021 08:18:34 +0100
update
Diffstat:
3 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/lua/tms/ft/dart/closing_labels.lua b/lua/tms/ft/dart/closing_labels.lua
@@ -18,11 +18,11 @@ nvim_lsp.dartls.setup{
}
```
https://github.com/dart-lang/sdk/blob/master/pkg/analysis_server/tool/lsp_spec/README.md#darttextdocumentpublishclosinglabels-notification
---]] local M = {}
+--]] --
+local M = {}
-- Namespace for the virtual text
-local closing_labels_ns = vim.api.nvim_create_namespace(
- 'lsp_extensions.dart.closing_labels')
+local closing_labels_ns = vim.api.nvim_create_namespace('lsp_extensions.dart.closing_labels')
-- Draws the newly published labels in the current buffer
-- @tparam table a table of options: highlight, prefix
@@ -35,8 +35,7 @@ local draw_labels = function(opts, labels)
for _, label in pairs(labels) do
local end_line = label.range['end'].line
local text = prefix .. label.label
- vim.api.nvim_buf_set_virtual_text(0, closing_labels_ns, end_line,
- {{text, highlight}}, {})
+ vim.api.nvim_buf_set_virtual_text(0, closing_labels_ns, end_line, {{text, highlight}}, {})
end
end
@@ -48,9 +47,7 @@ M.get_callback = function(opts)
local labels = result.labels
-- This check is meant to prevent stray events from over-writing labels that
-- don't match the current buffer.
- if uri == vim.uri_from_bufnr(0) then
- draw_labels(opts, labels)
- end
+ if uri == vim.uri_from_bufnr(0) then draw_labels(opts, labels) end
end
end
diff --git a/lua/tms/lsp/servers.lua b/lua/tms/lsp/servers.lua
@@ -35,7 +35,7 @@ M.dartls = function(opts)
opts.init_options = {closingLabels = true, outline = true}
-- filetypes = {'dart', 'html'}
opts.settings = {dart = {lineLength = 120, showTodos = true, completeFunctionCalls = true}}
- opts.handlers = {['dart/textDocument/publishClosingLabels'] = require('tms.ft.dart.closing_labels').get_callback {}}
+ opts.handlers = {['dart/textDocument/publishClosingLabels'] = require('tms.ft.dart.closing_labels').get_callback()}
opts.root_dir = lspc.util.root_pattern('pubspec.yaml', '.git', vim.fn.getcwd())
return opts
end
diff --git a/lua/tms/u/reload.lua b/lua/tms/u/reload.lua
@@ -1,5 +1,3 @@
-local reloader = require('plenary.reload')
-
local M = {}
M.colors = function()
@@ -9,4 +7,8 @@ M.colors = function()
require('colorbuddy').colorscheme('my-default')
end
+M.nvim = function()
+ require("plenary.reload").reload_module("tms")
+end
+
return M