VSCode asdf-vm command no such file or directory - visual-studio-code

Specs
VSCode 1.63.2
Homebrew 3.3.10
asdf 0.9.0
MacOS Monterey
Problem
I installed asdf via Homebrew as per doc http://asdf-vm.com/guide/getting-started.html#_3-install-asdf
The asdf command works well in my iTerm. However, it didn't work when committing or pushing via VScode terminal and VSCode source control.
The error from VSCode terminal
Unknown command: `asdf exec npm run pre-commit`
/usr/local/Cellar/asdf/0.9.0/libexec/bin/asdf: line 82: /usr/local/opt/asdf/lib/commands/command-help.bash: No such file or directory
And this below from VSCode source control
The error I got in output.
> git push origin feature/my-branch
Unknown command: `asdf exec npm run pre-commit`
/usr/local/Cellar/asdf/0.9.0/libexec/bin/asdf: line 82: /usr/local/opt/asdf/lib/commands/command-help.bash: No such file or directory
Running asdf exec npm run pre-commit in my iTerm works well. There must be different configuration between zsh in iTerm vs in VSCode. 🤔
My attempt so far is to add this configuration in VSCode settings.json
"terminal.external.osxExec": "iTerm.app",
"terminal.integrated.defaultProfile.osx": "zsh"
but still not working
My ~/.zshrc setup for asdf
. /usr/local/opt/asdf/libexec/asdf.sh
What is the possible cause here?

Found dubious decision
I also dont have commands folder in asdf/lib
So I copied the same from asdf/libexec/lib
And it worked

Related

I cant Install NvChad ( linux ). init.lua is not detected by neovim

I'm trying to install NcChad on neovim with the following command:
git clone https://github.com/NvChad/NvChad ~/.config/nvim --depth 1 && nvim
It doesn't work. I think it's because neovim can't find the init.lua file. When I rename this file to init.vim and enter neovim, it finds the file and gives an error.
Why can't neovim find init.lua?

Completely uninstall VS Code extensions in WSL

I cannot uninstall a certain VS Code extension (CodeLLDB) that is installed in my WSL. If I try with the VS Code GUI after reopening the program the extension is still there. If I try with the console the same thing happens.
I tried the following, as some answers here recommended:
$ code --list-extensions
vadimcn.vscode-lldb
That is the extension I want to uninstall, so I run:
$ code --uninstall-extension vadimcn.vscode-lldb --force
Uninstalling vadimcn.vscode-lldb...
Extension 'vadimcn.vscode-lldb' was successfully uninstalled!
But if I list them again it is still there:
$ code --list-extensions
vadimcn.vscode-lldb
Some extra details:
I use WSL 2 with Ubuntu 20.04.
Finally I found that the extensions where installed in my WSL2 in the directory ~/.vscode-server/extensions/ as this answer says, so the way to uninstall it is:
$ cd ~/.vscode-server/extensions/
$ rm -rf <extension-name>

correct PATH for zshrc in windows 10

I'm on Windows 10, installed WSL2 with Ubuntu v20 and then I installed Oh My Zsh. I thought I had everything working but when I went to type code ., in my Ubuntu terminal I got the error zsh: command not found: code.
When I do echo $PATH I get:
/home/robbie/.nvm/versions/node/v18.1.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/robbie/.yarn/bin
My .zshrc file looks like (I removed a bunch of the comments for this snippet):
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="agnoster"
plugins=(git node npm nvm z yarn)
source $ZSH/oh-my-zsh.sh
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
source /home/robbie/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
On VSCode I have the Remote WSL extension installed and set default/enabled on Ubuntu under Remote Explore.
In Windows 10 under Environment Variables, under Path I have a variable C:\Users\RobbieC\AppData\Local\Programs\Microsoft VS Code\bin
I have tried uncommenting export PATH=$HOME/bin:/usr/local/bin:$PATH - shutting down WSL, rebooting, no luck. I tried uninstalling/reinstalling the Remote WSL extension, rebooting computer, etc. No luck.
Open your regular Debian terminal App(Ensure you are in the debian home directory). Type ls -la there you will find the .zshrc file. Then remove the VScode Path you added.

Visual Studio Code, autopep8 doesn't run

