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

feat: add lsp-ai support #3206

Merged
merged 1 commit into from
Oct 9, 2024
Merged

feat: add lsp-ai support #3206

merged 1 commit into from
Oct 9, 2024

Conversation

Robzz
Copy link
Contributor

@Robzz Robzz commented Jun 17, 2024

This PR adds support for the lsp-ai language server. Since the server is language-agnostic, I've set the defaults to attach to all filetypes, and always run in single-file mode.

Do note that as is, this is not a full, functional configuration (it shouldn't error, just won't generate any completions), as there are parts for which I don't think there are good default values, so I just want to be sure you're good with this as long as I document it, since from a quick look at the supported server list it looks like most (all ?) servers work out-of-the-box with the default config of an empty setup{} call. Then again this one is a bit unusual.
In particular, a user would need to select an inference backend, which could either be some API requiring an API key or some other user-managed inference server (no sane defaults for us to provide here), or have lsp-ai do inference itself with llama.cpp, which requires a decent GPU as well as downloading a few GBs of model files from HuggingFace, which I don't think is a great default either.

@justinmk
Copy link
Member

justinmk commented Oct 1, 2024

needs a rebase, the server_configurations/ directory was renamed to configs/ #3330

@Robzz
Copy link
Contributor Author

Robzz commented Oct 2, 2024

Thanks for the heads up, will do and attempt to finish this in the next few days.

@Robzz Robzz force-pushed the feat/add-lsp-ai branch 2 times, most recently from e9f60ab to 195b0ca Compare October 8, 2024 16:20
@Robzz
Copy link
Contributor Author

Robzz commented Oct 8, 2024

I finally got to play a bit with an up to date version of the language server to make sure everything works, seems OK. I still don't think there's much more that can be provided in terms of reasonable defaults (except maybe something for the root dir ?), so this is the bare minimum required for the server to attach without complaints.

@Robzz Robzz marked this pull request as ready for review October 8, 2024 16:49
@Robzz Robzz requested a review from glepnir as a code owner October 8, 2024 16:49
https://github.com/SilasMarvin/lsp-ai

LSP-AI is an open source language server that serves as a backend for AI-powered functionality in your favorite code
editors. It offers features like in-editor chatting with LLMs and code completions.
Copy link
Member

Choose a reason for hiding this comment

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

How does chat work? Is that a custom lsp request?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's one available (document/textGeneration IIRC) but it feels somewhat low-level, The more user friendly way is to define a prefix in config that enables the chat code action when present in the buffer.

@justinmk justinmk merged commit 8411d98 into neovim:master Oct 9, 2024
11 checks passed
@Robzz Robzz deleted the feat/add-lsp-ai branch October 9, 2024 10:49
models = vim.empty_dict(),
},
},
docs = {
Copy link
Contributor

@khaneliman khaneliman Oct 15, 2024

Choose a reason for hiding this comment

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

Getting an issue downstream with this being a table instead of just a string, do we need to support the desc sometimes being a table of strings ?

Copy link
Member

Choose a reason for hiding this comment

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

pr welcome

Copy link
Contributor

@khaneliman khaneliman Oct 15, 2024

Choose a reason for hiding this comment

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

Was just double checking whether it was supposed to only be strings or you do expect tables for this, if it can be changed I can do a quick PR. Created #3374 to address

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that looks like a mistake on my part thanks for the PR 👍

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.

4 participants