commit 4f0b24beaccbcaee1fe89cb1f7b59c91a478ba9e
parent 37cadbaecda8d940347abc148f3869e0eb7d4ae1
Author: Tomas Nemec <owl@gtms.dev>
Date: Tue, 16 Jan 2024 06:45:15 +0100
update
Diffstat:
4 files changed, 52 insertions(+), 21 deletions(-)
diff --git a/after/plugin/cmp.lua b/after/plugin/cmp.lua
@@ -56,8 +56,17 @@ local function close()
end
end
-local snippet_source = require 'tms.p.cmp.snippet_source'
-cmp.register_source('snippets', snippet_source)
+local register_snippets = true
+for _, source in ipairs(cmp.core.sources) do
+ if (source.name == 'snippets') then
+ register_snippets = false
+ break
+ end
+end
+if register_snippets then
+ local snippet_source = require 'tms.p.cmp.snippet_source'
+ cmp.register_source('snippets', snippet_source)
+end
cmp.setup({
window = {
@@ -111,27 +120,23 @@ cmp.setup({
{ name = 'path' },
{ name = 'spell' },
{ name = 'calc' },
- { name = 'treesitter' },
+ -- { name = 'treesitter' },
{ name = 'buffer', group_index = 1 },
}, { --
{ name = 'buffer' },
- { name = 'treesitter' },
}),
- -- sorting = {
- -- priority_weight = 2,
- -- comparators = {
- -- compare.offset,
- -- compare.exact,
- -- compare.scopes,
- -- compare.score,
- -- compare.recently_used,
- -- compare.locality,
- -- compare.kind,
- -- compare.sort_text,
- -- compare.length,
- -- compare.order,
- -- },
- -- },
+ sorting = {
+ -- priority_weight = 2,
+ comparators = {
+ cmp.config.compare.offset,
+ cmp.config.compare.exact,
+ cmp.config.compare.score,
+ cmp.config.compare.kind,
+ cmp.config.compare.sort_text,
+ cmp.config.compare.length,
+ cmp.config.compare.order,
+ },
+ },
-- experimental = { ghost_text = false },
})
diff --git a/after/plugin/treesitter-context.lua b/after/plugin/treesitter-context.lua
@@ -8,7 +8,7 @@ require'treesitter-context'.setup {
-- min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
line_numbers = true,
multiline_threshold = 5, -- Maximum number of lines to show for a single context
- -- trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
+ trim_scope = 'inner', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
-- mode = 'cursor', -- Line used to calculate context. Choices: 'cursor', 'topline'
-- -- Separator between context and content. Should be a single character string, like '-'.
-- -- When separator is set, the context will only show up when there are at least 2 lines above cursorline.
diff --git a/ftplugin/dart.lua b/ftplugin/dart.lua
@@ -26,7 +26,13 @@ end
vim.lsp.start {
name = 'dartls',
- cmd = { 'dart', 'language-server', '--protocol=lsp' },
+ cmd = { --
+ 'dart',
+ 'language-server',
+ '--protocol=lsp',
+ '--port=10000',
+ '--instrumentation-log-file=/tmp/dart-plugin-log',
+ },
root_dir = vim.fs.dirname(vim.fs.find({ 'pubspec.yaml', '.git' }, { upward = true })[1]),
capabilities = require'tms.lsp'.capabilities(),
init_options = { closingLabels = true, outline = true, flutterOutline = true },
diff --git a/ftplugin/html.lua b/ftplugin/html.lua
@@ -0,0 +1,20 @@
+vim.lsp.start {
+ name = 'dartls',
+ cmd = { --
+ 'dart',
+ 'language-server',
+ '--protocol=lsp',
+ '--port=10000',
+ '--instrumentation-log-file=/tmp/dart-plugin-log',
+ },
+ root_dir = vim.fs.dirname(vim.fs.find({ 'pubspec.yaml', '.git' }, { upward = true })[1]),
+ capabilities = require'tms.lsp'.capabilities(),
+ init_options = { closingLabels = true, outline = true, flutterOutline = true },
+ settings = { dart = { completeFunctionCalls = true, showTodos = true, lineLength = 120 } },
+ handlers = {
+ ['typeHierarchy/subtypes'] = require'dart-tools.lsp.type_hierarchy'.handler(),
+ ['typeHierarchy/supertypes'] = require'dart-tools.lsp.type_hierarchy'.handler(),
+ ['dart/textDocument/publishClosingLabels'] = require'dart-tools.lsp.labels'.handler(),
+ ['dart/textDocument/super'] = vim.lsp.handlers['textDocument/definition'],
+ },
+}