vs-shell-format icon indicating copy to clipboard operation
vs-shell-format copied to clipboard

Shell Script Formatting Not Working in Remote SSH + Dev Container Environment

Open unSerori opened this issue 9 months ago • 3 comments

Description

When attempting to format a shell script (.sh file) using the Format Document command in Visual Studio Code, I receive the following error:

There is no formatter for 'shellscript' files installed.

Environment

Local Machine: macOS (MacBook)

Remote Environment: Debian server

Development Setup: Utilizing Dev Containers for remote development

Extensions Installed: foxundermoon.shell-format

shfmt Installation:

Local (macOS): Installed via Homebrew

Remote (Linux): Installed using Go, located at $HOME/go/bin/shfmt

Configuration

In my settings.json, I have specified the path to shfmt as follows: "shellformat.path": "$HOME/go/bin/shfmt".
Despite this configuration, the formatter does not function as expected, and the aforementioned error persists.

Questions

  1. In a Remote - SSH + Dev Container setup, should the foxundermoon.shell-format extension be installed on the local machine, the remote machine, or both?

  2. Where should shfmt be installed in this context? On the local machine, the remote machine, or inside the Dev Container?

  3. Should the shellformat.path setting be defined in the local settings.json, the remote settings, or within the Dev Container's configuration?

Additional Information

Verified that shfmt is executable at $HOME/go/bin/shfmt on the remote machine. The foxundermoon.shell-format extension is currently installed on the local machine.

unSerori avatar May 06 '25 02:05 unSerori

I also encountered the same problem.

lwmacct avatar Jul 16 '25 17:07 lwmacct

In the remote extension host I see the following error:

2025-07-18 20:52:18.706 [error] Activating extension foxundermoon.shell-format failed due to an error:
2025-07-18 20:52:18.706 [error] Error: ENOENT: no such file or directory, open '/homedir/.vscode-server/extensions/foxundermoon.shell-format-7.2.8/dist/one_ini_bg.wasm'
	at Object.openSync (node:fs:562:18)
	at Object.readFileSync (node:fs:446:35)
	at 7959 (/homedir/.vscode-server/extensions/foxundermoon.shell-format-7.2.8/dist/extension.js:1:3878)
	at n (/homedir/.vscode-server/extensions/foxundermoon.shell-format-7.2.8/dist/extension.js:1:99225)
	at 7753 (/homedir/.vscode-server/extensions/foxundermoon.shell-format-7.2.8/dist/extension.js:1:26623)
	at n (/homedir/.vscode-server/extensions/foxundermoon.shell-format-7.2.8/dist/extension.js:1:99225)
	at 6549 (/homedir/.vscode-server/extensions/foxundermoon.shell-format-7.2.8/dist/extension.js:1:68340)
	at n (/homedir/.vscode-server/extensions/foxundermoon.shell-format-7.2.8/dist/extension.js:1:99225)
	at 112 (/homedir/.vscode-server/extensions/foxundermoon.shell-format-7.2.8/dist/extension.js:1:66299)
	at n (/homedir/.vscode-server/extensions/foxundermoon.shell-format-7.2.8/dist/extension.js:1:99225)
	at /homedir/.vscode-server/extensions/foxundermoon.shell-format-7.2.8/dist/extension.js:1:99265
	at Object.<anonymous> (/homedir/.vscode-server/extensions/foxundermoon.shell-format-7.2.8/dist/extension.js:1:99289)
	at Module._compile (node:internal/modules/cjs/loader:1730:14)
	at Object..js (node:internal/modules/cjs/loader:1895:10)
	at Module.load (node:internal/modules/cjs/loader:1465:32)
	at Function.<anonymous> (node:internal/modules/cjs/loader:1282:12)
	at e._load (file:///homedir/.vscode-server/cli/servers/Stable-7adae6a56e34cb64d08899664b814cf620465925/server/out/vs/workbench/api/node/extensionHostProcess.js:356:5519)
	at t._load (file:///homedir/.vscode-server/cli/servers/Stable-7adae6a56e34cb64d08899664b814cf620465925/server/out/vs/workbench/api/node/extensionHostProcess.js:174:22697)
	at r._load (file:///homedir/.vscode-server/cli/servers/Stable-7adae6a56e34cb64d08899664b814cf620465925/server/out/vs/workbench/api/node/extensionHostProcess.js:166:25633)
	at TracingChannel.traceSync (node:diagnostics_channel:322:14)
	at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
	at Module.<anonymous> (node:internal/modules/cjs/loader:1487:12)
	at Module.require (/homedir/.vscode-server/extensions/github.copilot-chat-0.29.1/dist/extension.js:324:9438)
	at require (node:internal/modules/helpers:135:16)
	at QG.Cb (file:///homedir/.vscode-server/cli/servers/Stable-7adae6a56e34cb64d08899664b814cf620465925/server/out/vs/workbench/api/node/extensionHostProcess.js:205:1253)
	at process.processTicksAndRejections (node:internal/process/task_queues:105:5)

So it looks like it's trying to load this one_ini_bg.wasm file but it wasn't packaged with the extension.

ehoogeveen-medweb avatar Jul 18 '25 19:07 ehoogeveen-medweb

Ah, also seen in https://github.com/foxundermoon/vs-shell-format/issues/396 and should be fixed by https://github.com/foxundermoon/vs-shell-format/pull/397 if accepted.

ehoogeveen-medweb avatar Jul 18 '25 19:07 ehoogeveen-medweb