echasnovski / mini.nvim

Library of 40+ independent Lua modules improving overall Neovim (version 0.8 and higher) experience with minimal effort
MIT License
5k stars 185 forks source link

docs(mini.test): adding note about lua-language-server related config #894

Closed MagicDuck closed 4 months ago

MagicDuck commented 4 months ago

Spent like a couple of hours getting completion working for MiniTest and I figured I would add a note to the docs since it greatly helps with discoverability of the api:

here's a screenshot of it in action:

image
echasnovski commented 4 months ago

Thanks for the PR!

I didn't bother setting up completion because it mostly a handful of methods most of which mimic Neovim's API. But I am not against adding this to 'TESTING.md' indeed. I'll get back to it after testing it out myself.

MagicDuck commented 4 months ago

awesome, thanks! 😄

MagicDuck commented 4 months ago

I just realized that doing this will screw up the autocomplete for the rest of the nvim API (like for example, vim.api.nvim_buf_set_lines()).

image

I wonder if there is a way to append to the workspace library settings 🤔

MagicDuck commented 4 months ago

Yah, there is no way to make it work with both the vim.api.... types injected by neodev and add have a custom .luarc.json unfortunately. The workaround that I've found is to configure neodev like so:

      require('neodev').setup({
        override = function(root_dir, options)
          if vim.startswith(root_dir, '/path/to/your/repos/') then
            options.plugins = { 'mini.test' }
            return options
          end
        end,
      })

So am abandoning this PR, but feel free to include that snippet somewhere in TESTING.md if you feel like it. I personally think it's quite important to have completion for both beginners like me and for easy recall / saving on typing.

echasnovski commented 4 months ago

Yeah, I am not opposed to having in 'TESTING.md' a suggestion on better completions, but also not really invested in investigating how to do that properly.

Closing as "would be good to have, but might require a deep dive into how Lua-LS does things".