Skip to content

Conversation

@jkxyz
Copy link
Contributor

@jkxyz jkxyz commented Mar 30, 2025

Various fixes to ensure that the default formatters work over Tramp
and on Windows:

  1. Replace the apheleia-npx command with npx when the buffer is remote
    or running on Windows. This uses the built-in npx handling to lookup
    the binary, so npx never gets called. Since the apheleia-npx script
    isn't available on remote hosts, it makes sense to remove this. The
    same is done for Windows to capture the case of using WSL, in which
    case calling bash will enter WSL and so the script cannot be accessed
    using the Windows path.

  2. Use local file name when returning binary path.

  3. Don't use executable-find if the binary is already an absolute path.

  4. Pass the -l option to sh to ensure that it loads the user's profile.

Various fixes to ensure that the default formatters work over Tramp
and on Windows:

1. Replace the apheleia-npx command with npx when the buffer is remote
or running on Windows. This uses the built-in npx handling to lookup
the binary, so npx never gets called. Since the apheleia-npx script
isn't available on remote hosts, it makes sense to remove this. The
same is done for Windows to capture the case of using WSL, in which
case calling bash will enter WSL and so the script cannot be accessed
using the Windows path.

2. Use local file name when returning binary path.

3. Don't use executable-find if the binary is already an absolute path.

4. Pass the -l option to sh to ensure that it loads the user's profile.
Comment on lines +975 to +979
;; Just use npx when buffer is remote or we're running on Windows,
;; since in these cases bash won't be able to find the script
(when (and (member "apheleia-npx" command)
(or run-on-remote (eq system-type 'windows-nt)))
(setq command (cons 'npx (remove "apheleia-npx" command))))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be an issue for any of the scripts in the Apheleia scripts directory, just just the npx one. What would you think of having Apheleia copy the script to the remote host before first execution, if anything apheleia-prefixed is used in the command?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants