unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: APEL Martin <Martin.APEL@3ds.com>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: RE: Tramp and conversion of \r\n into \n
Date: Thu, 17 Dec 2020 11:35:51 +0000	[thread overview]
Message-ID: <7135a39a200c4f8397c8bddb9da8d3fc@3ds.com> (raw)
In-Reply-To: <87tuslzrw1.fsf@gmx.de>

Hi Michael,

I built an Emacs version from the current master branch and tried it out:
lsp-mode works well with a remote clangd now. Unfortunately there are some other problems, which do not occur with Emacs 27.1 and which might be related to TRAMP:
- my remote compile setup does not work anymore. It seems that the arguments to the invoked compile command are lost on the way to the remote machine
- rgrep on a remote machine also does not work. It produces a list of files it intends to search instead of the grep output
- I also encountered an error message from TRAMP once. Unfortunately I restarted Emacs afterwards, so I don't have the exact error message. It was something about a recursive call detected and a sentinel was mentioned.

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

  parent reply	other threads:[~2020-12-17 11:35 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-11  7:46 Tramp and conversion of \r\n into \n APEL Martin
2020-12-11  9:15 ` Michael Albinus
2020-12-11  9:59   ` APEL Martin
2020-12-11 10:26     ` Michael Albinus
2020-12-11 11:29       ` APEL Martin
2020-12-11 11:52         ` Michael Albinus
2020-12-13 16:04           ` Michael Albinus
2020-12-15 11:37         ` Michael Albinus
2020-12-15 12:45           ` APEL Martin
2020-12-15 14:37             ` Michael Albinus
2020-12-15 18:45               ` Michael Albinus
2020-12-16  6:44                 ` APEL Martin
2020-12-16 15:34         ` Michael Albinus
2020-12-16 15:55           ` APEL Martin
2020-12-17 11:35           ` APEL Martin [this message]
2020-12-17 12:50             ` Michael Albinus
2020-12-18  7:48               ` APEL Martin
2020-12-18 12:35                 ` Michael Albinus
2020-12-18 12:56                   ` APEL Martin
2020-12-18 13:04                     ` Michael Albinus
2020-12-18 14:54                       ` APEL Martin
2020-12-18 15:00                         ` Michael Albinus
2020-12-18 15:10                           ` APEL Martin
2020-12-18 15:18                             ` Michael Albinus
2020-12-22 14:57                             ` Michael Albinus
2021-01-07 11:13                               ` APEL Martin
2020-12-19  9:18             ` yyoncho
2020-12-19 16:48               ` Michael Albinus
2020-12-20 14:03                 ` Michael Albinus
2021-08-05  1:46                 ` Thomas Ross
2021-08-05  6:16                   ` Eli Zaretskii
2021-08-07  2:08                     ` Thomas Ross
2021-08-05 14:10                   ` Stefan Monnier
2021-08-05 15:40                     ` Michael Albinus
2021-08-05 16:25                       ` Stefan Monnier
2021-08-06  7:13                         ` Michael Albinus
2021-08-06 14:46                           ` Stefan Monnier
2021-08-07 13:51                             ` Michael Albinus
2021-08-07 22:04                               ` Stefan Monnier
2021-08-08  6:13                                 ` PTYs vs. pipes for subprocesses [was: Tramp and conversion of \r\n into \n] tomas
2021-08-08 14:25                                 ` Tramp and conversion of \r\n into \n Michael Albinus
2021-08-12 18:47                                   ` Michael Albinus
2021-08-13 12:16                                     ` Michael Albinus
2021-08-07  2:07                     ` Thomas Ross
2021-08-07 13:54                       ` Michael Albinus
2021-08-08 14:29                         ` Michael Albinus
  -- strict thread matches above, loose matches on Subject: below --
2020-12-09  7:34 yyoncho
2020-12-10 13:44 ` Michael Albinus
2020-12-11 14:11   ` yyoncho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7135a39a200c4f8397c8bddb9da8d3fc@3ds.com \
    --to=martin.apel@3ds.com \
    --cc=emacs-devel@gnu.org \
    --cc=michael.albinus@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).