Compare commits
2 Commits
a5394bafbd
...
27a982fd21
Author | SHA1 | Date | |
---|---|---|---|
27a982fd21 | |||
aaa50e9272 |
@ -208,6 +208,9 @@ return {
|
||||
else
|
||||
---@diagnostic disable-next-line: cast-local-type
|
||||
filename = vim.fn.fnamemodify(self.filename, ":~:.")
|
||||
if not conditions.width_percent_below(#filename, 0.5, true) then
|
||||
filename = vim.fn.pathshorten(filename)
|
||||
end
|
||||
end
|
||||
if filename == "" then
|
||||
filename = "[No Name]"
|
||||
@ -543,6 +546,11 @@ return {
|
||||
end,
|
||||
},
|
||||
{
|
||||
update = {
|
||||
"WinResized",
|
||||
"BufAdd",
|
||||
"BufEnter",
|
||||
},
|
||||
FileNameBlock,
|
||||
static = {
|
||||
bg_color_right = nil,
|
||||
@ -668,10 +676,14 @@ return {
|
||||
provider = "%=",
|
||||
},
|
||||
{
|
||||
update = {
|
||||
"BufAdd",
|
||||
"BufEnter",
|
||||
"FileType",
|
||||
},
|
||||
init = function(self)
|
||||
self.filename = vim.api.nvim_buf_get_name(0)
|
||||
end,
|
||||
|
||||
{
|
||||
provider = seps.full.left,
|
||||
hl = function()
|
||||
@ -747,6 +759,7 @@ return {
|
||||
},
|
||||
margin(1),
|
||||
{
|
||||
update = "CursorMoved",
|
||||
{
|
||||
provider = seps.full.left,
|
||||
hl = function()
|
||||
@ -941,7 +954,11 @@ return {
|
||||
{
|
||||
provider = function()
|
||||
local cwd = vim.uv.cwd() or ""
|
||||
return " " .. vim.fn.pathshorten(vim.fn.fnamemodify(cwd, ":~"))
|
||||
cwd = vim.fn.fnamemodify(cwd, ":~")
|
||||
if not conditions.width_percent_below(#cwd, 0.3, false) then
|
||||
cwd = vim.fn.pathshorten(cwd)
|
||||
end
|
||||
return " " .. cwd
|
||||
end,
|
||||
hl = {
|
||||
fg = colors.sumiInk0,
|
||||
|
@ -1,36 +1,3 @@
|
||||
local function on_attach(client, bufnr)
|
||||
-- Set autocommands conditional on server_capabilities
|
||||
vim.notify("Attached server " .. client.name, vim.log.levels.INFO, {
|
||||
title = "LSP",
|
||||
})
|
||||
|
||||
local function disable_format_capability(capabilities)
|
||||
capabilities.documentFormattingProvider = false
|
||||
capabilities.documentRangeFormattingProvider = false
|
||||
end
|
||||
local ignored_fmt_lsps = {
|
||||
"lua_ls",
|
||||
}
|
||||
local capabilities = client.server_capabilities
|
||||
-- vim.notify(vim.inspect(capabilities))
|
||||
for _, lsp_name in ipairs(ignored_fmt_lsps) do
|
||||
if client.name == lsp_name then
|
||||
disable_format_capability(capabilities)
|
||||
end
|
||||
end
|
||||
|
||||
if capabilities.semanticTokensProvider and capabilities.semanticTokensProvider.full then
|
||||
require("hlargs").disable_buf(bufnr)
|
||||
end
|
||||
end
|
||||
|
||||
local lsp_capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
local server_opts = {
|
||||
capabilities = lsp_capabilities,
|
||||
on_attach = on_attach,
|
||||
}
|
||||
|
||||
local lsp_server_bin_dir = vim.fn.stdpath("data") .. "/mason/bin/"
|
||||
return {
|
||||
{
|
||||
url = "https://git.sr.ht/~whynothugo/lsp_lines.nvim",
|
||||
@ -129,9 +96,6 @@ return {
|
||||
ft = { "rust" },
|
||||
config = function()
|
||||
vim.g.rustaceanvim = {
|
||||
server = {
|
||||
on_attach = on_attach,
|
||||
},
|
||||
dap = {
|
||||
adapter = {
|
||||
type = "server",
|
||||
@ -172,29 +136,6 @@ return {
|
||||
{
|
||||
"nvim-java/nvim-java",
|
||||
ft = { "java" },
|
||||
config = function()
|
||||
require("lspconfig").jdtls.setup({
|
||||
capabilities = lsp_capabilities,
|
||||
on_attach = on_attach,
|
||||
-- HACK: Have to define this to make jdtls show hovers, etc.
|
||||
init_options = {},
|
||||
settings = {
|
||||
java = {
|
||||
completion = {
|
||||
postfix = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
inlayHints = {
|
||||
parameterNames = {
|
||||
enabled = "all",
|
||||
exclusions = { "this" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
dependencies = {
|
||||
"nvim-java/lua-async-await",
|
||||
"nvim-java/nvim-java-refactor",
|
||||
@ -332,11 +273,45 @@ return {
|
||||
},
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
local lsp_capabilities =
|
||||
require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function(args)
|
||||
local bufnr = args.buf
|
||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
if not client then
|
||||
return
|
||||
end
|
||||
vim.notify("Attached server " .. client.name, vim.log.levels.INFO, {
|
||||
title = "LSP",
|
||||
})
|
||||
|
||||
local function disable_format_capability(capabilities)
|
||||
capabilities.documentFormattingProvider = false
|
||||
capabilities.documentRangeFormattingProvider = false
|
||||
end
|
||||
local ignored_fmt_lsps = {
|
||||
"lua_ls",
|
||||
}
|
||||
local capabilities = client.server_capabilities
|
||||
capabilities = vim.tbl_deep_extend("force", capabilities, lsp_capabilities)
|
||||
if not capabilities then
|
||||
return
|
||||
end
|
||||
for _, lsp_name in ipairs(ignored_fmt_lsps) do
|
||||
if client.name == lsp_name then
|
||||
disable_format_capability(capabilities)
|
||||
end
|
||||
end
|
||||
|
||||
if capabilities.semanticTokensProvider and capabilities.semanticTokensProvider.full then
|
||||
require("hlargs").disable_buf(bufnr)
|
||||
end
|
||||
end,
|
||||
})
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
lspconfig.jdtls.setup({
|
||||
capabilities = lsp_capabilities,
|
||||
on_attach = on_attach,
|
||||
-- HACK: Have to define this to make jdtls show hovers, etc.
|
||||
init_options = {},
|
||||
settings = {
|
||||
@ -360,8 +335,6 @@ return {
|
||||
-- I use ansible a lot, define exceptions for servers that can use
|
||||
-- server:setup & vim.cmd at the bottom here
|
||||
lspconfig.ansiblels.setup({
|
||||
capabilities = lsp_capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
ansible = {
|
||||
ansible = {
|
||||
@ -424,16 +397,12 @@ return {
|
||||
}),
|
||||
},
|
||||
},
|
||||
capabilities = lsp_capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lspconfig.csharp_ls.setup({
|
||||
handlers = {
|
||||
["textDocument/definition"] = require("csharpls_extended").handler,
|
||||
},
|
||||
capabilities = lsp_capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lspconfig.jsonls.setup({
|
||||
@ -441,8 +410,6 @@ return {
|
||||
schemas = require("schemastore").json.schemas(),
|
||||
validate = { enable = true },
|
||||
},
|
||||
capabilities = lsp_capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lspconfig.docker_compose_language_service.setup({
|
||||
@ -451,18 +418,14 @@ return {
|
||||
enableTelemetry = false,
|
||||
},
|
||||
},
|
||||
capabilities = lsp_capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lspconfig.powershell_es.setup({
|
||||
bundle_path = vim.fn.stdpath("data") .. "/mason/packages/powershell-editor-services/",
|
||||
capabilities = lsp_capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lspconfig.azure_pipelines_ls.setup({
|
||||
cmd = { lsp_server_bin_dir .. "azure-pipelines-language-server", "--stdio" },
|
||||
cmd = { "azure-pipelines-language-server", "--stdio" },
|
||||
settings = {
|
||||
redhat = {
|
||||
telemetry = {
|
||||
@ -478,13 +441,9 @@ return {
|
||||
},
|
||||
},
|
||||
filetypes = { "azure-pipelines" },
|
||||
capabilities = lsp_capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lspconfig.texlab.setup({
|
||||
capabilities = lsp_capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
texlab = {
|
||||
build = {
|
||||
@ -502,16 +461,12 @@ return {
|
||||
})
|
||||
|
||||
lspconfig.gopls.setup({
|
||||
capabilities = lsp_capabilities,
|
||||
on_attach = on_attach,
|
||||
fillstruct = "gopls",
|
||||
dap_debug = true,
|
||||
dap_debug_gui = true,
|
||||
})
|
||||
|
||||
lspconfig.nil_ls.setup({
|
||||
capabilities = lsp_capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
["nil"] = {
|
||||
formatting = { command = { "nixfmt" } },
|
||||
@ -546,7 +501,7 @@ return {
|
||||
"typst_lsp",
|
||||
"nginx_language_server",
|
||||
}) do
|
||||
lspconfig[server].setup(server_opts)
|
||||
lspconfig[server].setup({})
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user