commit 5bd65fca024dcf4a7cf9b42e0f809e8b9c6c27b0
parent 1c1c3b6e89bb9715a4b0ed264fc1339e1cfaa9c7
Author: Tomas Nemec <owl@gtms.dev>
Date: Wed, 15 Jan 2025 12:44:23 +0100
update
Diffstat:
5 files changed, 70 insertions(+), 45 deletions(-)
diff --git a/after/plugin/colorizer.lua b/after/plugin/colorizer.lua
@@ -6,7 +6,7 @@ require('colorizer').setup {
filetypes = { 'css', 'scss', 'html' },
user_default_options = {
css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
- sass = { enable = true }, -- Enable sass colors
+ -- sass = { enable = true }, -- Enable sass colors
virtualtext = '■',
mode = 'background',
},
diff --git a/after/plugin/rest-nvim.lua b/after/plugin/rest-nvim.lua
@@ -1,16 +1,3 @@
if not pcall(require, 'rest-nvim') then
return
end
-
-local rest = require 'rest-nvim'
-rest.setup()
-
-vim.api.nvim_create_user_command('Rest', function()
- rest.run(false)
-end, { desc = 'Rest Run' })
-
-vim.api.nvim_create_user_command('RestPreview', function()
- rest.run(true)
-end, { desc = 'Rest Run Preview' })
-
-vim.api.nvim_create_user_command('RestLast', rest.last, { desc = 'Rest Last' })
diff --git a/ftplugin/dart.lua b/ftplugin/dart.lua
@@ -63,9 +63,9 @@ if pcall(require, 'dart-tools') then
local opts = function(desc)
return { buffer = true, desc = desc }
end
- vim.keymap.set('n', '<leader>ap', function()
- ddebug.print()
- end, opts('Dart Debug Print'))
+ -- vim.keymap.set('n', '<leader>ap', function()
+ -- ddebug.print()
+ -- end, opts('Dart Debug Print'))
vim.keymap.set('n', '<leader>ao', dt_lsp.organize_imports, opts('Dart Organize Imports'))
vim.keymap.set('n', '<leader>af', dt_lsp.fix_all, opts('Dart Fix All'))
vim.keymap.set({ 'v', 'n' }, '<leader>ai', dt_lsp.inline_local_variable, opts('Dart Inline Local Varibale'))
@@ -88,4 +88,5 @@ if pcall(require, 'dart-tools') then
dt_req.execute_command('refactor.convert.bodyToBlock')
end, opts('Dart Convert To Block'))
vim.keymap.set('n', '<leader>ad', dt_lsp.super, opts('Dart Go to Super Definition'))
+ vim.keymap.set('n', '<leader>ap', dt_lsp.import, opts('Dart Go to Import'))
end
diff --git a/lua/tms/lsp/dart.lua b/lua/tms/lsp/dart.lua
@@ -1,7 +1,33 @@
local M = {}
local capabilities = {
- workspace = { workspaceEdit = { documentChanges = true }, fileOperations = { willRename = true } },
+ textDocument = {
+ hover = {
+ dynamicRegistration = false
+ },
+ inlayHint = {
+ dynamicRegistration = false
+ },
+ rename = {
+ dynamicRegistration = false,
+ },
+ codeAction = {
+ dynamicRegistration = false
+ },
+ rangeFormatting = {
+ dynamicRegistration = false
+ },
+ formatting = {
+ dynamicRegistration = false
+ },
+ definition = {
+ dynamicRegistration = false
+ }
+ },
+ workspace = {
+ workspaceEdit = { documentChanges = true },
+ fileOperations = { willRename = true }
+ },
}
local function root_dir(path)
@@ -18,7 +44,7 @@ function M.start()
'dart',
'language-server',
'--protocol=lsp',
- -- '--port=10000',
+ '--port=10000',
-- '--instrumentation-log-file=/tmp/dart-plugin-log',
},
root_dir = vim.fs.dirname(vim.fs.find('pubspec.yaml', { upward = true, stop = vim.uv.os_homedir() })[1]),
@@ -31,33 +57,44 @@ function M.start()
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'],
+ ['dart/textDocument/super'] = function(_, result, ctx)
+ local client = vim.lsp.get_client_by_id(ctx.client_id)
+ if client then
+ vim.lsp.util.show_document(result, client.offset_encoding)
+ end
+ end,
+ ['dart/textDocument/imports'] = function(_, result, ctx)
+ local client = vim.lsp.get_client_by_id(ctx.client_id)
+ if client then
+ vim.lsp.util.show_document(result, client.offset_encoding)
+ end
+ end,
},
}
- 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
+ -- 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 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,
- })
+ -- 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
function M.provided_references(opts)
diff --git a/lua/tms/p/telescope.lua b/lua/tms/p/telescope.lua
@@ -10,15 +10,15 @@ function M.mail_address()
pickers.new {
results_title = 'Adresses',
- finder = finders.new_oneshot_job({ 'mates', 'email-query' }),
+ finder = finders.new_oneshot_job({ 'khard', 'email', '--parsable', '--remove-first-line' }),
sorter = sorters.get_fuzzy_file(),
attach_mappings = function(_)
action_set.select:replace(function(prompt_bufnr, _)
local entry = action_state.get_selected_entry()
- local mail = entry.value:match('<(%S+)>')
+ local mail, name = entry.value:match('([^\t]+)\t([^\t]+)')
actions.close(prompt_bufnr)
- vim.fn.setreg('+', mail)
- vim.fn.setreg('*', mail)
+ vim.fn.setreg('+', name .. ' <' .. mail .. '>')
+ vim.fn.setreg('*', name .. ' <' .. mail .. '>')
end)
return true
end,