On Windows 10.
I did this:
pip install autopep8
and in vscode user settings I have
"python.linting.pep8Enabled": true,
"python.formatting.provider": "autopep8",
When I run format document, or explicitly invoke autopep8 from the command pallette, the error is:
Error: Command failed: autopep8 c:\tca-backend\lambdas\utilities\NetMenuAPIUtil.py
'autopep8' is not recognized as an internal or external command,
operable program or batch file.
Clearly, vsc wants to invoke autopep8.exe but there is no exe. Just py. So I created a autopep8.bat which works when I test from the command line, but when run from vsc, it inserts the content of the batch file into the top of the document. (Yes, that's as strange as it sounds.)
All other Python-related operations work ok, including the ESLint extension.
VS code Python extension supports source code formatting using either autopep8 (the default), black, or yapf so you don't need to install python formatting tools by yourself.
The way I use formatting is to set a shortcut in vs code.
Go to File -> Preferences -> Keyboard Shortcuts, then search format. Set the shortcut as ctrl + shift + p which is the same as the shortcut of autopep8 or you can set any combination you prefer.
Click the shortcuts in your .py files then you will get the formatted code.
Ref: https://code.visualstudio.com/docs/python/editing
Since you are using VSCode on Windows, please click on the Terminal Section and type
pip install pep8
This will start installing pep8.
for me, the autopep8 doc installation isn't enough, still seeing this error, I had to follow this https://pip.pypa.io/en/latest/user_guide/#user-installs. it works like a charm.
I'm on windows so I used this:
py -m pip install –-user autopep8
You need to add this as a PATH under System Environment Variables:
c:\users\<username>\appdata\roaming\python\python39\site-packages
Then close and restart VS Code. Type autopep8 at a terminal prompt and you should see this:
C:\Foobar>autopep8
usage: autopep8 [-h] [--version] [-v] [-d] [-i] [--global-config filename] [--ignore-local-config] [-r] [-j n] [-p n] [-a] [--experimental] [--exclude globs] [--list-fixes] [--ignore errors] [--select errors]
[--max-line-length n] [--line-range line line] [--hang-closing] [--exit-code]
[files ...]
autopep8: error: incorrect number of arguments
I encountered an error message while trying to do same and below was what I did (in my terminal):
Install or upgrade pep8:
pip install --upgrade autopep8
Navigate to the folder/directory where the file you need formatted is, then use the following command:
autopep8 --in-place file_name
There you have it!
I encountered this same error running WSL: Ubuntu-20.04, well this was my solution:
$ pip --version
This will make you verify that you have python3 pip installed correctly in your distribution, if that's not the case, it will pop up an error:
Command 'pip' not found, but can be installed with:
apt install python3-pip
Just run the indicated command to installed it and then after that, run:
$ python3 -m pip install autopep8
Now everything should be working as it should, including the formatting autpep8.

Error when trying to execute Sass script via Zsh terminal on Mac OS X

I've recently switched over from using the Bash command prompt to Zsh on Mac OSX.
Problem I have using Zsh is that the command I would use to watch Sass files no longer works.
The script file I have is sass.sh and the content is...
#!/bin/sh
sass --style expanded --watch Assets/Styles/Sass:Assets/Styles --debug-info
exit 0
...but every time I run sh sass.sh I get the error...
/Users/<home-directory>/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find sass (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
from /Users/<home-directory>/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /Users/<home-directory>/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems.rb:1230:in `gem'
from /Users/<home-directory>/.rvm/gems/ruby-1.9.3-p125/bin/sass:18:in `<main>'
from /Users/<home-directory>/.rvm/gems/ruby-1.9.3-p125/bin/ruby_noexec_wrapper:14:in `eval'
from /Users/<home-directory>/.rvm/gems/ruby-1.9.3-p125/bin/ruby_noexec_wrapper:14:in `<main>'
...and I don't know how to resolve this problem.
It looks like it just can't locate the Sass gem, but if I run gem list --local I can see sass (3.2.3, 3.2.1, 3.1.20, 3.1.17, 3.1.15) in the list of gems. BUT I do also get an error again displayed first...
Error loading RubyGems plugin "/Users/<home-directory>/.rvm/gems/ruby-1.9.3-p125/gems/rubygems-bundler-0.2.8/lib/rubygems_plugin.rb": cannot load such file -- rubygems_bundler/rubygems_bundler_installer (LoadError)
I've looked around on Google and SO and found miscellaneous references to similar issues but none that helped me and my specific issue.
Can any one tell me what I need to do to resolve this issue so I can continue to use Zsh and run my Sass script.
Well, seems the answer is very simple. When using Zsh you no longer use the sh command but the zsh command.
So instead of sh sass.sh I just needed to do zsh sass.sh