for lua only use stylua to format

This commit is contained in:
Thomas Ruoff
2023-04-26 22:29:58 +02:00
parent 55ead1caec
commit 857dfc4397
4 changed files with 46 additions and 35 deletions

View File

@@ -378,6 +378,13 @@ local servers = {
}, },
lua_ls = { lua_ls = {
Lua = { Lua = {
runtime = {
version = 'LuaJIT',
},
diagnostics = {
globals = { 'vim' },
},
format = { enable = false },
workspace = { checkThirdParty = false }, workspace = { checkThirdParty = false },
telemetry = { enable = false }, telemetry = { enable = false },
}, },

View File

@@ -4,8 +4,8 @@ return {
opts = { opts = {
load = { load = {
['core.defaults'] = {}, -- Loads default behaviour ['core.defaults'] = {}, -- Loads default behaviour
['core.norg.concealer'] = {}, -- Adds pretty icons to your documents ['core.concealer'] = {}, -- Adds pretty icons to your documents
['core.norg.dirman'] = { -- Manages Neorg workspaces ['core.dirman'] = { -- Manages Neorg workspaces
config = { config = {
workspaces = { workspaces = {
notes = '~/notes', notes = '~/notes',

View File

@@ -1,59 +1,63 @@
return { return {
"jay-babu/mason-null-ls.nvim", 'jay-babu/mason-null-ls.nvim',
lazy = false, lazy = false,
-- event = { "BufReadPre", "BufNewFile" }, -- event = { "BufReadPre", "BufNewFile" },
dependencies = { dependencies = {
"williamboman/mason.nvim", 'williamboman/mason.nvim',
"jose-elias-alvarez/null-ls.nvim", 'jose-elias-alvarez/null-ls.nvim',
}, },
config = function() config = function()
require("mason").setup() require('mason').setup()
require("mason-null-ls").setup({ require('mason-null-ls').setup {
ensure_installed = { 'stylua', 'jq', 'eslint_d' }, ensure_installed = { 'stylua', 'jq', 'eslint_d' },
automatic_setup = false, automatic_setup = false,
automatic_installation = false, automatic_installation = false,
}) }
local nls = require('null-ls') local nls = require 'null-ls'
local diagnostics = nls.builtins.diagnostics local diagnostics = nls.builtins.diagnostics
local formatting = nls.builtins.formatting local formatting = nls.builtins.formatting
local code_actions = nls.builtins.code_actions local code_actions = nls.builtins.code_actions
local h = require("null-ls.helpers") local h = require 'null-ls.helpers'
local u = require("null-ls.utils") local u = require 'null-ls.utils'
local function eslint_d_cwd(params) local function eslint_d_cwd(params)
return u.root_pattern( return u.root_pattern(
-- https://eslint.org/docs/user-guide/configuring/configuration-files#configuration-file-formats -- https://eslint.org/docs/user-guide/configuring/configuration-files#configuration-file-formats
".eslintrc", '.eslintrc',
".eslintrc.js", '.eslintrc.js',
".eslintrc.cjs", '.eslintrc.cjs',
".eslintrc.yaml", '.eslintrc.yaml',
".eslintrc.yml", '.eslintrc.yml',
".eslintrc.json" '.eslintrc.json'
-- do not respect package.json -- do not respect package.json
-- "package.json", -- "package.json",
)(params.bufname) )(params.bufname)
end end
require("null-ls").setup({ require('null-ls').setup {
debug = true, debug = true,
sources = { sources = {
-- Anything not supported by mason. -- Anything not supported by mason.
diagnostics.eslint_d.with({ -- lua
formatting.stylua,
-- eslint
diagnostics.eslint_d.with {
cwd = h.cache.by_bufnr(eslint_d_cwd), cwd = h.cache.by_bufnr(eslint_d_cwd),
-- not sure how to scope this only to bcr's locales -- not sure how to scope this only to bcr's locales
extra_filetypes = { "json" }, extra_filetypes = { 'json' },
}), },
formatting.eslint_d.with({ formatting.eslint_d.with {
cwd = h.cache.by_bufnr(eslint_d_cwd), cwd = h.cache.by_bufnr(eslint_d_cwd),
-- not sure how to scope this only to bcr's locales -- not sure how to scope this only to bcr's locales
extra_filetypes = { "json" }, extra_filetypes = { 'json' },
}), },
code_actions.eslint_d.with({ code_actions.eslint_d.with {
cwd = h.cache.by_bufnr(eslint_d_cwd), cwd = h.cache.by_bufnr(eslint_d_cwd),
-- not sure how to scope this only to bcr's locales -- not sure how to scope this only to bcr's locales
extra_filetypes = { "json" }, extra_filetypes = { 'json' },
}), },
-- refactoring
code_actions.refactoring, code_actions.refactoring,
}, },
}) }
end, end,
} }

View File

@@ -3,14 +3,14 @@ return {
{ 'tpope/vim-abolish', lazy = false }, { 'tpope/vim-abolish', lazy = false },
{ 'tpope/vim-unimpaired', lazy = false }, { 'tpope/vim-unimpaired', lazy = false },
{ {
"kylechui/nvim-surround", 'kylechui/nvim-surround',
version = "*", version = '*',
event = "VeryLazy", event = 'VeryLazy',
config = function() config = function()
require("nvim-surround").setup({ require('nvim-surround').setup {
-- Configuration here, or leave empty to use defaults -- Configuration here, or leave empty to use defaults
}) }
end end,
}, },
{ {
'rcarriga/nvim-notify', 'rcarriga/nvim-notify',