chore: add editorconfig support

This commit is contained in:
Andre Henriques 2023-07-02 18:36:17 +01:00
parent 713a5ad46a
commit 27121ac7fd
4 changed files with 85 additions and 64 deletions

12
lua/andr3/langs/java.lua Normal file
View File

@ -0,0 +1,12 @@
local O = {};
local lspConfig = require('lspconfig')
function O.setup(on_attach, lsp_flags, capabilities)
lspConfig['jdtls'].setup{
on_attach = on_attach,
flags = lsp_flags,
capabilities = capabilities,
}
end
return O

View File

@ -1,36 +1,7 @@
require 'andr3.lsp_adds.prettier' require 'andr3.lsp_adds.prettier'
require 'andr3.lsp_adds.null-ls' require 'andr3.lsp_adds.null-ls'
require 'andr3.lsp_adds.lsp_signature' require 'andr3.lsp_adds.lsp_signature'
local icons = require 'andr3.lsp_adds.icons'
-- Items {{{
require('vim.lsp.protocol').CompletionItemKind = {
'', -- Text
'', -- Method
'', -- Function
'', -- Constructor
'', -- Field
'', -- Variable
'', -- Class
'', -- Interface
'', -- Module
'', -- Property
'', -- Unit
'', -- Value
'', -- Enum
'', -- Keyword
'', -- Snippet
'', -- Color
'', -- File
'', -- Reference
'', -- Folder
'', -- EnumMember
'', -- Constant
'', -- Struct
'', -- Event
'', -- Operator
'', -- TypeParameter
}
--- }}}
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, { vim.lsp.diagnostic.on_publish_diagnostics, {
@ -59,63 +30,34 @@ vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
-- vim.diagnostic.config({ virtual_text = { prefix = '🅰', } }) -- vim.diagnostic.config({ virtual_text = { prefix = '🅰', } })
local warn = "😞"; for type, icon in pairs(icons.signs) do
local signs = { Error = "☣️ ", Warn = warn, Hint = "❤️ ", Info = "🆓" }
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end end
local kind_icons = {
Text = "",
Method = "",
Function = "",
Constructor = "",
Field = "",
Variable = "",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = ""
}
-- lspkind -- lspkind
require('lspkind').init({ require('lspkind').init({
mode = 'symbol_text', mode = 'symbol_text',
preset = 'codicons', preset = 'codicons',
symbol_map = kind_icons, symbol_map = icons.kind_icons,
}) })
-- Saga -- Saga
local keymap = vim.keymap.set local keymap = vim.keymap.set
local saga = require'lspsaga' local saga = require'lspsaga'
local signs = icons.signs
-- saga.init_lsp_saga{ -- saga.init_lsp_saga{
saga.setup{ saga.setup{
border_style = "single", border_style = "single",
saga_winblend = 0, saga_winblend = 0,
move_in_saga = { prev = '<C-p>',next = '<C-n>'}, move_in_saga = { prev = '<C-p>',next = '<C-n>'},
diagnostic_header = { "☣️ ", warn, "❤️ ", "🆓" }, diagnostic_header = { signs.Error, signs.Warn, signs.Hint, signs.Info },
max_preview_lines = 10, max_preview_lines = 10,
code_action_icon = "🈁", code_action_icon = signs.CodeAction,
code_action_num_shortcut = true, code_action_num_shortcut = true,
code_action_lightbulb = { code_action_lightbulb = {
enable = true, enable = true,

View File

@ -0,0 +1,66 @@
local O = { }
local kind_icons = {
Text = "",
Method = "",
Function = "",
Constructor = "",
Field = '',
Variable = "",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = '',
Struct = "",
Event = "",
Operator = "",
TypeParameter = ""
}
O.kind_icons = kind_icons;
local signs = { Error = "☣️ ", Warn = "😞", Hint = "❤️ ", Info = "🆓", CodeAction = "🈁" }
O.signs = signs;
-- Set the icons {{{
require('vim.lsp.protocol').CompletionItemKind = {
kind_icons.Text,
kind_icons.Method,
kind_icons.Function,
kind_icons.Constructor,
kind_icons.Field,
kind_icons.Variable,
kind_icons.Class,
kind_icons.Interface,
kind_icons.Module,
kind_icons.Property,
kind_icons.Unit,
kind_icons.Value,
kind_icons.Enum,
kind_icons.Keyword,
kind_icons.Snippet,
kind_icons.Color,
kind_icons.File,
kind_icons.Reference,
kind_icons.Folder,
kind_icons.EnumMember,
kind_icons.Constant,
kind_icons.Struct,
kind_icons.Event,
kind_icons.Operator,
kind_icons.TypeParameter,
}
-- }}}
return O;

View File

@ -33,6 +33,7 @@ return require('packer').startup(function()
use 'chrisbra/vim-commentary' use 'chrisbra/vim-commentary'
use 'onsails/lspkind.nvim' use 'onsails/lspkind.nvim'
use 'editorconfig/editorconfig-vim'
use({ use({
"glepnir/lspsaga.nvim", "glepnir/lspsaga.nvim",