diff --git a/lua/andr3/langs/java.lua b/lua/andr3/langs/java.lua new file mode 100644 index 0000000..8408687 --- /dev/null +++ b/lua/andr3/langs/java.lua @@ -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 diff --git a/lua/andr3/lsp.lua b/lua/andr3/lsp.lua index 7fa928b..ff26868 100644 --- a/lua/andr3/lsp.lua +++ b/lua/andr3/lsp.lua @@ -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 = '',next = ''}, - 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, diff --git a/lua/andr3/lsp_adds/icons.lua b/lua/andr3/lsp_adds/icons.lua new file mode 100644 index 0000000..495a833 --- /dev/null +++ b/lua/andr3/lsp_adds/icons.lua @@ -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; diff --git a/lua/andr3/packer.lua b/lua/andr3/packer.lua index 7789117..3c0e2bb 100644 --- a/lua/andr3/packer.lua +++ b/lua/andr3/packer.lua @@ -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",