Fork me on GitHub
#practicalli
<
2023-11-10
>
Lucio Assis14:11:34

Is there a way I can view the progress of [mason-null-ls] installing luacheck when I load up a project?

practicalli-johnny14:11:02

I see the progress of lua_ls when loading my astronvim-config project. I havent noticed luacheck, but maybe that runs much faster...

👍 1
Lucio Assis15:11:54

Maybe it's not luacheck per se, but it takes some time for LSP (via null-ls?) to make the code available for LSP actions such as renaming or finding references. I wanted to see that progress so that I'm not stuck trying to gr to find references and instead ending up as if I'd just hit r. Right now I go by the syntax coloring that changes once LSP has done its job. Is there another way?

practicalli-johnny15:11:46

I havent written much lua myself, mostly copy paste. However, if I type vim. and press tab I do see completion. I havent tried references, not sure what references I would actually try and jump too in lua. Do you have an example of what you are trying to do?

practicalli-johnny15:11:06

SPC l I will show the lsp server info, including the log location. I assume running tail in a separate window would show some information (although not clear if this would be helpful), e.g.

/home/practicalli/.cache/astronvim/null-ls.log
I do seem to have quite a few (old) errors in the log... but have not investigated yet.

Lucio Assis15:11:08

Sorry I may have misdirected the question by saying luacheck which is just what I saw on the screen, but this is a Clojure project

Lucio Assis15:11:06

So with gr I'm trying to pull up the places where, say, a certain fn is being used

practicalli-johnny15:11:52

Using AstroNvim and the Practicalli AstroNvim user config then gr on a function call seems to work with a Clojure project, both within the current file and across .clj files within the project classpath. Pressing gr with the curson on a function call opens a telescope dialog with the matching locations found in the project, including the current line it seems.

practicalli-johnny15:11:44

gr doesnt seem to work for function calls to functions defined in libraries added to the project...

practicalli-johnny15:11:45

I get the following error when trying to navigate to a function in a library (rather than the project source code). I havent processed this error as yet, so not sure what the issue is.

Error executing vim.schedule lua callback: ...t_nvimfV1UR1/usr/share/nvim/runtime/lua/vim/lsp/util.lua:1828: index out of range
stack traceback:
	[C]: in function '_str_byteindex_enc'
	...t_nvimfV1UR1/usr/share/nvim/runtime/lua/vim/lsp/util.lua:1828: in function 'locations_to_items'
	...nvim/lazy/telescope.nvim/lua/telescope/builtin/__lsp.lua:27: in function 'handler'
	....mount_nvimfV1UR1/usr/share/nvim/runtime/lua/vim/lsp.lua:1393: in function ''
	vim/_editor.lua: in function <vim/_editor.lua:0>

Lucio Assis17:11:42

Yes, gr works fine for me in that sense (even for libs after I enabled zipPlugin). What I'm trying to get at is that there is a certain amount of time after I open the first clj file in a project during which it won't, nor will any LSP command - I'm assuming that LSP is doing its thing, building up ASTs and everything it needs to operate, and I wanted to know how that is progressing. Let me record a video to clarify myself.

practicalli-johnny20:11:53

Maybe LSP (clj-kondo) is indexing Java or some large data set. I disabled java as it gives way too many java methods on all the autocomple popups (which I find annoying given very limited use of java interop) In .config/clojure-lsp/config.edn, I set the :java key to nil

:java nil

practicalli-johnny20:11:36

I would not expect to see the "installing luacheck" each time. To me that suggests there is an issue trying to install the package, although why it is trying to install luacheck for a clojure project seems quite strange as well. There could also be an issue with the mason configuration. Does the mason status popup show any issues or outstanding packages, e.g. SPC p m

practicalli-johnny20:11:51

One brute force approach is to use the mason UI, SPC p m to uninstall the luacheck linter. Then see what happens when quiting neovim and starting neovim again. I did have a couple of linters that failed to update and I had to remove them using mason and then reinstall after a neovim restart.

