commit 091527d1785725138235ffc5259884374369202b
parent 20723f25ec8e6ed3b904734f86b6e9f0c8242938
Author: Tomas Nemec <owl@gtms.dev>
Date: Mon, 2 Oct 2023 22:14:48 +0200
update
Diffstat:
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/ftplugin/dart.lua b/ftplugin/dart.lua
@@ -7,14 +7,8 @@ vim.b.undo_ftplugin = 'setl com< cms< inex< isf<'
vim.cmd.iabbrev('STring', 'String')
-local first_line = vim.fn.getline(1)
-if string.match(first_line, '^#!.*dcli') then
- vim.bo.makeprg = [[dcli run %]]
- vim.bo.efm = [[%f:%l:%c: %m]]
-else
- vim.bo.makeprg = [[dart %]]
- vim.bo.efm = [[%f:%l:%c: %m]]
-end
+vim.bo.makeprg = [[echo && dart %]]
+vim.bo.efm = [[%f:%l:%c: %m]]
local full_path = vim.fn.expand('%:p')
if string.find(full_path, '%.pub%-cache') then
@@ -24,7 +18,15 @@ end
vim.lsp.start(require'tms.lsp'.make_opts('dartls'))
vim.keymap.set('n', '<leader>ar', vim.cmd.make)
-vim.keymap.set('n', '<leader>at', vim.cmd.Trun)
+vim.keymap.set('n', '<leader>at', vim.cmd.DartTest)
+vim.keymap.set('n', '<leader>an', vim.cmd.Trun)
+
+vim.api.nvim_buf_create_user_command(0, 'DartTest', function()
+ local temp_makeprg = vim.bo.makeprg
+ vim.bo.makeprg = [[echo && dart test --no-color -r expanded %]]
+ vim.cmd.make()
+ vim.bo.makeprg = temp_makeprg
+end, {})
if pcall(require, 'dart-tools') then
local dt_lsp = require('dart-tools.lsp')