feat: núcleo del plugin NCS (build, flash, LSP)
Primera versión funcional del plugin para nRF Connect SDK en LazyVim. Incluye: - setup() con opciones por proyecto y API pública (build, flash) - detect: resolución en runtime de versión NCS, toolchain y board (sin hashes hardcodeados) - exec: wrapper async sobre vim.system + entorno NCS - west: construcción del comando build (--sysbuild, -DCONF_FILE, -DDTC_OVERLAY_FILE, -DCMAKE_EXPORT_COMPILE_COMMANDS=ON) - lsp: symlink de compile_commands.json desde build/<image>/ y LspRestart (clangd solo lo lee al arrancar) - flash: detección de placas vía nrfutil device list + selector - keymaps: <leader>nb (build), <leader>np (pristine), <leader>nf (flash)
This commit is contained in:
1 parent
03a43a686f
commit
a4a5bfe636
8 files changed
+297
No files matched your search
@@ -0,0 +1,39 @@
|
||||
local M = {}
|
||||
|
||||
local SKIP = { mcuboot = true, matter_factory_data = true }
|
||||
|
||||
function M.link(opts)
|
||||
local m = vim.fn.glob(opts.build_dir .. "/*/compile_commands.json", false, true)
|
||||
if #m == 0 then
|
||||
m = vim.fn.glob(opts.build_dir .. "/compile_commands.json", false, true) -- sin sysbuild
|
||||
end
|
||||
if #m == 0 then
|
||||
vim.notify("[hego] no encuentro compile_commands.json", vim.log.levels.WARN)
|
||||
return
|
||||
end
|
||||
|
||||
local chosen
|
||||
for _, p in ipairs(m) do
|
||||
local image = vim.fn.fnamemodify(vim.fn.fnamemodify(p, ":h"), ":t")
|
||||
if not SKIP[image] then
|
||||
chosen = p
|
||||
break
|
||||
end
|
||||
end
|
||||
chosen = chosen or m[1]
|
||||
|
||||
vim.fn.system({
|
||||
"ln",
|
||||
"-sfn",
|
||||
vim.fn.fnamemodify(chosen, ":p"),
|
||||
vim.fn.getcwd() .. "/compile_commands.json",
|
||||
})
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.notify("[hego] fallo creando el symlink", vim.log.levels.ERROR)
|
||||
return
|
||||
end
|
||||
vim.cmd("LspRestart") -- clangd solo lo lee al arrancar
|
||||
vim.notify("[hego] compile_commands.json -> " .. chosen, vim.log.levels.INFO)
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in new issue
Block a user