Conversation
- Another take on LazyVim#4436. - Adds LSP - Adds cmp and blink.cmp for LaTeX symbols
fcc8243 to
eb111c7
Compare
|
This PR is stale because it has been open 30 days with no activity. |
|
Looks good! I foresee two small problems. One is that the default config formats on save by default, but Julia formatting is quite up in the air at the moment. JuliaLanguageServer.jl is stuck on JuliaFormatter.jl 1.x, which breaks valid Julia such as using the Since this is a bit of a trap, and there's no canonical option, I propose to just disable formatting by default, and users can opt-in to the formatter they want instead. The other thing to note is that enabling https://github.com/kdheepak/cmp-latex-symbols for all file types might be a bit annoying. Ideally it would only be enabled for Julia by default since it clutters up the completions for other languages, and is actively harmful for LaTeX -- where it will replace LaTeX commands with Unicode symbols which won't work in many common LaTeX environments. Unfortunately the recommended way of doing this https://cmp.saghen.dev/recipes.html#dynamically-picking-providers-by-treesitter-node-filetype seems like it won't work well with settings inheritance. Perhaps this could be added to the blink.cmp spec? Or else something programmatic comparable to hrsh7th/nvim-cmp#666 (comment) (which is from nvim-cmp not blink.cmp -- but maybe it could be adapted). Any thoughts? |
|
Actually for the second one I suppose that just adding ft="julia" should do the trick. |
|
I'm not sure why, but whatever I do, I'm not able to blacklist the LSP formatter altogether (advice welcome). In the end I just added this to my autocmds.lua: local set_autoformat = function(pattern, bool_val)
vim.api.nvim_create_autocmd({ "FileType" }, {
pattern = pattern,
callback = function()
vim.b.autoformat = bool_val
end,
})
end
set_autoformat({ "julia" }, true)Cribbed from here: #141 (reply in thread) Not sure how to blacklist the LSP formatter, or what would be best for an extra. I guess something like this could be adapted? #6173 (comment) |
|
@frankier Yes, LazyVim registers its own LSP formatter. I believe the only option to disable it is to either implement the suggestion in #6173 for a global solution or to explicitly set the format handlers in each LSP server to just empty function that don't return anything. I don't know why maintainer made this decision, since I believe we could also change here LazyVim/lua/lazyvim/util/lsp.lua Lines 171 to 174 in 25abbf5 local ret = vim.tbl_filter(function(client)
return (
client.supports_method("textDocument/formatting")
or client.supports_method("textDocument/rangeFormatting")
) and client.config.capabilities.textDocument.formatting ~= false
end, clients)and then people could do in their personal configuration something like lua_ls = {
capabilities = {
textDocument = {
formatting = false,
},
},
}to disable the LSP formatting for a specific LSP server. But I'm not confident if that causes any other side-effects, so it would be up to maintainer as to how better implement this. Code taken from this commit where such an option existed in the past before the transition to Edit: changed to use client capabilities corresponding fields instead of server capability |
|
Thanks for the explanation! I wonder too... Perhaps an oversight? I agree we need input from folke for a proper solution. |
|
This is what I've ended up at for the LaTeX symbols: {
"https://gitlab.com/ExpandingMan/cmp-latex",
ft = "julia",
init = function()
-- cmp integration
vim.api.nvim_create_autocmd("FileType", {
pattern = "julia",
callback = function()
if LazyVim.has_extra("coding.nvim-cmp") then
local cmp = require("cmp")
-- global sources
---@param source cmp.SourceConfig
local sources = vim.tbl_map(function(source)
return { name = source.name }
end, cmp.get_config().sources)
-- add latex_symbols source
table.insert(sources, { name = "latex_symbols" })
-- update sources for the current buffer
cmp.setup.buffer({ sources = sources })
end
end,
})
end,
},
-- cmp integration
{
"hrsh7th/nvim-cmp",
optional = true,
dependencies = { "cmp-latex" },
},
-- blink.cmp integration
{
"saghen/blink.cmp",
optional = true,
dependencies = { "cmp-latex", "saghen/blink.compat" },
opts = {
sources = {
per_filetype = {
julia = { inherit_defaults = true, "latex_symbols" },
},
providers = {
latex_symbols = {
name = "latex_symbols",
module = "blink.compat.source",
async = true,
score_offset = 200,
},
},
},
},
},I use https://gitlab.com/ExpandingMan/cmp-latex since it works exactly like the Julia REPL. Then it turns out it to be a fit of a faff to restrict the suggestions to Julia, but this leaves my LaTeX files unicode free as is sometimes needed. |
|
ty |
🤖 I have created a release *beep* *boop* --- ## [15.10.0](v15.9.0...v15.10.0) (2025-10-20) ### Features * **ai:** add avante.nvim for a better AI experience ([#4440](#4440)) ([2682ce0](2682ce0)) * **extra:** allow users to add custom bundles through opts.init_options.bundles to jdtls ([#6265](#6265)) ([faeb24b](faeb24b)) * **extras:** add Dart language ([#4749](#4749)) ([90f84e7](90f84e7)) * **extras:** added ember lang support ([#6203](#6203)) ([ac4cce0](ac4cce0)) * **extras:** added twig language ([#5464](#5464)) ([a6eb51e](a6eb51e)) * **extras:** ai: add `claudecode.nvim` ([#6229](#6229)) ([e7a3e80](e7a3e80)) * **extras:** automatically update lazyvim.json for renamed or deprecated extras ([37ecd06](37ecd06)) * **extras:** renamed extra omnisharp -> dotnet + added fautocomplete to lspconfig ([1b2e6e8](1b2e6e8)) * **extras:** utils: add `gh.nvim` ([#6250](#6250)) ([8db9c75](8db9c75)) * **go:** add linting with golangci-lint ([#6311](#6311)) ([248876a](248876a)) * **haskell:** update `haskell-tools` version and add formatters + linters ([#6230](#6230)) ([82382f4](82382f4)) * **lang/fsharp:** add F# support to omnisharp extra ([#6538](#6538)) ([80a980a](80a980a)) * **lang:** add neotest config for PHP tests ([#5958](#5958)) ([9b077c7](9b077c7)) * **lang:** add solidity language support ([#4742](#4742)) ([2cd46d4](2cd46d4)) * **lang:** add Typst language support ([#4042](#4042)) ([645846b](645846b)) * **lang:** julia support ([#6231](#6231)) ([5d186c0](5d186c0)) * **lang:** nix add `statix` linter ([#6244](#6244)) ([2a866f6](2a866f6)) * **sidekick:** added sidekick cli status to lualine ([16917db](16917db)) ### Bug Fixes * **extras.lang:** fix Scala extra by using nvimMetals only ([#5726](#5726)) ([f118dca](f118dca)) * **fzf-lua:** added some missing keymaps similar to snacks picker. Closes [#6036](#6036). Closes [#5830](#5830) ([69a5744](69a5744)) * **helm:** broken helm highlighting ([#5335](#5335)) ([4d0d87f](4d0d87f)) * **keymap:** remove select mode remaps of printable characters ([#6296](#6296)) ([83468be](83468be)) * **tailwind:** additional settings ([#5266](#5266)) ([d2f9885](d2f9885)) * **telescope:** sync keymaps with snacks picker + added some that were missing ([1a08e9f](1a08e9f)) * **twig:** correct mason url ([9d345de](9d345de)) * **typescript:** better default pwa-node DAP config. Closes [#6386](#6386) ([e4d3432](e4d3432)) * **typescript:** support chrome, node and msedge dap adapters ([#6649](#6649)) ([0b65d33](0b65d33)) * **util.project:** different mapping on dashboard than `snacks.projects` ([#5737](#5737)) ([e389447](e389447)) ### Reverts * "feat(extra): allow users to add custom bundles through opts.init_options.bundles to jdtls ([#6265](#6265))" ([#6650](#6650)) ([a582f00](a582f00)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- ## [15.10.0](LazyVim/LazyVim@v15.9.0...v15.10.0) (2025-10-20) ### Features * **ai:** add avante.nvim for a better AI experience ([#4440](LazyVim/LazyVim#4440)) ([2682ce0](LazyVim/LazyVim@2682ce0)) * **extra:** allow users to add custom bundles through opts.init_options.bundles to jdtls ([#6265](LazyVim/LazyVim#6265)) ([faeb24b](LazyVim/LazyVim@faeb24b)) * **extras:** add Dart language ([#4749](LazyVim/LazyVim#4749)) ([90f84e7](LazyVim/LazyVim@90f84e7)) * **extras:** added ember lang support ([#6203](LazyVim/LazyVim#6203)) ([ac4cce0](LazyVim/LazyVim@ac4cce0)) * **extras:** added twig language ([#5464](LazyVim/LazyVim#5464)) ([a6eb51e](LazyVim/LazyVim@a6eb51e)) * **extras:** ai: add `claudecode.nvim` ([#6229](LazyVim/LazyVim#6229)) ([e7a3e80](LazyVim/LazyVim@e7a3e80)) * **extras:** automatically update lazyvim.json for renamed or deprecated extras ([37ecd06](LazyVim/LazyVim@37ecd06)) * **extras:** renamed extra omnisharp -> dotnet + added fautocomplete to lspconfig ([1b2e6e8](LazyVim/LazyVim@1b2e6e8)) * **extras:** utils: add `gh.nvim` ([#6250](LazyVim/LazyVim#6250)) ([8db9c75](LazyVim/LazyVim@8db9c75)) * **go:** add linting with golangci-lint ([#6311](LazyVim/LazyVim#6311)) ([248876a](LazyVim/LazyVim@248876a)) * **haskell:** update `haskell-tools` version and add formatters + linters ([#6230](LazyVim/LazyVim#6230)) ([82382f4](LazyVim/LazyVim@82382f4)) * **lang/fsharp:** add F# support to omnisharp extra ([#6538](LazyVim/LazyVim#6538)) ([80a980a](LazyVim/LazyVim@80a980a)) * **lang:** add neotest config for PHP tests ([#5958](LazyVim/LazyVim#5958)) ([9b077c7](LazyVim/LazyVim@9b077c7)) * **lang:** add solidity language support ([#4742](LazyVim/LazyVim#4742)) ([2cd46d4](LazyVim/LazyVim@2cd46d4)) * **lang:** add Typst language support ([#4042](LazyVim/LazyVim#4042)) ([645846b](LazyVim/LazyVim@645846b)) * **lang:** julia support ([#6231](LazyVim/LazyVim#6231)) ([5d186c0](LazyVim/LazyVim@5d186c0)) * **lang:** nix add `statix` linter ([#6244](LazyVim/LazyVim#6244)) ([2a866f6](LazyVim/LazyVim@2a866f6)) * **sidekick:** added sidekick cli status to lualine ([16917db](LazyVim/LazyVim@16917db)) ### Bug Fixes * **extras.lang:** fix Scala extra by using nvimMetals only ([#5726](LazyVim/LazyVim#5726)) ([f118dca](LazyVim/LazyVim@f118dca)) * **fzf-lua:** added some missing keymaps similar to snacks picker. Closes [#6036](LazyVim/LazyVim#6036). Closes [#5830](LazyVim/LazyVim#5830) ([69a5744](LazyVim/LazyVim@69a5744)) * **helm:** broken helm highlighting ([#5335](LazyVim/LazyVim#5335)) ([4d0d87f](LazyVim/LazyVim@4d0d87f)) * **keymap:** remove select mode remaps of printable characters ([#6296](LazyVim/LazyVim#6296)) ([83468be](LazyVim/LazyVim@83468be)) * **tailwind:** additional settings ([#5266](LazyVim/LazyVim#5266)) ([d2f9885](LazyVim/LazyVim@d2f9885)) * **telescope:** sync keymaps with snacks picker + added some that were missing ([1a08e9f](LazyVim/LazyVim@1a08e9f)) * **twig:** correct mason url ([9d345de](LazyVim/LazyVim@9d345de)) * **typescript:** better default pwa-node DAP config. Closes [#6386](LazyVim/LazyVim#6386) ([e4d3432](LazyVim/LazyVim@e4d3432)) * **typescript:** support chrome, node and msedge dap adapters ([#6649](LazyVim/LazyVim#6649)) ([0b65d33](LazyVim/LazyVim@0b65d33)) * **util.project:** different mapping on dashboard than `snacks.projects` ([#5737](LazyVim/LazyVim#5737)) ([e389447](LazyVim/LazyVim@e389447)) ### Reverts * "feat(extra): allow users to add custom bundles through opts.init_options.bundles to jdtls ([#6265](LazyVim/LazyVim#6265))" ([#6650](LazyVim/LazyVim#6650)) ([a582f00](LazyVim/LazyVim@a582f00)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Description
Related Issue(s)
#5455
Screenshots
Checklist