-
-
Notifications
You must be signed in to change notification settings - Fork 906
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
Feature/lsp copilot #4635
Feature/lsp copilot #4635
Conversation
e6e694c
to
a60adf3
Compare
@kiennq here's the lsp-copilot client. I've included in the PR a change that i've submitted previously that improves an issue that happens with ruff (probably with others as well) -- lsp-mode broadcasts The first commit in the PR fixes that. Let me know if you prefer to go another way with this, or keep this change outside of this PR and iterate over #4494 |
85dab1c
to
2df4263
Compare
(CI is failing because the compiler is not understanding the |
Regarding documentation: I'm not sure how to place the copilot in the language list, and even if that's where it should live. I've placed it in the Language section for lack of a better, obvious place. |
I would prefer to separate them. |
2df4263
to
1752d1c
Compare
2896279
to
c529d46
Compare
@kiennq I've fixed the issues you've pointed out, let me know if you think this is good to go or if it needs more work. |
LGTM. |
Now the lsp-controlled copilot npm install path contains a bin with a copilot-node-server -- we no longer need to go out of our way to find the language server js and execute it with node
ACTUALLY: The executable script is there, but then it complains that it can't find the tokenizer ... calling I'll have to ammend the last commit to work around that, maybe keeping the same strategy as was present in c529d46 |
I've tried your last commit, the |
Weird -- I've tested with your fork and copilot did not complain about not finding the tokenizer model ... Let's hope it does not happen again ;) |
About the changes in your fork -- I've left a couple of comments there. Other than that, how do you want to proceed? Should I merge your changes here or do you prefer to merge them later? |
Yes, please take my commit and make changes as you see fit. |
Done @kiennq ! |
Thank you. Merge this now. @jcs090218 @yyoncho @ericdallo |
Hi, @kassick, @kiennq ! Great change—but for my purposes, I'm trying to disable the copilot LSP server in emacs. When I'm setting the enabled to false in my config (setq lsp-copilot-enabled nil) It doesn't turn off and whenever I start an lsp mode, say in golang, it always initializes. If I logout, it will bring up the annoying pop up of logging in. Is there another way to turn it off completely, so the copilot lsp backend doesn't activate? I was reading https://emacs-lsp.github.io/lsp-mode/page/settings/mode/#lsp-disabled-clients and none of the following values passed, Update: the only way I found to forcibly disable this backend from activating on lsp buffers is to set |
Hey @thecsw ! I think that the enabled flag ended up being forgotten in the final code, so indeed it is not doing what any user would expect it to. I'll open a new PR to try and sanitize that. I'll tag you so you can give some input if it works as you'd expect ;) Meanwhile, if you want the copilot server not to start at all you can either:
If you'd rather control when copilot is enabled (e.g. disable it for go but enable it for python), then you can use the applicable-fn to do so as well: (setq lsp-copilot-applicable-fn
(lambda (buf-name buf-mode)
(pcase buf-mode
('python-mode t)
('go-mode nil)
(t lsp-copilot-enabled)))) Let me know if any of that fixes your issue while the PR is not ready. I'm not sure why |
Hello, @kassick and thank you for such prompt response! re: disabled clients—I think the issue is with my emacs env, at least wherever the init happens, where it doesn't have access to those symbols and crashes during the startup. Same thing happens when setting (setq lsp-copilot-applicable-fn (-const nil)) with Though the second way, (setq lsp-copilot-applicable-fn (lambda (&rest _) lsp-copilot-enabled)) worked. I actually don't know how to uninstall, since I don't have any copilot packages installed through MELPA and had a hard time finding on where emacs downloads the backend to. My configuration system is rather simple, I have a |
Ah, (use-package lsp-mode
;; ... your other settings here
:config
(require 'dash) ;; actually not needed in the :config of lsp-mode, since it will have already been loaded ...
(setq lsp-copilot-applicable-fn (-const nil)))
Good!
Oh, no, the copilot-ls does not require anything else from melpa, only that the You may have installed it globally somewhere ( If you've installed it via |
Ahh! I see—even though I've been using emacs for a very long time, still nowhere near the comfort level I'd like to be at. Didn't know you needed Blehh, yeah—I opened one random file and it "downloaded" the lsp server—I kind of blanked out on how it did it, only when I saw this PR I realized it was through npm—deleting the node server also works! Wonderful, thanks for your help, @kassick—much appreciate it and happy holidays!! |
Sir, this PR unintentionally enables this "under development" feature. I've been an Emacs user for 20+ years now. Please don't enable features if they are not ready for prime time. |
This PR doesn't actually add the inline completion functionality @farazshaikh , that'd be #4623 You can disable inline completions by turning off |
As to the keys not reacting -- I've observed that too sometimes (but not always) when the completion is shown on idle. When I explicitly ask for it, I have no recollection of running into this issue. I did not figure out why, since the I'm considering to rework the inline completion to work around this somehow (either go company's way with after-command or use a minor mode for when the completion is displaying). @farazshaikh If you have observed anything that may hint on why the overlay keymap is not active when it should, please do share it so we can improve the feature. |
This PR provides lsp-copilot, a client for the Copilot Node Server.