-
-
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
lsp starting stuck when open tramp file. #1845
Comments
tmp/pyls-remote-1-stderr:
|
|
Seems like for some reason |
Just saying but it might be because we're choosing |
maybe this is the problematic line: I mean it cant be us using utf-8 because the issue seems to happen when sending data. @tshu-w can you try changing 'binary to 'utf-8-unix? Let me know if you need more help to try that. |
Can you test |
@yyoncho Neither of the above methods worked. I tried like this: ;; define fun !lsp-tramp-connection and change two `binaray' to `utf-8-unix'
(advice-add #'lsp-tramp-connection :override #'!lsp-tramp-connection)
;; or
(setq inhibit-eol-conversion t) It's worth mentioning that occasionally I can successfully start the server. |
These are variables to test as well: coding-system-for-read Without a reproducer, it is a guessing game. If none of these works I will ask the author of tramp to help with that. |
None of the above variables works (; |
@yyoncho I also try pyright, I got |
@tshu-w I use pyright over tramp. My settings are here: emacs-lsp/lsp-pyright#10 |
mjlbach's configuration works for me. I think the original problem was either in pyls or in the configuration in the documentation, I didn't delve into the |
I get the same error. I'm not familiar with the code, or json, but could there somehow be a |
@abred did you figure out what was causing this? I am having the same problem with a remote host and also am getting the error about the missing curly brace. I've checked and emacs is sending the correct string with matching braces but it's being truncated for some reason when sent. EDIT: EDIT EDIT: |
Using remote pyls over tramp and this dirty fix has worked for me. However, I have seen a similar error at work where I use lsp-clangd over tramp. It used to work fine, but after updating doom emacs (and lsp-mode with it) in the last week, i experience a similar error where the json of the message seems to be missing a curly brace at the end. For corporate policy reasons, I cannot share the clangd output, so it's good to see it reproducing with pyls. I will recover the commit differences and report tomorrow. Before the dirty fix@raspberrypi:~ $ pgrep pyls
6727
@raspberrypi:~ $ tail -f /proc/6727/fd/2
2020-11-04 22:27:39,803 UTC - ERROR - pyls_jsonrpc.streams - Failed to parse JSON message b'\n\n{"jsonrpc":"2.0","method":"initialize","params":{"processId":null,"rootPath":"/home/petr_tik","clientInfo":{"name":"emacs","version":"GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30, cairo version 1.15.10)\\n of 2020-10-22"},"rootUri":"file:///home/petr_tik","capabilities":{"workspace":{"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"]},"applyEdit":true,"symbol":{"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},"executeCommand":{"dynamicRegistration":false},"didChangeWatchedFiles":{"dynamicRegistration":true},"workspaceFolders":true,"configuration":true},"textDocument":{"declaration":{"linkSupport":true},"definition":{"linkSupport":true},"implementation":{"linkSupport":true},"typeDefinition":{"linkSupport":true},"synchronization":{"willSave":true,"didSave":true,"willSaveWaitUntil":true},"documentSymbol":{"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"hierarchicalDocumentSymbolSupport":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"prepareSupport":true},"codeAction":{"dynamicRegistration":true,"isPreferredSupport":true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"completion":{"completionItem":{"snippetSupport":true,"documentationFormat":["markdown"],"resolveAdditionalTextEditsSupport":true},"contextSupport":true},"signatureHelp":{"signatureInformation":{"parameterInformation":{"labelOffsetSupport":true}}},"documentLink":{"dynamicRegistration":true,"tooltipSupport":true},"hover":{"contentFormat":["markdown","plaintext"]},"foldingRange":{"dynamicRegistration":true},"callHierarchy":{"dynamicRegistration":false},"publishDiagnostics":{"relatedInformation":true,"tagSupport":{"valueSet":[1,2]},"versionSupport":true}},"window":{"workDoneProgress":true}},"initializationOptions":null,"workDoneToken":"1"},"id":1'
Traceback (most recent call last):
File "/home/petr_tik/.local/lib/python3.7/site-packages/pyls_jsonrpc/streams.py", line 40, in listen
message_consumer(json.loads(request_str.decode('utf-8')))
ValueError: Unexpected character in found when decoding object value After applying the dirty fix and starting a new pylsThere is nothing in stderr. @raspberrypi:~ $ pgrep pyls
7434
@raspberrypi:~ $ tail /proc/7434/fd/2 2 questionsPotentially unrelated
|
Hello sorry to comment on a closed issue however this was the closest issue matching mine, however I'm using tramp 2.5 installed from gnu C-h v Traceback (most recent call last): |
@Leonkoithara have you try #2531 (defun lsp-tramp-connection (local-command &optional generate-error-file-fn)
"Create LSP stdio connection named name.
LOCAL-COMMAND is either list of strings, string or function which
returns the command to execute."
(defvar tramp-connection-properties)
;; Force a direct asynchronous process.
(when (file-remote-p default-directory)
(add-to-list 'tramp-connection-properties
(list (regexp-quote (file-remote-p default-directory))
"direct-async-process" t)))
(list :connect (lambda (filter sentinel name environment-fn)
(let* ((final-command (lsp-resolve-final-function
local-command))
(_stderr (or (when generate-error-file-fn
(funcall generate-error-file-fn name))
(format "/tmp/%s-%s-stderr" name
(cl-incf lsp--stderr-index))))
(process-name (generate-new-buffer-name name))
(process-environment
(lsp--compute-process-environment environment-fn))
(proc (make-process
:name process-name
:buffer (format "*%s*" process-name)
:command final-command
:connection-type 'pipe
:coding 'no-conversion
:noquery t
:filter filter
:sentinel sentinel
:file-handler t)))
(cons proc proc)))
:test? (lambda () (-> local-command lsp-resolve-final-function
lsp-server-present?)))) |
I tried this but it didn't work although this time /tmp/pyls-*-stderr file was not created
|
Sorry, I don't have any ideas. Maybe you can create a new issue for it. |
Sorry to bring this up again, and hopefully this is in the right place. An earlier comment suggested changing lsp--make-message to change \r\n\r\n to just \n\n. I considered doing just that to make gopls work. In short, using gopls I see
It's that last line that needed changing and that makes line endings a consistent CRLF and everything starts working. (This is lsp-mode-20240116.1748 from ELPA, incidentally.) |
Describe the bug
lsp starting stuck when open tramp file..
To Reproduce
emacs -q -l lsp-start-plain.el
C-x C-f /ssh:host_name:~/test/test.py
to open an empty project with an empty python file.my lsp-start-plain.el
Expected behavior
lsp start server correcting.
Which Language Server did you use
lsp-python
OS
Local: macOS GNU Emacs 27.0.91 (build 1, x86_64-apple-darwin19.5.0, NS appkit-1894.50 Version 10.15.5 (Build 19F101)) of 2020-06-20
remote: ubuntu
Error callstack
there is no error.
maybe related:
*lsp-log*:
*pyls-remote* is empty
*lsp-log: pyls-remote:28853*:
The text was updated successfully, but these errors were encountered: