Can't debug Rust code inside vscode with WSL setup - visual-studio-code

I can't debug my rust code which is in WSL with VScode which is installed on my windows. I get these errors during debug.
Error: there is no registered task type 'codelldb.cargo'. Did you miss installing an extension that provides a corresponding task provider?
Error: there is no registered task type 'codelldb.cargo'. Did you miss installing an extension that provides a corresponding task provider?
Here is my launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug executable 'foo'",
"cargo": {
"args": [
"build",
"--bin=foo",
"--package=foo"
],
"filter": {
"name": "foo",
"kind": "bin"
}
},
"args": [],
"cwd": "${workspaceFolder}"
},
]
}
Strangely I can run my code using vscode & getting expected output.
I have installed below extension for WSL in vscode
codeLLDB
rust-analyzer
these are the versions of software
WSL: version 1
vscode: 1.72.2
windows : Windows 10
What I'm missing here

This issue is due to WSL version. Issue got fixed after upgrading WSL from v1 to v2

Related

Configured debug type 'hl' not supported

I have installed hash link on my linux machine (works on the terminal as expected) and upon pressing F5 from vscode for my heaps.io program, it says Configured debug type 'hl' not supported. So I tried searching for hashlink on the extensions market and found no results. I have copied my launch.json from the heaps.io tutorial website. What should I do?
Launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "HashLink",
"request": "launch",
"type": "hl",
"cwd": "${workspaceFolder}",
"preLaunchTask": {
"type": "haxe",
"args": "active configuration"
}
}
]
}
Where the launch.json file can be found
https://heaps.io/documentation/hello-hashlink.html
Ok I made it work! For some reason I had to copy all the required libraries from /usr/local/lib to /lib64 for vscode to launch my application through hashlink.
Also about the hashlink, I just installed the .vsix version of hashlink of version 1.1.12. The versions above that don't seem to work with the latest vscode version.

Problem debugging Deno using VSCode on Ubuntu 20.04 LTS running inside WSL-2: --inspect-brk being removed

I am trying to debug Deno using VSCode on Ubuntu 20.04 LTS running inside WSL-2. I setup my launch.json as described in the Deno manual:
{
"version": "0.2.0",
"configurations": [
{
"name": "Deno",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "deno",
"runtimeArgs": ["run", "--inspect-brk", "-A", "${fileBasename}"],
"outputCapture": "std",
"port": 9229
}
]
}
however when I launch Deno the "--inspect-brk" option is being stripped out from the command used to launch Deno. If I modify my launch.json to change the option to "inspect-brk" (removing the leading --) the option shows up on the command line and I get the error:
Cannot resolve module "file:///mnt/c/Users/mlwp/projects/deno/inspect-brk"
Similarly if I change the name of the option to be "--inspect-brk-fun" then I get the message:
Found argument '--inspect-brk-fun' which wasn't expected, or isn't valid in this context
Anyone know why VSCode would strip the option or how to debug this
The cause of your issue was an incompatibility with --inspect-brk in previous versions of the VSCode JavaScript debugger. It has been fixed some time ago and so have the Deno docs on this matter, where the value of type has changed and port has been replaced with attachSimplePort in launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Deno",
"type": "pwa-node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "deno",
"runtimeArgs": ["run", "--inspect-brk", "-A", "${file}"],
"attachSimplePort": 9229
}
]
}
However, I've found that using your current configuration should also work on newer releases (1.47+) of VSCode (running on Ubuntu 20.04 in WSL 2).

How to use a remote python interpreter in remote development - ssh in VSCode

Microsoft recently released remote development support for SSH.
https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh
However, in python, if you click "select python interpreter". The interpreter available to be chosen is only for a set of python interpreters in anaconda.
The interpreter available to be chosen are in:
~/anaconda3/*
/usr/bin/python
I have a custom python interpreter in a custom location. My interpreter is in ~/projects/myproject/bin/python
How do we configure a remote python interpreter by giving it a path?
Note: I have configured setting.json
"python.pythonPath": "${workspaceFolder}/bin/python",
But it does not seem to respect it
managed to make it work with
update vscode
my files:
# settings.json
{
"python.pythonPath": "/custom/bin/python"
}
# launch.json
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"pythonPath": "${config:python.pythonPath}"
},
...
restarted vscode
F1 -> select Interpreter

Use Visual Studio Code Tasks with Gulp 4.0

I am in the process of switching a project from Gulp 3.9.1 (npm install gulp) to Gulp 4.0 (npm install gulp-4.0.build), but when I do this, Visual Studio Code is no longer able to auto-detect the tasks in my gulpfile.js. In both cases, gulp is installed locally.
My .vscode/tasks.json looks like:
{
"version": "0.1.0",
"command": "gulp",
"isShellCommand": true,
"showOutput": "always"
}
Looking at the Tasks output, I see the following message:
Running gulp --tasks-simple didn't list any tasks. Did you run npm install?
Can you use Gulp 4.0 with VS Code and have it autodetect the tasks? If so, what steps do I need to follow to get it setup?
Yes, you can use vscode and gulp4.0. I would look at how to upgrade to gulp4.0.
Did you uninstall gulp3.9.1 first?
You should also install gulp4.0 both locally and globally!
Then run
gulp -v
to make sure it worked. vsCode should detect both tasks in your tasks.json file and from your gulpfile.js. You are using the older tasks.json version 0.1.0. Here is an example of a tasks.json file which allows me to type "gulp sync" in the command line from anywhere in the workspaceRoot and run that task:
{
"version": "2.0.0",
"tasks": [
{
"label": "Start server and process files",
"command": "gulp",
"args": [
"sync"
],
"type": "shell",
"options": {
"cwd": "${workspaceRoot}"
}
}
]
}
It runs the "sync" task I defined in my gulpfile.js. In fact you can assign a hotkey combo to that such as:
{ "key": "shift+escape",
"command": "workbench.action.tasks.runTask",
"args": "Start server and process files"
},
in your keybindings.json.

Debugging Node with Visual Studio Code (not powershell)

I'm trying to debug my node script that is running in Visual Studio Code. My first mistake (apparently) was I pressed the Debug menu choice. It launched the .net debugger (this is actually an asp.net core project) but I wanted to debug just the node server that I launched myself.
Now, when I bring up the terminal windows, the only choice seems to be type powershell (see red arrow).
What I want to do is debug my running node script that I started by typing "node start dev".
{
"version": "0.2.0",
"configurations":
[
{
"name": "node",
"type": "node",
"request": "launch",
"stopOnEntry": false,
"program": "${file}",
"cwd": "${workspaceFolder}",
"args": [
"start", "dev"
]
}
]}