Sorry I NUB in VS code. I want to start my edited gnuplot file using VS Code. I have a launch.json
{
"workbench.colorTheme": "Default Dark+",
"workbench.editor.enablePreviewFromCodeNavigation": true,
"workbench.editor.enablePreviewFromQuickOpen": true,
"workbench.experimental.settingsProfiles.enabled": true,
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"files.associations": {
"*.plt": "gnuplot"
},
"launch": {
"configurations": [
{
"name": "Run Project",
"request": "launch",
"args" : [
"${file}"
],
"program": "gnuplot",
"console": "internalConsole"
}
]
},
}
But I get an error "You dont have an extension for gnuplot".
I do not need any exteension, I just want to start edited file in console by pressing F5. I.e. I want VSC run commnad like gnuplot.exe {currently edited file}.
Related
I have an app that is written in NestJS that I have inherited. When I try to debug the app using nest start --debug I am having trouble hitting breakpoints.
The odd thing is, if I put a breakpoint in my main.ts file, it hits it just fine. It's once the project has loaded up all the controllers, modules and the like that I cannot hit the breakpoints in the various .ts files. If I load up one of the .js files from my dist folder, I can breakpoint them, but everytime I stop and restart, I have to delete the contents of my dist folder. If i don't I get a TS5055 error about not being able to overwrite files.
Here's the tsconfig.json I have:
{
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"watch": true,
"allowJs": true,
"allowSyntheticDefaultImports": true,
"target": "es2017",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": false,
},
"exclude": ["apminsightdata", "devops", "node_modules"]
}
The apminsightdata is because of site24x7 integration and devops is where I keep documents and SQL for our other teams to run when deploying.
add this configuration in the launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch app",
"type": "node",
"request": "launch",
"args": [
"src/main.ts"
],
"runtimeArgs": [
"-r",
"ts-node/register",
"-r",
"tsconfig-paths/register"
],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart",
"env": {
"NODE_ENV": "local",
"NODE_PORT": "3000"
},
"sourceMaps": true,
"console": "internalConsole",
"outputCapture": "std"
}
]
}
no need to config luangch.json
Open Vscode, and enter CTRL+SHIFT+P, select Toggle auto attach, choose always
Click the code line you want to debug
npm run start
It will hit the line you want to debug
I am trying to configure the Debugger in VSCode
I looked through official documentation to setup the VSCode debugger for C/C++ but it's not working.
Documentation states the steps for setting up vscode debugger for
powershell in windows.
But I am trying to set-up debugger with git bash as my default integrated terminal in windows.
I have added git bash as default terminal but I am not able to setup debugger with git bash as integrated terminal.
Default configuration files :
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "g++.exe - Build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:\\MinGW\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "C/C++: g++.exe build active file"
}
]
}
The property :
"externalConsole": false
is set to false as I want VSCode to use the integrated default bash terminal instead of using external terminal for debugging.
tasks.json :
{
"tasks": [
{
"type": "shell",
"label": "C/C++: g++.exe build active file",
"command": "C:\\MinGW\\bin\\g++.exe",
"args": [
"-g",
"${file}",
"-o",
"${fileDirname}\\${fileBasenameNoExtension}.exe"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
}
}
],
"version": "2.0.0"
}
c_cpp_properties.json
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compilerPath": "C:\\MinGW\\bin\\gcc.exe",
"cStandard": "c11",
"cppStandard": "gnu++14",
"intelliSenseMode": "clang-x86"
}
],
"version": 4
}
settings.json
{
"files.associations": {
"iostream": "cpp"
},
"C_Cpp.errorSquiggles": "Disabled"
}
With the above configuration, when I start the debugging it gives me the following error:
It seems like the command property in tasks.json is incorrect,
as bash converts
"C:\MinGW\bin\g++.exe" -> "C:MinGWbing++.exe"
and gives error: "no command found" because back-slash('\') in bash is an escape character.
Now changing above path in tasks.json to bash style :
"command": "C:/MinGW/bin/g++.exe"
resolves the above error, but now it gives same error for variable ${file} as this path-variable gets dynamically set to current open file .cpp.
I have been working on this debugging issue for last few days, but haven't found any workaround yet.
How can I change/update by configuration files to use git bash as default integrated terminal in VSCode for debugging.
It seems like the command property in tasks.json is incorrect, as bash converts
"C:\MinGW\bin\g++.exe" -> "C:MinGWbing++.exe"
Then try a cygwin-like path:
/c/MingW/bin/g++.exe
# or
/C/MingW/bin/g++.exe
Check if it is interpreted correctly by the git bash session then.
I am using VS Code to debug an application on Ubuntu, using a launch.json file and cmake to build and debug. This works fine and I can see the output of the program in the terminal as expected. However, I would like to automatically save this output to a file. The way I would do this typically would be something like mycommand > terminal_output.txt, however I can't find a way of replicating this using the launch.json file, or alternatively of running the debug through the terminal (e.g. something along the lines of debug --flags launch.json > terminal_output.txt).
Here is my launch.json for reference:
{
"version": "0.2.0",
"configurations": [
{
"name": "g++-8 build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "g++-8 build active file",
"miDebuggerPath": "/usr/bin/gdb"
}
]
}
Is there a way of doing this in a simple way?
Since I am using cmake, I was able to achieve this using cmake.debugConfig in my settings.json file:
{
"cmake.debugConfig": {
"args": [
">",
"test.txt"
]
}
}
Adding "args" in launch.json, however, did not work.
install CodeLLDB extension
launch.log: inside a CodeLLDB launch configuration add
"stdio": [null, null, "debug.log"] // stdin/stdout/stderr
stdio redirection for CodeLLDB
In such a way that it is not in a sub shell. I need it to be able to prepare the environment...set environment variable.
"version": "0.1.0",
"command": "${workspaceFolder}/Invoke-Task.ps1",
/*"command": "powershell", creates subshell so doesn't work*/
"isShellCommand": false,
"args": [],
"showOutput": "always",
"echoCommand": true,
"suppressTaskName": true,
"tasks": [
{
"taskName": "task1",
"args": ["task1"]
},
{
"taskName": "task2",
"args": ["task2"]
}
]
I am sorry, but you are not correctly editing the .vscode/tasks.json file.
In your scenario, lets say you have some powershell script ./scripts/mycustomPSscript.ps1 you want to run as a vscode task. For such goal, edit the tasks file so it follows the below example:
{
"version": "2.0.0",
"tasks": [
{
"label": "Run-some-custom-script",
"detail": "Prepare some ENV variables for the deployment",
"type": "shell",
"command": "./../scripts/mycustomPSscript.ps1",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
}
}
]
}
This has been doable since 2017, if I get your ask correctly.
integrated-terminal-tasks README This extension allows a workspace to
define specific tasks that should be ran in VSCode's interactive
terminal
https://marketplace.visualstudio.com/items?itemName=ntc.integrated-terminal-tasks
Also, your post / query, could been seen as a duplicate of this...
Run Code on integrated terminal Visual Studio Code
Adding this configuration in the launch.json file did the trick for me
"version": "0.2.0",
"configurations": [
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Launch Current File",
"script": "put full path here\\launch.ps1",
"args": ["${file}"],
"cwd": "${file}"
},...
Not sure what you mean by 'integrated terminal' but the output does show up in the VSC terminal if this is what you're referring to.
Is it possible to invoke more than one pre-launch task using VS Code?
I try to restore packages then build then run but I can only get to configure build.
My launch.json:
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/src/myProject/bin/Debug/netcoreapp1.0/myProject.dll",
"args": [],
"cwd": "${workspaceRoot}/src/myProject",
"stopAtEntry": false,
"externalConsole": false
},
My tasks.json:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "dotnet",
"isShellCommand": true,
"args": [],
"tasks": [
{
"taskName": "build",
"args": [
"./**/project.json"
],
"isBuildCommand": true,
"showOutput": "always",
"problemMatcher": "$msCompile"
}
]
}
so I tried to specify the dotnet restore command however it does not work.
I know this is long over due. However, I think I figured out the solution. Steps I did.
Create a workspace to include all the projects in the workspace.
Go to Run and Debug, and click on "Add Config (workspace)
the format is the following:
{
"folders": [
{
"path": "project1"
},
{
"path": "project2"
},
],
"launch": {
"version": "0.2.0",
"compounds": [{
"name": "Chain Stars",
"configurations": [
"ConfigurationName1",
"ConfigurationName2",
]
}]
}
}
ConfigurationName1, and ConfigurationName2 is the profile name you would like to put them in sequence to launch your website.
4. Save the profile. In this case. "Chain Stars" is going to show up in the profile name for you to run it. Let me know if you have any questions.