Skip to content

Commit

Permalink
chore: add LSP for freemarker + improvemnts
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Manca committed Jan 5, 2025
1 parent a4bede2 commit e8c3ac2
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 11 deletions.
29 changes: 29 additions & 0 deletions after/ftplugin/freemarker.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
-------------------------------------
----- File : freemarker.lua
----- Description : filetype freemarker extra config
----- Author : Kevin
----- Last Modified: 05/01/2025 - 13:26
----------------------------------------

---Starting LSP for freemarker
-- @url https://github.com/angelozerr/freemarker-languageserver

local cmd = {
[[C:\Program Files\Amazon Corretto\jdk17.0.13_11\bin\java.exe]],
"-Dlog.protocol=true",
"-Dlog.level=ALL",
"-Xms1g",
"--add-modules=ALL-SYSTEM",
"--add-opens", "java.base/java.lang=ALL-UNNAMED",
"--add-opens", "java.base/java.util=ALL-UNNAMED",
"-jar",
[[C:\Users\kmanca\AppData\Local\freemarker-languageserver\target\freemarker-languageserver-all.jar]],
}

vim.lsp.start {
name = "freemarker_ls",
cmd = cmd,
filetypes = { "freemarker", "ftl" },
root_dir = vim.fs.dirname(vim.api.nvim_buf_get_name(0)),
on_attach = require "plugins.lsp".on_attach
}
7 changes: 7 additions & 0 deletions after/ftplugin/qf.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------
-- File : qf.lua
-- Description : filetype quickfix extra config
-- Author : Kevin
-- Last Modified: 05/01/2025 - 11:39
-------------------------------------

local del_qf_item = function()
local items = vim.fn.getqflist()
local line = vim.fn.line('.')
Expand Down
12 changes: 6 additions & 6 deletions lazy-lock.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"SchemaStore.nvim": { "branch": "main", "commit": "fa47222e29d6f6e80eddcdd0f125c27edf274ad5" },
"alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" },
"blink.cmp": { "branch": "main", "commit": "d534f9e8bf39299c480e0c2e11dad21f51cfb2fe" },
"blink.cmp": { "branch": "main", "commit": "e3b7cb4a1094377c3093a021300de123d9fc60d3" },
"color-picker.nvim": { "branch": "master", "commit": "06cb5f853535dea529a523e9a0e8884cdf9eba4d" },
"conform.nvim": { "branch": "master", "commit": "990d37017e193fe40bdabf058e598e76f5e7d929" },
"conform.nvim": { "branch": "master", "commit": "70019124aa4f2e6838be9fbd2007f6d13b27a96d" },
"data-viewer.nvim": { "branch": "main", "commit": "40ddf37bb7ab6c04ff9e820812d1539afe691668" },
"gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" },
"jupytext.nvim": { "branch": "main", "commit": "c8baf3ad344c59b3abd461ecc17fc16ec44d0f7b" },
"kurayami.nvim": { "branch": "main", "commit": "cea7998ddbad73aa834e8fb3765711750c40c18a" },
"kurayami.nvim": { "branch": "main", "commit": "57af5981ee831d53f7a61d697a50f4bda0f681de" },
"lazy.nvim": { "branch": "main", "commit": "7e6c863bc7563efbdd757a310d17ebc95166cef3" },
"markdown.nvim": { "branch": "main", "commit": "c00cc1e2cbd5a55ca0c6c2e27fcf4a02ff731434" },
"markdown.nvim": { "branch": "main", "commit": "1faa6568eb61467d64c3d0aad8ac4c9c0e45514e" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "c6c686781f9841d855bf1b926e10aa5e19430a38" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"mini.icons": { "branch": "main", "commit": "6787321f70d674a481776b7cc2c781fb7002c644" },
Expand All @@ -26,11 +26,11 @@
"nvim-lspconfig": { "branch": "master", "commit": "a8ef5e6e497b3ebeaaf35b939c07c211563b2e05" },
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
"nvim-notify": { "branch": "master", "commit": "bd9cd51f9ef2f6326fc2bc9931d0718c1794e247" },
"nvim-treesitter": { "branch": "master", "commit": "cfbc1c0e0ff63e5b5e37b465b915b95fc2e98cef" },
"nvim-treesitter": { "branch": "master", "commit": "fae21737be2846a04ae06a41d70b7fc8ad4bf9eb" },
"nvim-treesitter-refactor": { "branch": "master", "commit": "d8b74fa87afc6a1e97b18da23e762efb032dc270" },
"nvim-ufo": { "branch": "main", "commit": "32cb247b893a384f1888b9cd737264159ecf183c" },
"obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" },
"oil.nvim": { "branch": "master", "commit": "ba858b662599eab8ef1cba9ab745afded99cb180" },
"oil.nvim": { "branch": "master", "commit": "c12fad2d225d8f81fadd48521d253607fe25465c" },
"otter.nvim": { "branch": "main", "commit": "e8c662e1aefa8b483cfba6e00729a39a363dcecc" },
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
Expand Down
8 changes: 4 additions & 4 deletions lua/lib/ui/statusline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ local function get_lsp_progress()
lsp = lsp:gsub(":", " ")
lsp = lsp:gsub("(%d+%%)", "%1%%") -- sanitize percentage
lsp = lsp:gsub("%s+", " ")
return lsp
return (#lsp > 24) and string.sub(lsp, 1, 24).."..." or lsp
end

return ""
Expand Down Expand Up @@ -433,7 +433,7 @@ local function enable_statusline()
"",
sl.colors.empty,
session_name(),
get_lsp_progress(),
-- get_lsp_progress(),
get_python_env(),

-- Middle
Expand Down Expand Up @@ -486,7 +486,7 @@ function sl.toggle()
"FileType",
"FileChangedShellPost",
"DiagnosticChanged",
"LspProgress",
-- "LspProgress",
}, {
group = vim.api.nvim_create_augroup("_statusline", { clear = true }),
callback = function(cb)
Expand All @@ -503,4 +503,4 @@ end

vim.api.nvim_create_user_command("ToggleStatusline", sl.toggle, { desc = "Toggle Statusline" })

return sl
return sl
2 changes: 1 addition & 1 deletion lua/plugins/lsp/handlers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ return {
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
title = "LSP❭ Hover",
border = "rounded",
max_height = math.floor(vim.o.lines * 0.4),
max_height = math.floor(vim.o.lines * 0.6),
max_width = math.floor(vim.o.columns * 0.8),
})

Expand Down
11 changes: 11 additions & 0 deletions plugin/autocommands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -333,4 +333,15 @@ autocmd("BufNewFile", {
end
end
end,
})

---LspStatus
autocmd("LspProgress", {
group = augroup("_lsp_progress", { clear = true }),
callback = function()
local lsp = vim.lsp.status()
if lsp then
print(lsp)
end
end
})

0 comments on commit e8c3ac2

Please sign in to comment.