71/dance

Pipes not working

Opened this issue · 2 comments

This might be related to #321 however, I'm not using dev containers.

I'm getting the following errors when trying to use pipes:

!#uname:

error executing command "dance.selections.pipe.append": Invalid host defined options

|#wc -l:

error executing command "dance.selections.pipe.replace": Invalid host defined options

All other extensions are disabled and I'm not using devcontainers. I am, however, using NixOS which is quite different from other distros.

I have no idea how to debug further, let me know if there is any more information I can provide.

I am using the latest pre-release version, v0.5.14002.

I've cloned the repo, opened it in VSCode, and used "Launch extension" to run the extension in a fresh editor, pipes work just fine in the "Extension Development Host".

@noonien
It is not a pretty solution, but it works. Something is wrong with dynamic imports - so by changing import("child_process") to Promise.resolve(require("child_process")) the issue is fixed on NixOS. I haven't yet properly packaged it, but it should be as simple as:

let
  dance = inputs.nix-vscode-extensions.extensions.x86_64-linux.vscode-marketplace.gregoire.dance;
in
(pkgs.runCommand
  "patched-dance"
  {
    vscodeExtUniqueId = dance.vscodeExtUniqueId;
    vscodeExtPublisher = dance.vscodeExtPublisher;
    version = dance.version;
  }
  ''
    input=${dance}/share/vscode/extensions/gregoire.dance
    output=$out/share/vscode/extensions/gregoire.dance
    mkdir -p $output
    cp -r $input/* $output
    chmod u+rwx -R $output
    mv $output/out/extension.js $output/out/extension_old.js
    cat $output/out/extension_old.js | ${pkgs.ripgrep}/bin/rg 'import\("child_process"\)' --passthru --replace 'Promise.resolve(require("child_process"))' > $output/out/extension.js
  '')