Skip to content

fix: reuse of LSP client if the root dir and config name has not changed #378

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

Closed
wants to merge 9 commits into from
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ This plugin is the pure lua replacement for [github/copilot.vim](https://github.
While using `copilot.vim`, for the first time since I started using neovim my laptop began to overheat. Additionally,
I found the large chunks of ghost text moving around my code, and interfering with my existing cmp ghost text disturbing.
As lua is far more efficient and makes things easier to integrate with modern plugins, this repository was created.

</details>

## Install
@@ -61,6 +62,10 @@ require('copilot').setup({
ratio = 0.4
},
},
workspace = {
workspace_folders = {},
auto_add_root_dir = true,
},
suggestion = {
enabled = true,
auto_trigger = false,
@@ -87,6 +92,7 @@ require('copilot').setup({
["."] = false,
},
copilot_node_command = 'node', -- Node.js version must be > 18.x
copilot_model = "", -- Current LSP default is gpt-35-turbo, supports gpt-4o-copilot
server_opts_overrides = {},
})
```
@@ -108,9 +114,37 @@ require("copilot.panel").open({position, ratio})
require("copilot.panel").refresh()
```

### workspace

Adding workspace folders will improve suggestions from Copilot.
There are a few ways of handling this:

- Folders in configuration
Adding folders in `workspace_folders` will ensure they are always passed along Copilot to improve suggestions, though this means for any opened project these same folders are used.
The format is as follows, `uri` can either be an actual URI or just the folder path, it will be converted to an URI:
```lua
workspace = {
workspace_folders = {
{
name: "gits",
uri: "/home/user/gits"
},
{
name: "projects",
uri: "/home/user/projects"
}
},
...
}
```
- When `auto_add_root_dir` it `true` (default), the folder in which you open NeoVim will be automatically used as a workspace folder.
- Using the command `:Copilot workspace add [folderpath]` where `[folderpath]` is the folder you would like to add.
- Using the command `:CopilotAddWorkspaceFolder [folderpath]` where `[folderpath]` is the folder you would like to add.
This command supports autocomplete of folders.

### suggestion

When `auto_trigger` is `true`, copilot starts suggesting as soon as you enter insert mode.
When `auto_trigger` is `true`, copilot starts suggesting as soon as you enter insert mode.

When `auto_trigger` is `false`, use the `next` or `prev` keymap to trigger copilot suggestion.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added copilot/dist/compiled/linux/x64/node_sqlite3.node
Binary file not shown.
Binary file added copilot/dist/compiled/win32/x64/node_sqlite3.node
Binary file not shown.
1,001 changes: 531 additions & 470 deletions copilot/dist/language-server.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions copilot/dist/language-server.js.map

Large diffs are not rendered by default.

Loading