Lucio Assis20:11:37

Thank you, now I understand what the message is actually trying to say. It does show an error

Lucio Assis20:11:43

✗ luacheck
      ▶ # [3/3] spawn: luarocks failed with exit code - and signal -. luarocks is not executable

practicalli-johnny20:11:20

Is luarocks installed ? It should be runable within a mac terminal ap

Lucio Assis20:11:37

Nope. I might have missed that requirement.

Lucio Assis20:11:22

Alright, I got a successful install of luacheck now

practicalli-johnny20:11:23

Does that also improve the startup time for the Clojure LSP UI in neovim, so actions and gr is more responsive?

Lucio Assis20:11:02

Nope, didn't feel any difference

practicalli-johnny21:11:56

SPC p M should ensure that the clojure-lsp is running the latest stable version. setting :java nil in the Clojure LSP server configuration may be a useful optomisation (if you dont use a lot of java interop) I also suggest trying a smaller project (or newly created project) to see if its an issue with the Neovim / Clojure LSP setup or only specific (larger) projects. If its larger projects, then there probably isnt much to be done (unless there is not enough memory available on your computer, which is probably unlikely). If it also happens for smaller projects, then it could be a Clojure or Java environment or tool out of date (or something very new, eg. java 21). Or it could be a neovim config issue or version of neovim (I think I have neovim 0.9.2). I usually update the neovim plugins once a week, as there are regular improvements.

Lucio Assis22:11:41

This is more of a hassle for specific, larger projects, hence I felt like it would be useful to see a progress bar, but most of the time it's alright.

practicalli-johnny22:11:27

Yes, it makes sense if its mostly larger projects, as there is more work to do with the analysis. Keeping the project open in neovim is probably the only way to avoid it (if memory allows)... unless someone buys you an even faster laptop over the winter holidays 🧑‍🎄

😆 1
practicalli-johnny21:11:09

@luciolucio you mentioned you could access Clojure libs by enabling zipPlugin. Am I correct in assuming this requires configuring zipPlugin for files with the .jar extension so that the neovim zipPlugin would treat them as zip files. Did you do this in a Lua configuration somewhere. I've only see vimscript in the neovim docs

au BufReadCmd *.jar,*.xpi call zip#Browse(expand(""))
Reading some history in the #lsp channel, enabling zipPlugin may be https://clojurians.slack.com/archives/CPABC1H61/p1684239469765269 usage and possibly longer time for LSP commands to work. It would be an interesting test to try with and without zipPlugin enabled.

Lucio Assis22:11:57

Not really, I simply enabled the plugin and didn't need any config changes

Lucio Assis22:11:45

It feels marginally better with it disabled. But in my case the problem is just that the project is really big.

practicalli-johnny22:11:58

Unfortunately I havent worked out how to enable the zipPlugin... so jars remain broken for me... Nothing on the internet and neovim docs only show vim script examples 😞

practicalli-johnny22:11:13

I tried adding an autocmd but that didnt work...

vim.api.nvim_create_autocmd("FileType", {
        group = vim.api.nvim_create_augroup("comment_config", { clear = true }),
        pattern = { "jar" },
        callback = function() vim.zip.Browse "<amatch>" end,
        desc = "Java archives jar opened as zip files",
      })
So enabling zipPlugin is beyond my current knowledge for now...

Lucio Assis14:11:30

The only config change I did was to remove zipPlugin from disabled_plugins in init.lua:

-- Configure require("lazy").setup() options
  lazy = {
    defaults = { lazy = true },
    performance = {
      rtp = {
        -- customize default disabled vim plugins
        -- disabled_plugins = { "tohtml", "gzip", "matchit", "zipPlugin", "netrwPlugin", "tarPlugin" },
        disabled_plugins = { "tohtml", "gzip", "matchit", "netrwPlugin", "tarPlugin" },
      },
    },
  },

👍 1
practicalli-johnny14:11:49

Oh, I see. I should have spotted that. Thanks for letting me know.

🙌 1