clone of my dotfiles.ssp.sh
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

adding for write_good (if needed)

+53
+53
nvim-wp/lua/sspaeti/plugins/lsp/none-ls.lua
··· 1 + return { 2 + "nvimtools/none-ls.nvim", --before: jose-elias-alvarez/null-ls.nvim" 3 + lazy = true, 4 + -- event = { "BufReadPre", "BufNewFile" }, -- to enable uncomment this 5 + dependencies = { 6 + "jay-babu/mason-null-ls.nvim", 7 + }, 8 + config = function() 9 + local mason_null_ls = require("mason-null-ls") 10 + local null_ls = require("null-ls") 11 + local null_ls_utils = require("null-ls.utils") 12 + mason_null_ls.setup({ 13 + ensure_installed = { 14 + "write_good", -- only keep write_good 15 + }, 16 + }) 17 + -- for conciseness 18 + local formatting = null_ls.builtins.formatting -- to setup formatters 19 + local diagnostics = null_ls.builtins.diagnostics -- to setup linters 20 + -- to setup format on save 21 + local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) 22 + -- configure null_ls 23 + null_ls.setup({ 24 + -- add package.json as identifier for root (for typescript monorepos) 25 + root_dir = null_ls_utils.root_pattern(".null-ls-root", "Makefile", ".git", "package.json"), 26 + -- setup formatters & linters 27 + sources = { 28 + diagnostics.write_good, -- only write_good for diagnostics 29 + }, 30 + -- configure format on save 31 + on_attach = function(current_client, bufnr) 32 + local filetype = vim.api.nvim_buf_get_option(bufnr, 'filetype') 33 + if current_client.supports_method("textDocument/formatting") then 34 + vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) 35 + vim.api.nvim_create_autocmd("BufWritePre", { 36 + group = augroup, 37 + buffer = bufnr, 38 + callback = function() 39 + vim.lsp.buf.format({ 40 + filter = function(client) 41 + -- only use null-ls for formatting instead of lsp server 42 + print("on_attach called for buffer", bufnr) 43 + return client.name == "null-ls" 44 + end, 45 + bufnr = bufnr, 46 + }) 47 + end, 48 + }) 49 + end 50 + end, 51 + }) 52 + end, 53 + }