-
-
Notifications
You must be signed in to change notification settings - Fork 284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When installing ltex-ls
it won't fetch the jdk*
folder which has the java
binaries
#1531
Comments
I can confirm the issue. It's tricky, the LSP simply does not work, and only after going through
|
Yeah, right now it isn't such a bother for me, I've got the Plus the change isn't complicated at all, I ran a local copy of Mason and just modified the fetch instructions in the json, then symlinked the |
I've been having this same issue. The language server is released with OS specific packages which include the java dependencies, and a version that requires a local installation of Java. The way I solve it is to just download the os specific binary from the releases section of the github repo and overwrite the one mason is grabbing. Is there a way to direct mason to the correct version of a release through the config? I looked into this a bit a few weeks ago when I first encountered the problem, but it seemed like there was no way to tell Mason to prefer the os specific download. |
Ok, so I looked into it, and the root cause is these lines in the mason-registry repo: it only lists the ltex-cli and lsp, but not the jdk bundled with it. Including the bundled jdk should be a matter of adding to that package specification. Unfortunately, I do not really know anything about Java, so I am not really certain files exactly need to be included. Maybe someone who knows that could make a PR adding the required files to the package specification? |
This has been brought up a couple of times and my stance on it is this. At this point I wouldn't mind changing it as it seems to be a reoccurring topic. |
But, due to the way the runtime path is read, wouldn't vendoring the |
edit: the PR has been merged, making all the instructions below obsolete. Just uninstall and install via mason, wait for the download to finish (might take a bit, because the bundled JRE is a bit bigger), and ltex should work fine without any need for you to do anything further anymore 🥳 I made a PR fixing the issue on mac and windows: mason-org/mason-registry#4311 You can already use the fix before the PR is merged by adding the fork as registry in your mason settings: require("mason").setup {
registries = {
"github:chrisgrieser/mason-registry", -- only has ltex-fix
"github:mason-org/mason-registry",
},
}
}) Restart nvim for the registry change to take effect. Then, run What remains with the PR is the minor issue that ltex is not able to automatically find the java runtime. I suspect this is due to mason symlinking binaries. However, this one can be easily fixed by setting require("lspconfig").ltex_ls.setup({
-- settings = {} -- your settings
on_attach = function ()
vim.env.JAVA_HOME = vim.fs.find(
function(name) return vim.startswith(name, "jdk-") end,
{ path = vim.fn.stdpath("data") .. "/mason/packages/ltex-ls/", type = "directory" }
)[1]
end
}) (The path is retrieved dynamically, since the exact path changes with ltex releases. I use |
I believe this can be closed with mason-org/mason-registry#4311. Do note my comment here though. |
I've searched open issues for similar requests
I've manually reviewed logs to find potential errors
I've recently downloaded the latest plugin version of mason.nvim
Problem description
When installing
ltex-ls
LaTeX LSP through Mason, it won't retain thejdk-{version}
folder, which contains the java binaries necessary for it to run.Right now, this is what Mason is fetching:
It's downloading the entire tarball, but then it'll only retain the
bin
andlib
folders.ltex-ls
advertises that "[it] comes with everything included, no need to install Java or LanguageTool." Therefore, this behavior from Mason goes against the upstream package, as it requires the user to manually install/compile their own java binaries, and include them in the runtime path.Expected behavior
In order to fix this issue, Mason would have to retain the
jdk-{version}
folder, which is already included in the tarball. And, it'd also need to create a symlink for the java binaries to be included in the./mason/bin/
(as it's the one included in the runtime path) directory, so they'll be readable byltex-ls
.Steps to reproduce
Simply install
ltex-ls
and try running it on a.tex
file, it'll exit with error code 1 and signal 0 (check the first screenshot). I've also attached a screenshot (second one) of:LspInfo
.Affected packages
ltex-ls
Neovim version (>= 0.7)
NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1696795921
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"
Run :checkhealth for more info
Operating system/version
Linux halo 6.5.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Tue, 10 Oct 2023 21:10:21 +0000 x86_64 GNU/Linux
Healthcheck
Screenshots or recordings
The text was updated successfully, but these errors were encountered: