folke / lazydev.nvim

Faster LuaLS setup for Neovim
Apache License 2.0
717 stars 7 forks source link

How can I uses lazydev without lspconfig? #27

Closed Charlie-83 closed 5 months ago

Charlie-83 commented 5 months ago

Docs just say

If you don't use nvim-lspconfig, then you can use require('lazydev').find_workspace(buf?) to check if the buffer is part of an existing workspace or its libraries.

But I don't know what this is actually instructing me to do.

I use this autocommand to start lua-ls

autocmd("FileType", {
    pattern = "lua",
    callback = function()
        local root_dir = vim.fs.dirname(vim.fs.find({ "lazy-lock.json" })[1])
        local client = vim.lsp.start({
            name = "lua-ls",
            cmd = { "lua-language-server" },
            root_dir = root_dir,
        })
        vim.lsp.buf_attach_client(0, client)
    end,
})

I am using Lazy as my plugin manager and have

    {
        "folke/lazydev.nvim",
        ft = "lua",
        config = true,
    },
folke commented 5 months ago

That's only needed if you want to define custom workspaces. Based on your code, you probably don't.

Also, as is instructed in the issue template, user questions should be posted in discussions!

Charlie-83 commented 5 months ago

Sorry, have moved to discussions. It asked if I wanted the bug or feature template: I didn't want either so selected blank and didn't see that