unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Simon Tournier <zimon.toutoune@gmail.com>
To: Leo Prikler <leo.prikler@student.tugraz.at>
Cc: ncdehnel@gmail.com, 44272@debbugs.gnu.org
Subject: bug#44272: guix edit doesn't work when $EDITOR is set to VSCode
Date: Mon, 06 Nov 2023 18:41:20 +0100	[thread overview]
Message-ID: <87a5rqg4ov.fsf@gmail.com> (raw)
In-Reply-To: <865y2kpkk4.fsf_-_@gmail.com>

Hi,

On Thu, 02 Nov 2023 at 10:32, Simon Tournier <zimon.toutoune@gmail.com> wrote:

> (define %vscode--goto "code --goto ")

In case, here an improvement when using Remote-SSH.

--8<---------------cut here---------------start------------->8---
(define %vscode--goto
  (let* ((vscode-server (string-append (getenv "HOME") "/.vscode-server"))
         (code (if (file-exists? vscode-server)
                   ;; Maybe Remote-SSH
                   (let* ((vscode-server/bin (string-append vscode-server "/bin"))
                          (hash         ;Guess the correct identifier
                           (car
                            (scandir vscode-server/bin
                                     (lambda (file)
                                       (not (member file (list "." ".."))))
                                     (lambda (x y)
                                       (> (stat:mtime
                                           (lstat (string-append vscode-server/bin "/" x)))
                                          (stat:mtime
                                           (lstat (string-append vscode-server/bin "/" y))))))))
                          (vscode (string-append
                                   vscode-server/bin "/" hash "/bin/remote-cli/code"))
                          (run/user/uid (string-append "/run/user/"
                                                       (number->string (getuid))))
                          (socket       ;Guess the correct socket
                           (car
                            (scandir run/user/uid
                                     (lambda (file)
                                       (string-prefix? "vscode-ipc" file))
                                     (lambda (x y)
                                       (> (stat:mtime
                                           (lstat (string-append run/user/uid "/" x)))
                                          (stat:mtime
                                           (lstat (string-append run/user/uid "/" y)))))))))
                     (string-append
                      "VSCODE_IPC_HOOK_CLI=" socket " " vscode))
                   ;; No Remote-SSH, try to find the local one in PATH
                   (search-path (string-split (getenv "PATH") #\:)
                                "code"))))
    (string-append code " --goto ")))
--8<---------------cut here---------------end--------------->8---


Cheers,
simon




      reply	other threads:[~2023-11-06 17:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-28  6:13 bug#44272: guix edit doesn't work when $EDITOR is set to "kate" Nathan Dehnel
2020-10-28 13:05 ` Leo Prikler
2020-10-28 14:52   ` zimoun
2020-10-28 22:28     ` Nathan Dehnel
2020-10-28 22:55       ` zimoun
2023-11-02  9:32     ` bug#44272: guix edit doesn't work when $EDITOR is set to VSCode Simon Tournier
2023-11-06 17:41       ` Simon Tournier [this message]

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://guix.gnu.org/

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

  git send-email \
    --in-reply-to=87a5rqg4ov.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=44272@debbugs.gnu.org \
    --cc=leo.prikler@student.tugraz.at \
    --cc=ncdehnel@gmail.com \
    /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/guix.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).