diff options
| author | Elvis Claros Castro <elvis@claros.ar> | 2025-10-30 16:18:36 -0300 |
|---|---|---|
| committer | Elvis Claros Castro <elvis@claros.ar> | 2025-10-30 16:18:36 -0300 |
| commit | d45f8908c35f09ad33e2524fabc8c2dbc9c43d16 (patch) | |
| tree | 870f1dbbc537d34ec33ad2029f54016614dc0b7f /lua/pi | |
| parent | 97811dd201f2f88ff453303d8baa6739616cc9fb (diff) | |
| download | nvim-conf-d45f8908c35f09ad33e2524fabc8c2dbc9c43d16.tar.gz nvim-conf-d45f8908c35f09ad33e2524fabc8c2dbc9c43d16.zip | |
actu
Diffstat (limited to 'lua/pi')
| -rw-r--r-- | lua/pi/lsp/servers/asm_lsp.lua | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/lua/pi/lsp/servers/asm_lsp.lua b/lua/pi/lsp/servers/asm_lsp.lua new file mode 100644 index 0000000..f770b3f --- /dev/null +++ b/lua/pi/lsp/servers/asm_lsp.lua @@ -0,0 +1,40 @@ +local lsp_attach = require "pi.lsp.attach" +local lsp_flags = require "pi.lsp.flags" + +return function(ops) + local capabilities = require("blink.cmp").get_lsp_capabilities(vim.lsp.protocol.make_client_capabilities()) + local config = { + on_attach = function(client, bufnr) + -- Call the default attach function + lsp_attach(client, bufnr) + + -- Disable LSP formatting if asmfmt is available (prefer null-ls formatting) + if vim.fn.executable("asmfmt") == 1 then + client.server_capabilities.documentFormattingProvider = false + client.server_capabilities.documentRangeFormattingProvider = false + end + end, + flags = lsp_flags, + filetypes = { "asm", "s", "S" }, + capabilities = capabilities, + root_dir = function(fname) + local patterns = { "Makefile", "makefile", "GNUmakefile", ".git" } + for _, pattern in ipairs(patterns) do + local found = vim.fs.find(pattern, { + path = fname, + upward = true, + })[1] + if found then + return vim.fs.dirname(found) + end + end + return vim.fn.getcwd() + end, + } + + if vim.fn.executable "asm-lsp" == 1 then + config.cmd = { "asm-lsp" } + end + + return vim.tbl_extend("force", config, ops) +end |