-
Notifications
You must be signed in to change notification settings - Fork 208
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
Kill remote process #953
Kill remote process #953
Conversation
werhner
commented
May 23, 2024
- add option lsp-bridge-remote-enable-kill-process, which can kill remote lsp-bridge process when Emacs exit
- add option acm-backend-ctags-max-candidates
- add command lsp-bridge-ctags-find-def-at-point, which uses xref as front-end.
acm/acm-backend-codeium.el
Outdated
(let ((end-position (line-end-position))) | ||
(let ((start-position (line-beginning-position)) | ||
(middle-position (point))) | ||
(forward-line (- (plist-get candidate-info :line) (count-lines (point-min) (line-beginning-position)))) | ||
(if preview | ||
(acm-preview-create-overlay (point) end-position (plist-get candidate-info :label)) | ||
(delete-region (point) end-position) | ||
(acm-preview-create-overlay start-position middle-position (plist-get candidate-info :label)) | ||
(delete-region start-position middle-position) |
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.
Above code fix some bug?
lsp-bridge.el
Outdated
(defface lsp-bridge-tag-annotation-face | ||
'((((background light)) | ||
:foreground "#666666" :slant italic) | ||
(t | ||
:foreground "#c0c0c0" :slant italic)) | ||
"Face used for annotations when presenting a tag. | ||
Annotations include kind, type, etc.") | ||
|
||
(defun lsp-bridge-xref--make-object (tag) | ||
"Make xref object of TAG." | ||
(let* ((path (plist-get tag :ext-abspath)) | ||
(line (plist-get tag :line)) | ||
(str (plist-get tag :str)) | ||
(annotation (plist-get tag :annotation))) | ||
(xref-make | ||
(if annotation | ||
(concat (propertize (concat "(" annotation ") ") 'face 'lsp-bridge-tag-annotation-face) str) | ||
str) | ||
(xref-make-file-location path line 0)))) | ||
|
||
(defun lsp-bridge-xref-callback (tags) | ||
(let ((fetcher (lambda () (mapcar #'lsp-bridge-xref--make-object tags)))) | ||
(xref-show-xrefs fetcher nil))) | ||
|
||
(defun lsp-bridge-ctags-find-def-at-point () | ||
(interactive) | ||
(if (lsp-bridge-is-remote-file) | ||
(lsp-bridge-remote-send-func-request "ctags_find_def" | ||
(list | ||
(symbol-at-point) | ||
(file-local-name (buffer-file-name)))) | ||
(lsp-bridge-call-async "ctags_find_def" (symbol-at-point) (buffer-file-name)))) |
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.
Those code should move to file acm-backend-ctags.el , and rename with acm-backend-ctags-*
def close_client(self): | ||
for client in self.client_dict.values(): | ||
if hasattr(client, "kill_lsp_bridge_process"): | ||
client.kill_lsp_bridge_process() | ||
|
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.
Why not add close_client code to function "cleanup" ?
lsp-bridge.el
Outdated
(when lsp-bridge-remote-enable-kill-process | ||
(lsp-bridge-call-sync "close_client")) |
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.
Shoud remove those code if code of close_client move to "cleanup" function.
And don't use lsp-bridge-call-sync, it will block Emacs.
lsp-bridge.el
Outdated
(defun lsp-bridge-call-sync (method &rest args) | ||
"Call Python EPC function METHOD and ARGS synchronously." | ||
(lsp-bridge-deferred-chain | ||
(lsp-bridge-epc-call-sync lsp-bridge-epc-process (read method) args))) | ||
|
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.
Don't use this function, it will block Emacs
Thanks for patch, I have review code, need adjust. ;) |
Thanks for the review, I'll try to adjust these in my spare time. |
@werhner Please let me know if this patch can be merged, thank you |
"Maximal number of candidate of menu." | ||
:type 'integer | ||
:group 'acm-backend-ctags) | ||
(require 'xref) |
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.
Duplicate code?
self.close_client() | ||
"""Do some cleanup before exit python process.""" |
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.
close_client should move to below of function comment
@werhner Please adjust code when you have time. I will merge your patch as soon as possible. Thank you. |