How to open Visual Studio Code from the command line on RHEL? - visual-studio-code

I would like to open VSCode from my RHEL terminal using the code command but when I try to type Shell Command: Install 'code' command in PATH directly in VSCode Command Palette, it indicates that No matching command is found. Is there a way to configure $PATH directly via the command line to make code work?

Finally what worked for me was to run the following commands :
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
dnf check-update
sudo dnf install code

Related

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>

How do I start a browser in Ubuntu on a PC?

Can anyone help me figure out why I cannot start my browser through the Ubuntu command line prompt. My instructor plainly says to use the command "start example.html" (I'm on PC), but when I attempt it I keep getting "Command 'start' not found, did you mean":
command 'smart' from deb smartpm-core
command 'stat' from deb coreutils
command 'startx' from deb xinit
command 'tart' from deb tart
command 'rstart' from deb x11-session-utils
command 'kstart' from deb kde-runtime
Try: sudo apt install
Just type:
firefox
In the terminal
Entering explorer.exe . into the command line allowed me to then set Chrome as the default browser for my work

bash: /usr/bin/apt-get: cannot execute binary file: Exec format error

I'm having a few issues. I'm using Kali Linux. In the terminal, I attempted to do
apt-get update but I'm getting this message back,
'bash: /usr/bin/apt-get: cannot execute binary file: Exec format
error'
It started having this issue when I attempted to install Visual Studio Code via terminal command dpkg -i code_1.41.1-1576681836_amd64.deb. Although the vscode icon shows up in 'Accessories', once I try to open the program, it doesn't open. So I attempted to do the apt-get update just in case something was being missed. Any help would be greatly appreciated.

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.

How can I run madge on Windows

The instructions for madge are only good for a linux system (it requires sudo to get the command line part set up). Is there a way to run it on windows?
It turns out to be very simple. To install madge:
npm install madge
Then to set it up for the command line:
npm -g install madge
You can then run it with a command of:
madge
For typescript generate .js files do:
madge -f amd -c .
and you'll get the circular report. You need the "-f amd".