Couldn't start client ESLint message in VS Code - visual-studio-code

Recently I run into problem with ESlint extension in VS code. When I launch VS code and open up a js file, it popup message "Couldn't start client ESlint". It used to work fine. I tried to re-install eslint, VS code but it didn't help. Here are the versions I used.
VS code: 1.44.0 (user setup)
eslint: v6.8.0
ESLint Extension for VS code: 2.1.2

You need to dig a little bit more to get more details.
A good place to start would be to run the eslint show output command in VSCode. That should be a good starting point.
screenshot of ESLint: Show Output Command
The bottom line is that you need to follow the conventional installation path:
add eslint extension in vscode.
install eslint locally or globally via npm,
run eslint init in your project path and select proper configurations.
restart vscode just to make sure the settings are active.
again, the eslint output console should be a good starting point.

For me, it turns out I had the eslint.runtime and eslint.nodePath settings set to the specified node path on my system, but they were prefixed like this:
~/.nvm/versions/node/v14.17.0/bin/node
Using $HOME instead of ~ didn't solve it either.
I ended up having to specify an absolute path:
/home/<myusername>/.nvm/versions/node/v14.17.0/bin/node

Related

Stop automatic `conda activate` when opening a terminal in VS Code

VS Code has started running conda activate every time I open a terminal in VSCode, be it PowerShell, WSL, or CMD.
I never set this up intentionally so have no idea why it does this or how to disable it. I've looked at all my settings in VS Code and cannot find anything.
How do I stop VS Code from running conda activate when a new terminal is opened?
Try putting the following in your settings.json file:
"python.terminal.activateEnvironment": false
You're getting this behaviour because the default value of that setting is true if not specified.
For more info, see VS Code's docs on Using Python environments in VS Code- in particular, the Working with Python interpreters
section, and the Environments and Terminal windows
section.
Quoting from that page:
Tip: To prevent automatic activation of a selected environment, add "python.terminal.activateEnvironment": false to your settings.json file (it can be placed anywhere as a sibling to the existing settings).
Reading the changelog, this setting was added in version 2018.9.0 of the Python extension for VS Code. The PR that added it was #1387.

VS Code - Prettier is formatting differently for me than others

Prettier is behaving differently for me compared to my team mates.
We all have same version 9.5.0 of prettier installed on our VS Code.
We all have same configuration of prettier.
Still it is formatting my typescript file differently for one particular line than others and because of this the deployment is failing when I push anything from my machine and works for everybody else.
Does anybody face this?
Which part should I check to see the difference?
Update 1
One thing we found that is different is the VS Code version.
I have version 1.67.2 installed my colleague has 1.63.2 installed.
Could this be the reason?
Update 2
This is the exact line where I am getting prettier error on my machine for wrong formatting while this same formatting is considered correct by prettier for other machines
And this is how prettier formats the line on my machine (then devops complaint that it is a wrong formatting)
I think there is a bug with the prettier extension. Although I had my default formatter set to the prettier extension in the settings UI, I had to re do it manually.
Open any file, right click in the editor screen, click Format document with and choose Prettier - Code formatter.
The local prettier config and the one vscode uses should work now
I faced the same isssue.
in my case I run
npx prettier --version
on both computer and each one return different prettier version.
so although the prettier extension in vscode was 9.5.0 for both pcs. the npm module installed for the project in node_modules was different.
I installed the same prettier module for both computer and the restart vscode and problem solved
You might have installed multiple formatters and you aren't using the correct one. Try to specify it manually in command palette. Check out this answer (Solution A)

VS Code - pylint is not running

I have a workspace setup in VS Code where I do python development. I have linting enabled, pylint enabled as the provider, and lint on save enabled, but I continue to see no errors in the Problems panel. When I run pylint via the command line in the virtual environment i see a bunch of issues - so I know pylint works. I am also using black formatting(on save) which works without issue. I have tried using both the default pylint path as well as updating it manually to the exact location and still no results. When I look at the Output panel for python it looks like pylint is never even running (i.e. I see the commands for black running there but nothing for pylint).
My pylint version is 2.4.4 and VS Code version 1.46
Any idea how to get this working?
This is due to a bug in the newer version of python extension see here.
For now you can either wait for the fix to arrive, use jedi language server or install previous version of the extension
Add
"python.linting.enabled" : true
"python.linting.lintOnSave" : true
to your settings.json
Uninstall Python Extension
Reinstall Python Extension
And with that there will will be one more extension of "Python Extension" named - "PYLANCE" don't forget to install that too.
Reload VS Code
DONE !!

