53 lines
1.5 KiB
Lua
53 lines
1.5 KiB
Lua
local M = {}
|
|
|
|
M.has_words_before = function()
|
|
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
|
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match '%s' == nil
|
|
end
|
|
|
|
--[=[ function M.on_attach(client, bufnr)
|
|
--[[ vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') ]]
|
|
if client.name == 'jdt.ls' then
|
|
client.server_capabilities.documentFormattingProvider = false
|
|
vim.lsp.codelens.refresh()
|
|
if JAVA_DAP_ACTIVE then
|
|
require('jdtls').setup_dap { hotcodereplace = 'auto' }
|
|
require('jdtls.dap').setup_dap_main_class_configs()
|
|
end
|
|
end
|
|
local ft = vim.api.nvim_buf_get_option(bufnr, 'filetype')
|
|
local has_formatter = require('null-ls.sources').get_available(ft, 'NULL_LS_FORMATTING') > 0
|
|
|
|
local enable = false
|
|
if has_formatter and not client.name == 'clangd' then
|
|
enable = client.name == 'null-ls'
|
|
else
|
|
enable = not (client.name == 'null-ls')
|
|
end
|
|
|
|
-- util.info(client.name .. " " .. (enable and "yes" or "no"), "format")
|
|
client.server_capabilities.documentFormattingProvider = enable
|
|
-- client.server_capabilities.semanticTokensProvider = false
|
|
client.server_capabilities.semanticTokensProvider = nil
|
|
end ]=]
|
|
|
|
M.lsp_config = {
|
|
virtual_text = {
|
|
prefix = '●',
|
|
},
|
|
signs = false,
|
|
underline = true,
|
|
update_in_insert = true,
|
|
severity_sort = false,
|
|
float = {
|
|
focusable = false,
|
|
-- style = 'minimal',
|
|
border = 'rounded',
|
|
source = 'always',
|
|
header = '',
|
|
prefix = '',
|
|
},
|
|
}
|
|
|
|
return M
|