zbirenbaum / copilot.lua

Fully featured & enhanced replacement for copilot.vim complete with API for interacting with Github Copilot
MIT License
2.43k stars 65 forks source link

fix: make root directory detection dynamic #213

Open jolars opened 9 months ago

jolars commented 9 months ago

Fixes #212

Instead of calling vim.loop.cwd() when the plugin is initialized, this pull request calls whatever function is stored in the config as get_root every time the LSP attaches to a buffer. I've set this to require("lspconfig.util").find_git_ancestor by default, which seems like a reasonable default.

I guess we might need to update the installation instructions, since we now depend on lspconfig, or perhaps it would be better just to set a different default (vim.loop.cwd(), but called every time the server is updated, maybe).