F# with VS Code : Redirecting user input - visual-studio-code

I use Visual Studio Code 1.37.1, OS Windows 10. I have installed F# with Ionide.
How can I launch the code to redirect user input to a file as I would do with Visual Studio 2019 ("< in.txt" in CommandLineArgs Option of the debugger).
Thank you !

It is related to this and not F# specific.
In launch.json
{
"name": "someName",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/path/to/someName.dll",
"args": ["<", "${workspaceFolder}/path/to/file.txt"],
"console": "internalConsole",
}
works with internalConsole for me.

Related

VS Code Python debugging justMyCode=False does not allow to step into external code

By debugging a Python code in VS Code I want to step into routines of matplotlib package.
By right mouse click I can open the code definition in the package source code, but I cannot step into it during debugging.
I use the newest VS Code with Pylance and Python extensions from Microsoft:
Version: 1.74.2 (system setup)
Commit: e8a3071ea4344d9d48ef8a4df2c097372b0c5161
Date: 2022-12-20T10:29:14.590Z
Electron: 19.1.8
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Windows_NT x64 10.0.18363
Sandboxed: No
Python 3.10.5 64-bit
Following several hints on Stack overflow I created a launch.json file in the workspace.vscode program directory and added a new configuration:
{
"name": "Debug Unit Test",
"type": "python",
"request": "test",
"justMyCode": false
}
I expected that upon debugging using the new configuration "Debug Unit Test" I can then step into external code, but it was not the case.
Actually, the "test" value in "request" tag is marked as not accepted. I also tried "launch" there, but it also did not help.
Following another hint I also tried
{
"name": "Debug Unit Test",
"type": "python",
"request": "launch",
"debugOptions": ["DebugStdLib"],
"justMyCode": false
}
The "debugOptions" property is however, not allowed.
I also searched for justMyCode parameter in VS Code settings and found only for Jupyter extension, not for Python.
Is it possible that VS Code discontinued this option for Python debugging??
Looking at the documentation it appears you need to add the following configuration:
{
"name": "Python: Debug Tests",
"type": "python",
"request": "launch",
"program": "${file}",
"purpose": ["debug-test"],
"console": "integratedTerminal",
"justMyCode": false
}
I had the same issue but after adding the above to my launch.json I could step into code other than my own.
https://code.visualstudio.com/docs/python/testing#_debug-tests

Can't run debugging in Visual Studio Code on Chrome OS

How do I run a .html file in VS Code on Chrome OS? It sais I need to add the absolute path to browser in a Json file.
Trying to open a .html file in VS Code on Chrome OS
U need to install a separate version of Chrome on VS Code then it will work. I just had the same problem and found the solution somewhere hidden on Reddit, but it worked :-)
sudo apt install chromium
Then you can add this to your .vscode/launch.json
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"runtimeExecutable": "/usr/bin/chromium",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}",
"smartStep": true
}
]

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).

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"
]
}
]}

VS Code launch.json attach to iexplore

I would like to debug my office-js application (with angular2) within VS-Code.
My launch.json is:
"configurations": [
{
"sourceMaps": true,
"type": "node",
"request": "attach",
"port": 4200,
"name": "Launch Program",
"outFiles": [
"${workspaceRoot}/*.js"
]
}
Currently I'm using Atom Editor with angular cli and "ng serve" command and VS Community Edition 2017 as debugger. It works with "Attach to Process" (iexplore) and I'm able to debug my Word AddIn.
For simplification I tried to move to VS-Code which -for my understanding- supports inline debugging.
In launch.json, "type" could be "node", "chrome", "edge", "firefox" but I didn't found iexplore which I would need in my opinion.
Thank you in advance for sharing your expierences.
There are a number of debuggers in the extension marketplace but I'm not aware of one for Internet Explorer.