Couldn't start client Rust Language Server

I'm trying to figure out how to use rustc & cargo from my WSL. I use VS Code and Rust (rls) plugin and can compile my code but there is a problem with RLS:
Couldn't start client Rust Language Server
Rustup not available. Install from https://www.rustup.rs/
How i can solve this problem?
Set rust-client.rustupPath in VSCode settings:
{
"rust-client.rustupPath": "~/.cargo/bin/rustup"
}
If you're using WSL on Windows then make sure you edit Rust extension WSL settings, not user/local settings.
Tutorial:
I had this problem as well with WSL and Visual Studio Code. The problem seems to stem from the fact that the Rust Language Server needs to find rustup in your path. We both probably followed the same path of using a package manager to install cargo, and therefore, the rust compiler tools. This does not include rustup which you can actually use to keep the rust toolchain up-to-date. rustup also appears to be the preferred method of installing the rust toolchain on your system.
After installing rustup with the default setup, you should see a .rustup directory in your home directory. This is where the toolchain lives. The install text all stated that it would add the toolchain to your environment path after logging out and back in, but I didn't have luck with this. I'm currently using fish instead of bash and had to update the configuration to include the toolchain at startup. Once I did that, I was able to have VSCode properly install and run the RLS.
This worked for me for in a remote SSH environment with Ubuntu 20.04
Edit .profile and .bashrc files in the user home directory
In .profile, comment the following line:
export PATH="$HOME/.cargo/bin:$PATH"
In both, add the following line:
[[ ":$PATH:" != *":$HOME/.cargo/bin:"* ]] && PATH="$HOME/.cargo/bin:${PATH}"
Reboot.
Even though if I run:
which rustup
/Users/justincalleja/.cargo/bin/rustup
A simple entry of rustup in the VSCode settings for:
"Rust-client: Rustup Path Path to rustup executable. Ignored if rustup
is disabled."
wasn't enough and I had to put the absolute path to the rustup binary as shown above. After doing so, I reloaded the window and was then asked to download missing components (or dependencies - the prompt is gone now I forgot). After doing this, the VSCode plugin seems to be working fine. I can format the code at least.
So it looks like it's some mismatch with VSCode's PATH and the PATH on my system. I'm not sure what it is but if you just want to get the extension to work, try using the absolute path to rustup in your Settings.
(Note: source "$HOME/.cargo/env" is added automatically to your startup files like .bashrc. First thing I tried was adding it to the startup file of zsh; the shell I'm using and to which it wasn't added. But that doesn't work either. I'm using rustc 1.49.0 (e1884a8e3 2020-12-29) ).
So... I'm running Rust on Windows 10 and I experienced this same issue. My Rust version is 1.24.3, my VSCode version is 1.63.2.
The first thing you need to do is add "%USERPROFILE%.cargo\bin" to your environment variables
The next solution that worked for me can be found in this tutorial: Rust on Windows and Visual Studio Code
i am running VSCode on mac, and using remote development.the remote server is
ubuntu 20. i had this problem, added rust-client.rustupPath to vscode settings and killed the vscode-server on remote server to fix this problem. now it work.

How to open Visual Studio Code from the command line on linux?

I know I can use command "code" to open VS code or file, but I don't know what should I do to make it possible after I install VS code in Ubuntu.Thanks.
Launching from the Command Line
You can launch VS Code from the command line to quickly open a file, folder, or project. Typically, you open VS Code within the context of a folder. We find the best way to do this is to simply type:
code .
Tip: We have instructions for Mac users in our Setup topic that enable you to start VS Code from within a terminal. We add the VS Code executable to the PATH environment variable on Windows and Linux automatically during installation.
Sometimes you will want to open or create a file. If the specified files does not exist, VS Code will create them for you:
code index.html style.css readme.md
Tip: You can have as many file names as you want separated by spaces.
Source: https://code.visualstudio.com/Docs/editor/codebasics
So, there are a couple of solutions for this.
I've linked a video that shows you how to add vscode to $PATH
(which didn't work for me because I couldn't find the "shell:install path" command)
I uninstalled the vscode from my ubuntu and re-installed using sudo snap install --classic code
(This method worked for me)
Tell me which one works for you... and if you have extensions installed to your vscode then i guess you ought to make a backup or something.
Link to the video: https://youtu.be/iP5FKZXtDBs