Skip to content

Commit 4987d41

Browse files
chore: update flake.lock (#238)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent c1953bf commit 4987d41

File tree

4 files changed

+74
-23
lines changed

4 files changed

+74
-23
lines changed

flake.lock

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lua/rustaceanvim/commands/diagnostic.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ function M.explain_error()
141141
vim.api.nvim_win_set_cursor(win_id, { diagnostic.lnum + 1, diagnostic.col })
142142
-- Open folds under the cursor
143143
vim.cmd('normal! zv')
144-
compat.system({ rustc, '--explain', diagnostic.code }, nil, vim.schedule_wrap(handler))
144+
compat.system({ rustc, '--explain', tostring(diagnostic.code) }, nil, vim.schedule_wrap(handler))
145145
end
146146

147147
---@param diagnostic table

lua/rustaceanvim/config/internal.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ local RustaceanDefaultConfig = {
225225

226226
--- all the opts to send to the LSP client
227227
--- these override the defaults set by rust-tools.nvim
228-
---@class RustaceanLspClientConfig
228+
---@diagnostic disable-next-line: undefined-doc-class
229+
---@class RustaceanLspClientConfig: lsp.ClientConfig
229230
server = {
230231
---@type boolean | fun():boolean Whether to automatically attach the LSP client.
231232
---Defaults to `true` if the `rust-analyzer` executable is found.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
local compat = require('rustaceanvim.compat')
2+
3+
local function clear_qf()
4+
vim.fn.setqflist({}, ' ', { title = 'cargo' })
5+
end
6+
7+
local function scroll_qf()
8+
if vim.bo.buftype ~= 'quickfix' then
9+
vim.api.nvim_command('cbottom')
10+
end
11+
end
12+
13+
local function append_qf(line)
14+
vim.fn.setqflist({}, 'a', { lines = { line } })
15+
scroll_qf()
16+
end
17+
18+
local function copen()
19+
vim.cmd('copen')
20+
end
21+
22+
---@type RustaceanExecutor
23+
local M = {
24+
<<<<<<< HEAD
25+
execute_command = function(command, args, cwd, _)
26+
=======
27+
execute_command = function(command, args, cwd)
28+
>>>>>>> efa9378 (refactor: make lua-language-server typechecker happy)
29+
-- open quickfix
30+
copen()
31+
-- go back to the previous window
32+
vim.cmd.wincmd('p')
33+
-- clear the quickfix
34+
clear_qf()
35+
36+
-- start compiling
37+
local cmd = vim.list_extend({ command }, args)
38+
compat.system(
39+
cmd,
40+
cwd and { cwd = cwd } or {},
41+
vim.schedule_wrap(function(sc)
42+
---@cast sc vim.SystemCompleted
43+
local data = sc.stdout or sc.stderr
44+
append_qf(data)
45+
end)
46+
)
47+
end,
48+
}
49+
50+
return M

0 commit comments

Comments
 (0)