[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#44272: guix edit doesn't work when $EDITOR is set to VSCode
From: |
Simon Tournier |
Subject: |
bug#44272: guix edit doesn't work when $EDITOR is set to VSCode |
Date: |
Mon, 06 Nov 2023 18:41:20 +0100 |
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