neovim

Personal neovim configuration files
git clone git://gtms.dev/neovim
Log | Files | Refs

commit eb348e182c792666026612992c47f95ae2d71e85
parent 731a3394b258c4bee5c1f308c97175016a604d34
Author: Tomas Nemec <owl@gtms.dev>
Date:   Wed, 15 May 2024 14:10:23 +0200

update

Diffstat:
Mafter/plugin/telescope.lua | 3+++
Mlua/tms/lsp/dart.lua | 32++++++++++++++++++++++++++++++--
2 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua @@ -5,6 +5,9 @@ end require 'telescope'.setup { defaults = require 'telescope.themes'.get_dropdown({ layout_config = { width = 120 }, + path_display = { + filename_first = { reverse_directories = true }, + }, mappings = { i = { ["<c-y>"] = require('telescope.actions').select_default, diff --git a/lua/tms/lsp/dart.lua b/lua/tms/lsp/dart.lua @@ -21,15 +21,43 @@ function M.start() -- '--port=10000', -- '--instrumentation-log-file=/tmp/dart-plugin-log', }, - root_dir = root_dir(), + root_dir = vim.fs.find('pubspec.yaml', { upward = true, stop = vim.uv.os_homedir() })[1], capabilities = vim.tbl_deep_extend('force', require 'tms.lsp'.capabilities(), capabilities), - init_options = { closingLabels = true, outline = true, flutterOutline = true }, + init_options = { + closingLabels = true, + outline = true, + flutterOutline = true, + }, settings = { dart = { completeFunctionCalls = true, showTodos = true, lineLength = 120 } }, handlers = { ['dart/textDocument/publishClosingLabels'] = require 'dart-tools.lsp.labels'.handler(), ['dart/textDocument/super'] = vim.lsp.handlers['textDocument/definition'], }, } + + vim.api.nvim_create_autocmd('LspAttach', { + callback = function(args) + local client = vim.lsp.get_client_by_id(args.data.client_id) + if not client then + return + end + + if vim.g.dart_workspaces_populated then + return + end + + if client.name == "dartls" then + vim.g.dart_workspaces_populated = true + local root = root_dir() + for _, pubspec in pairs(vim.fs.find('pubspec.yaml', { path = root, limit = math.huge })) do + local dirname = vim.fs.dirname(pubspec) + if dirname ~= root then + vim.lsp.buf.add_workspace_folder(dirname); + end + end + end + end, + }) end return M