[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Tramp and conversion of \r\n into \n
From: |
APEL Martin |
Subject: |
RE: Tramp and conversion of \r\n into \n |
Date: |
Wed, 16 Dec 2020 15:55:49 +0000 |
Hi Michael,
Thanks for your feedback. I think, the reason, why you only see the json
contents without the header and with the last closing brace missing, is that
you take the input to clangd --verbose, which is after clangd has read it. My
wrapper script intercepted the input and therefore still had the header and the
closing brace. Anyway your change looks promising and I will build an Emacs
version from master with your change applied and let you know, if this fixes
the problem.
I will also ping the guy from lsp-mode and point him to your answer, so he can
possibly respond as well.
Best Regards,
Martin
> -----Original Message-----
> From: Michael Albinus <michael.albinus@gmx.de>
> Sent: 16 December 2020 16:35
> To: APEL Martin <Martin.APEL@3ds.com>
> Cc: emacs-devel@gnu.org
> Subject: Re: Tramp and conversion of \r\n into \n
>
>
> APEL Martin <Martin.APEL@3ds.com> writes:
>
> > Hi Michael,
>
> Hi Martin,
>
> > 6. Now try to open the main.cpp file on the remote machine in Emacs on
> > the local machine. This should trigger the start of clangd via
> > lsp-mode. If the error occurs, the modeline shows 'clangd starting'
> > forever.
>
> Well, I don't belive it is eol conversion. With some more stderr redirection,
> I
> could see that the local process sends
>
> --8<---------------cut here---------------start------------->8---
> Content-Length: 2134
>
> {"jsonrpc":"2.0","method":"initialize","params":{"processId":null,"rootPath":
> "/home/albinus/tmp/minicpp","clientInfo":{"name":"emacs","version":"GN
> U Emacs 28.0.50 (build 28, x86_64-pc-linux-gnu, GTK+ Version 3.24.23, cairo
> version 1.16.0)\n of 2020-12-
> 15"},"rootUri":"file:///home/albinus/tmp/minicpp","capabilities":{"workspac
> e":{"workspaceEdit":{"documentChanges":true,"resourceOperations":["crea
> te","rename","delete"]},"applyEdit":true,"symbol":{"symbolKind":{"valueSe
> t":[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]}},"exe
> cuteCommand":{"dynamicRegistration":false},"didChangeWatchedFiles":{"d
> ynamicRegistration":true},"workspaceFolders":true,"configuration":true},"te
> xtDocument":{"declaration":{"linkSupport":true},"definition":{"linkSupport":
> true},"implementation":{"linkSupport":true},"typeDefinition":{"linkSupport":
> true},"synchronization":{"willSave":true,"didSave":true,"willSaveWaitUntil":t
> rue},"documentSymbol":{"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,1
> 2,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"hierarchicalDocumentSymbolS
> upport":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":
> {"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"prepar
> eSupport":true},"codeAction":{"dynamicRegistration":true,"isPreferredSupp
> ort":true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","qui
> ckfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","sourc
> e","source.organizeImports"]}}},"completion":{"completionItem":{"snippetS
> upport":false,"documentationFormat":["markdown"],"resolveAdditionalTex
> tEditsSupport":true},"contextSupport":true},"signatureHelp":{"signatureInfo
> rmation":{"parameterInformation":{"labelOffsetSupport":true}}},"document
> Link":{"dynamicRegistration":true,"tooltipSupport":true},"hover":{"contentF
> ormat":["markdown","plaintext"]},"foldingRange":{"dynamicRegistration":tr
> ue},"callHierarchy":{"dynamicRegistration":false},"publishDiagnostics":{"relat
> edInformation":true,"tagSupport":{"valueSet":[1,2]},"versionSupport":true}}
> ,"window":{"workDoneProgress":true}},"initializationOptions":null,"workDo
> neToken":"1"},"id":1}
> --8<---------------cut here---------------end--------------->8---
>
> Both on the remote side, running "clangd --log=verbose", we see only
>
> --8<---------------cut here---------------start------------->8---
> I[16:18:53.667] Ubuntu clangd version 11.0.0-2 I[16:18:53.667] PID: 269465
> I[16:18:53.667] Working directory: /home/albinus/tmp/minicpp
> I[16:18:53.667] argv[0]: clangd I[16:18:53.667] argv[1]: --log=verbose
> V[16:18:53.667] User config file is /home/albinus/.config/clangd/config.yaml
> I[16:18:53.667] Starting LSP over stdin/stdout V[16:18:53.668] <<<
>
> {"jsonrpc":"2.0","method":"initialize","params":{"processId":null,"rootPath":
> "/home/albinus/tmp/minicpp","clientInfo":{"name":"emacs","version":"GN
> U Emacs 28.0.50 (build 28, x86_64-pc-linux-gnu, GTK+ Version 3.24.23, cairo
> version 1.16.0)\n of 2020-12-
> 15"},"rootUri":"file:///home/albinus/tmp/minicpp","capabilities":{"workspac
> e":{"workspaceEdit":{"documentChanges":true,"resourceOperations":["crea
> te","rename","delete"]},"applyEdit":true,"symbol":{"symbolKind":{"valueSe
> t":[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]}},"exe
> cuteCommand":{"dynamicRegistration":false},"didChangeWatchedFiles":{"d
> ynamicRegistration":true},"workspaceFolders":true,"configuration":true},"te
> xtDocument":{"declaration":{"linkSupport":true},"definition":{"linkSupport":
> true},"implementation":{"linkSupport":true},"typeDefinition":{"linkSupport":
> true},"synchronization":{"willSave":true,"didSave":true,"willSaveWaitUntil":t
> rue},"documentSymbol":{"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,1
> 2,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"hierarchicalDocumentSymbolS
> upport":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":
> {"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"prepar
> eSupport":true},"codeAction":{"dynamicRegistration":true,"isPreferredSupp
> ort":true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","qui
> ckfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","sourc
> e","source.organizeImports"]}}},"completion":{"completionItem":{"snippetS
> upport":false,"documentationFormat":["markdown"],"resolveAdditionalTex
> tEditsSupport":true},"contextSupport":true},"signatureHelp":{"signatureInfo
> rmation":{"parameterInformation":{"labelOffsetSupport":true}}},"document
> Link":{"dynamicRegistration":true,"tooltipSupport":true},"hover":{"contentF
> ormat":["markdown","plaintext"]},"foldingRange":{"dynamicRegistration":tr
> ue},"callHierarchy":{"dynamicRegistration":false},"publishDiagnostics":{"relat
> edInformation":true,"tagSupport":{"valueSet":[1,2]},"versionSupport":true}}
> ,"window":{"workDoneProgress":true}},"initializationOptions":null,"workDo
> neToken":"1"},"id":1
>
> E[16:18:53.668] JSON parse error: [3:2132, byte=2134]: Expected , or } after
> object property --8<---------------cut
> here---------------end--------------->8---
>
> That is, both the Content-Length header is missing as well as the final "}".
> This is strange. I've tried to debug lsp-mode.el, but it is an 8200+ lines
> monster, and not documented well. However, lsp-tramp-connection uses
> start-file-process-shell-command, which means several shell calls in
> between. So I have rewritten this to the following code:
>
> --8<---------------cut here---------------start------------->8---
>
> (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."
> ;; Force a direct asynchronous process.
> (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?)))) --8<---------------cut here---------------end--------------->8---
>
> With this, your test scenario works fine for me. Could you check how it fits
> in
> your environment?
>
> One disadvantage is, that direct asynch processes work only with the
> upcoming Tramp 2.5 (that's already in Emacs master), and it works only if the
> asynchronous process does not require password handling. The latter is true,
> if your ssh authentication is based on keys, or if you use Tramp's control
> master arguments (enabled by default).
>
> > Hope this helps,
> >
> > Martin
>
> Best regards, Michael.
This email and any attachments are intended solely for the use of the
individual or entity to whom it is addressed and may be confidential and/or
privileged.
If you are not one of the named recipients or have received this email in error,
(i) you should not read, disclose, or copy it,
(ii) please notify sender of your receipt by reply email and delete this email
and all attachments,
(iii) Dassault Systèmes does not accept or assume any liability or
responsibility for any use of or reliance on this email.
Please be informed that your personal data are processed according to our data
privacy policy as described on our website. Should you have any questions
related to personal data protection, please contact 3DS Data Protection Officer
at 3DS.compliance-privacy@3ds.com<mailto:3DS.compliance-privacy@3ds.com>
For other languages, go to https://www.3ds.com/terms/email-disclaimer
- Re: Tramp and conversion of \r\n into \n, (continued)
- Re: Tramp and conversion of \r\n into \n, Michael Albinus, 2020/12/15
- RE: Tramp and conversion of \r\n into \n, APEL Martin, 2020/12/15
- Re: Tramp and conversion of \r\n into \n, Michael Albinus, 2020/12/15
- Re: Tramp and conversion of \r\n into \n, Michael Albinus, 2020/12/15
- RE: Tramp and conversion of \r\n into \n, APEL Martin, 2020/12/16
- Re: Tramp and conversion of \r\n into \n, Michael Albinus, 2020/12/16
- RE: Tramp and conversion of \r\n into \n,
APEL Martin <=
- RE: Tramp and conversion of \r\n into \n, APEL Martin, 2020/12/17
- Re: Tramp and conversion of \r\n into \n, Michael Albinus, 2020/12/17
- RE: Tramp and conversion of \r\n into \n, APEL Martin, 2020/12/18
- Re: Tramp and conversion of \r\n into \n, Michael Albinus, 2020/12/18
- RE: Tramp and conversion of \r\n into \n, APEL Martin, 2020/12/18
- Re: Tramp and conversion of \r\n into \n, Michael Albinus, 2020/12/18
- RE: Tramp and conversion of \r\n into \n, APEL Martin, 2020/12/18
- Re: Tramp and conversion of \r\n into \n, Michael Albinus, 2020/12/18
- RE: Tramp and conversion of \r\n into \n, APEL Martin, 2020/12/18
- Re: Tramp and conversion of \r\n into \n, Michael Albinus, 2020/12/18