nix-env-selector
nix-env-selector copied to clipboard
Add logging to VS Code output channel
- Create a VS Code output channel during init
- Log basic operations and error messages
Status | Type | Config Change |
---|---|---|
Ready | Feature | No |
Problem
As mentioned in #59 , it would be useful to have the extension log to the Output window, for example to help troubleshoot Nix errors.
Solution
This creates a VS Code Output Channel during init, to which log messages can be appended.
I add logs for these operations:
- Load config
- Select/hit env
- Run a sync/async command
Example output in the Nix Env Selector
channel, including the error referenced in #59:
Initializing config...
Loaded config: {:workspace-root "/home/dan/test_nix_env", :nix-file "/home/dan/test_nix_env/env.nix", :suggest-nix? false, :nix-packages #js [], :nix-args nil, :nix-shell-path "/nix/store/hapw7q1fkjxvprnkcgw9ppczavg4daj2-nix-2.4/bin/nix-shell"}
Running command synchronously: /nix/store/hapw7q1fkjxvprnkcgw9ppczavg4daj2-nix-2.4/bin/nix-shell "/home/dan/test_nix_env/env.nix" --run export
Error applying environment: Error: Command failed: /nix/store/hapw7q1fkjxvprnkcgw9ppczavg4daj2-nix-2.4/bin/nix-shell "/home/dan/test_nix_env/env.nix" --run export
error: attribute 'npm' missing
at /home/dan/test_nix_env/env.nix:5:9:
4| buildInputs = [
5| pkgs.npm
| ^
6| ];
(use '--show-trace' to show detailed location information)
Running action: Select environment
Running action: Hit environment
Selected to disable Nix environment
Selected Nix file: /home/dan/test_nix_env/env.nix
Loading env in path: /home/dan/test_nix_env/env.nix
Running command asynchronously: /nix/store/hapw7q1fkjxvprnkcgw9ppczavg4daj2-nix-2.4/bin/nix-shell "/home/dan/test_nix_env/env.nix" --run export
Error applying environment: error: attribute 'npm' missing
at /home/dan/test_nix_env/env.nix:5:9:
4| buildInputs = [
5| pkgs.npm
| ^
6| ];
(use '--show-trace' to show detailed location information)
Other changes (e.g. bug fixes, UI tweaks, small refactors)
Deploy Notes
No new dependencies or scripts.
@daneads Thank you for your contribution a lot. I leave a comment about your changes.
Was this abandoned? This was my immediate thought for an issue to open once I started using this extension and it appears to be stalled
would be good to have this merged
Is there another way to debug a spinning "Applying environment..."?
hello! still wainting for this The extension es awesome, but when there are errors, is very hard to debug