Skip to content

feat: more sophisticated method to get copilot path#78

Merged
zbirenbaum merged 3 commits intozbirenbaum:masterfrom
rockofox:master
Nov 13, 2022
Merged

feat: more sophisticated method to get copilot path#78
zbirenbaum merged 3 commits intozbirenbaum:masterfrom
rockofox:master

Conversation

@rockofox
Copy link
Copy Markdown
Contributor

@rockofox rockofox commented Nov 10, 2022

Don't rely on a fixed plugin_manager_path to find the plugin base path. Not only does that require changing an option depending on what plugin manager the user uses, but it also makes it incompatible with some plugin managers (i.e Nix, which doesn't store plugins under their literal name).

This PR uses debug.getinfo(1).source:sub(2) to find the current lua file and traverses to the base directory from there. This is much more versatile and portable.

@zbirenbaum
Copy link
Copy Markdown
Owner

I think this was proposed a while back, but I wasn't a huge fan of using debug functions as part of the plugin and tried to find another way. Unfortunately the way I came up with broke under a variety of circumstances so it was reverted.

Since debug is probably the only way of doing this, I guess it might make sense. What do you think @MunifTanjim?

@MunifTanjim
Copy link
Copy Markdown
Collaborator

MunifTanjim commented Nov 10, 2022

Was vim.api.nvim_get_runtime_file('copilot/index.js', false) considered before?

@zbirenbaum
Copy link
Copy Markdown
Owner

vim.api.nvim_get_runtime_file('copilot/index.js', false)

I can't remember exactly but this seems to work great. I'll request it as a change.

Comment thread lua/copilot/util.lua Outdated
@rockofox rockofox force-pushed the master branch 2 times, most recently from 838c06d to 2a9a182 Compare November 11, 2022 07:57
@zbirenbaum zbirenbaum merged commit c65288b into zbirenbaum:master Nov 13, 2022
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.

3 participants