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