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.null-ls'
require 'andr3.lsp_adds.lsp_signature'
-- 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
}
--- }}}
local icons = require 'andr3.lsp_adds.icons'
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
@ -59,63 +30,34 @@ vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
-- vim.diagnostic.config({ virtual_text = { prefix = '🅰', } })
local warn = "😞";
local signs = { Error = "☣️ ", Warn = warn, Hint = "❤️ ", Info = "🆓" }
for type, icon in pairs(signs) do
for type, icon in pairs(icons.signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
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
require('lspkind').init({
mode = 'symbol_text',
preset = 'codicons',
symbol_map = kind_icons,
symbol_map = icons.kind_icons,
})
-- Saga
local keymap = vim.keymap.set
local saga = require'lspsaga'
local signs = icons.signs
-- saga.init_lsp_saga{
saga.setup{
border_style = "single",
saga_winblend = 0,
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,
code_action_icon = "🈁",
code_action_icon = signs.CodeAction,
code_action_num_shortcut = true,
code_action_lightbulb = {
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 'onsails/lspkind.nvim'
use 'editorconfig/editorconfig-vim'
use({
"glepnir/lspsaga.nvim",