Skip to content
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

fix(lsp): enforce lvim completion for lua-server #3035

Merged
merged 3 commits into from Sep 19, 2022
Merged

Conversation

kylo252
Copy link
Collaborator

@kylo252 kylo252 commented Sep 17, 2022

Description

lua-dev has changed the way it accepts settings, this will now hopefully accommodate those changes!

  • fix lvim. auto-completion in config.lua
  • add a select list of plugins by default that should always have auto-completion
    plugins = { "plenary.nvim", "telescope.nvim", "nvim-treesitter", "packer.nvim", "LuaSnip" }

fixes #3002

How Has This Been Tested?

  • open config.lua start typing lvim.builtin.telescope.
  • open config.lua start typing require'packer.

lspconfig.util.default_config = vim.tbl_extend("force", lspconfig.util.default_config, {
on_new_config = make_on_new_config(lspconfig.util.default_config.on_new_config),
})

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose passing on_new_config in opts doesn't work?
Alternatively, lua_dev.setup() returns the settings, so we could try return vim.tbl_deep_extend("force", luadev, opts)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose passing on_new_config in opts doesn't work?

that one is getting overwritten unfortunately, I nearly want to write our own lua_dev.setup() and skip this entire dance..

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, lua_dev.setup() returns the settings, so we could try return vim.tbl_deep_extend("force", luadev, opts)

It seems that nlspsettings overrides the configuration in that case (not sure if it's a bug / intended or something else going on). So that might not work either...

@abzcoding
Copy link
Member

@kylo252 I just removed my custom config and used this instead, and it worked just fine,
not sure about customization though

@abzcoding
Copy link
Member

Also, I'm not sure if we need all of those plugins activated or not

 { "plenary.nvim", "telescope.nvim", "nvim-treesitter", "packer.nvim", "LuaSnip" }

it seems a bit much
Screenshot 2022-09-18 at 7 24 25 PM

@lvimuser
Copy link
Collaborator

Agree with abz. I don't think plenary should be a default either...
Maybe leave it empty for now?

@kylo252
Copy link
Collaborator Author

kylo252 commented Sep 19, 2022

Edit: it was the packer pattern messing things up, it should've been packer.nvim, instead it was adding all the plugins 😅


it seems a bit much

I did change the maxPreload=1000, and it was pretty fast, but I have only tested on a single machine

Agree with abz. I don't think plenary should be a default either...
Maybe leave it empty for now?

the way I think about it is that you'd want these kind of completion for a nice dev environment:

  • plenary: async, busted, curl, etc
  • telescope: custom finders
  • luasnip: snippets API
  • treesitter: extended API that's not yet available in core
  • packer: alternative async impl (probably not that useful)

I'll try to see if I can get the lua server to ignore test{s} directories, and how much would that save us.

Copy link
Member

@abzcoding abzcoding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @kylo252, it is much faster now

LGTM 🚀

@kylo252 kylo252 merged commit 68fdbaa into rolling Sep 19, 2022
@kylo252 kylo252 deleted the fix-luadev branch September 19, 2022 11:10
@lvimuser
Copy link
Collaborator

I did change the maxPreload=1000, and it was pretty fast, but I have only tested on a single machine

I missed that, looks pretty good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lua-dev config broken
3 participants