-
Notifications
You must be signed in to change notification settings - Fork 166
Find and run the server locally #404
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
Find and run the server locally #404
Conversation
- Add `files` dependency. - Change `executable-find` second argument to `nil` in `copilot-server-executable` to search locally. - Remove existence check in `copilot--start-server` since already checked in `copilot-server-executable`. - Update `copilot--start-server` to set `default-directory` to local home when in remote context.
- Set `default-directory` to local home when installing the server from a remote directory.
faf032f to
3004101
Compare
copilot.el
Outdated
| (file-exists-p copilot-server-executable)) | ||
| copilot-server-executable) | ||
| ((executable-find copilot-server-executable t)) | ||
| ((executable-find copilot-server-executable nil)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just remove this param - it's optional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
copilot.el
Outdated
| (t "bin")) | ||
| copilot-server-executable) | ||
| t))) | ||
| nil))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
copilot.el
Outdated
| "Interactively install server." | ||
| (interactive) | ||
| (if-let* ((npm-binary (executable-find "npm"))) | ||
| (if-let* ((default-directory (if (file-remote-p default-directory) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what this is trying to solve - I don't think it will have any effect on the executable-find call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, you want it to search only the local filesystem. As noted in another remark - I have some doubts about this approach as I think this might be quite surprising to some people.
Doing this might be super confusing, though, as I'm not sure anyone editing something over TRAMP would expect something like this to happen. |
Removed the redundant ~nil~ argument from the ~executable-find~ function call.
- Change `copilot-install-dir` default value to use `user-emacs-directory` for constructing the cache path - Modify `copilot-install-server` to handle `shell-file-name` correctly when using connection-local variables
The change is scoped to lexical scope only. By using I've confirmed that |
Do you know how Eglot behaves when dealing with TRAMP? Does try to start LST servers locally or remotely? My point was mostly that I'm not sure if when I edit something remotely I'd expect it to trigger the creation of a local process, but I haven't used TRAMP much in ages and I'm not sure what are the common practices there these days. |
Eglot runs LSP servers remotely when used with TRAMP. I've tested this, and LSP servers run remotely as expected. According to TRAMP's document (https://www.gnu.org/software/tramp/#Remote-processes), the location where processes run depends solely on the But I'm also not very familiar with the current common practices around TRAMP. |
|
@ecofighter I'm guessing it'd be best if we try to run the server locally for local files and remotely for remote files (I guess for remote files we can also elect to not do anything) to be aligned with how LSP packages work in general. |
I understood. |
Currently, when editing remote files, copilot.el searches for the executable on the remote system and launches the server remotely. This PR fixes that behavior by ensuring both the executable search and server launch occur locally.
executable-findsecond argument tonilincopilot-server-executableto search locally.default-directoryto local home directory when it is a remote directory incopilot--start-serverandcopilot-install-server.This ensures processes run with the local home directory as their working directory.
copilot--start-serversince it's already verified in thecopilot-server-executablefunction.Fixes #403