add none-ls

This commit is contained in:
2024-11-25 16:46:22 +02:00
parent bcc806d349
commit a93c15e29e
4 changed files with 70 additions and 0 deletions

View File

@@ -4,4 +4,5 @@ require("crentist.autocmd")
require("crentist.lazy_init")
require("crentist.filetype")
require("crentist.luasnip")
require("crentist.null-ls")

View File

@@ -0,0 +1,11 @@
return {
'nvimtools/none-ls.nvim',
-- Optional dependencies
dependencies = { 'nvim-lua/plenary.nvim' },
opts = {},
config = function()
local null_ls = require('null-ls')
null_ls.setup({})
end
}

51
lua/crentist/null-ls.lua Normal file
View File

@@ -0,0 +1,51 @@
-- https://www.youtube.com/watch?v=q-oBU2fO1H4&t=189s
local null_ls = require("null-ls")
-- local function check_if_comment(node, params)
-- if node == 'nil' then return false
-- if node:type() ~= 'comment' or node:type() ~= 'comment_content' then return false end
--
-- if node:type() == 'comment' then
-- local child = node:child()
--
-- if child == 'nil' then return false end
-- end
--
-- -- node exists and is a part of comment
-- if node == 'nil' or node:type() ~= 'comment' or node:type() ~= 'comment_content' then return false end
--
-- local parent = node:parent()
-- if parent == 'nil' or parent:type() ~= 'comment' then return false end
--
-- local text = vim.treesitter.get_node_text(node, )
-- end
-- null_ls.register({
-- name = 'Comment actions',
-- method = null_ls.methods.CODE_ACTION,
-- filetypes = {},
-- generator = {
-- fn = function(params)
-- local out = {}
--
-- table.insert(out,
-- {
-- title = 'Test',
-- action = function()
-- print(vim.treesitter.get_node())
-- end
-- })
-- return out
-- end
-- }
-- })
vim.keymap.set({ "i", "s" }, "<C-a>", function()
vim.lsp.buf.code_action()
end, { desc = "Snippet next argument", silent = true })
vim.keymap.set("n", "gra", function()
vim.lsp.buf.code_action()
end, { desc = "Snippet next argument", silent = true })