VS Code: NPM scripts keeps loading when run is pressed - visual-studio-code

At the side panel on NPM Scripts. If I press run; the script keeps loading and does nothing.
See the images below:
If I run the script in the terminal manually it works.
I don't know how to fix this, maybe a setting or something that's wrong.

I removed in my settings.json
"terminal.integrated.profiles.windows": {
"Cmder": {
"path": "${env:windir}\\System32\\cmd.exe",
"args": [
"/k",
"C:\\Program Files\\installed-files\\cmder\\vendor\\git-for-windows\\bin\\bash.exe"
]
}
},
"terminal.integrated.defaultProfile.windows": "Cmder",
I used another terminal instead of the default. This was the cause of it.

Related

How to run GNU-Prolog on VSC?

I'm new to using VSCode and also I'm learning Prolog so I want to know how to run it from the editor.
I'm on windows and I already activated the enviroment variable LINEDIT=gui=no so when I call C:\GNU-Prolog\bin\gprolog.exe it runs on the shell.
to open a file you have to run in the prolog terminal:
changedirectory(DirectoryPathName). to go to the file's directory and
[file] to open it.
I don't know how to translate that into the VSC settings so I can use it to run Prolog.
Any help is appreciated!
Something like defining a task in your tasks.json file. For version 1.5.0 of VSC:
{
"version": "1.5.0",
"tasks": [{
"label": "my echo test",
"command": "echo", // Could be any other cmd
"args": ["test"],
"type": "shell"
}]
}

VSCode build task with dependsOn does "nothing" when gulp is installed. No output. How can I find the error?

I'm having problems with my VSCode installation, and I need some help to detect the cause of the error(s).
In one of my projects, I cannot (for some reason) execute any task that have "dependency tasks" defined. This is my .vscode/tasks.json file (created just to illustrate the problem):
{
"version": "2.0.0",
"tasks": [
{
"label": "subtask1",
"type": "shell",
"command": "echo This is a subtask"
},
{
"label": "all",
"dependsOn": [
"subtask1"
]
}
]
}
The task subtask1 runs fine. The output is "This is a subtask".
However, the task all does not run. When I select it from the list of tasks to run, nothing happens. The terminal output remains unchanged (whatever output was already there, remains).
Whatever I name the tasks, doesn't matter. It seems that any task will not execute if it has a "dependsOrder" property defined.
This problem only persists when gulp is installed in the project dir (using npm i gulp).
My question is :
How can I find the cause of this error and how can I fix it?
I've tried deleting the entire dir in %APPDATA%/Code, so the cache seems to be cleared. Then, I restarted VSCode. But the problem persists.

Configuring Hy to run on VSCode

I'm trying to debug Hy code in Visual Studio Code. I have downloaded the hy-mode theme and it works great. There's only one problem. The hy-mode theme disables breakpoints.
I can add a breakpoint to my Hy code by switching to a totally unrelated language (like CoffeeScript) and then my Python debugger works. But I can't add breakpoints when I'm in hy-mode.
I debug code by writing a Python file that imports a Hy file. When I run the Python pdb debugger on the Python file, pdb debugs the Hy code just fine. But I can't add breakpoints to the Hy file when I'm have hy-mode active.
Is there a way to edit a Visual Studio Code theme so that to allow the insertion of breakpoints?
I found a solution to this problem. By adding "hy" to the languageIds list in the following files I can get Hy files to display breakpoints.
./ms-python.python-2019.8.30787/package.json
ms-python.python-2019.8.30787/out/client/package.json
"debuggers": [
{
"type": "python",
"label": "Python",
"languages": [
"python"
],
"enableBreakpointsFor": {
"languageIds": [
"python",
"html",
"jinja",
"hy"
]
},

TS lint plugin for VS code doesn't track closed files

I'm using VSCode 1.17.2, and using tslint plugin with it to track lint errors. As of now it is working fine with opened files and showing errors on files with red marker and giving error in problems tab. But it is not tracking closed files. Am I missing any configuration? Currently I am using default configuration.
See the documentation for the extension:
The extension lints an individual file only. If you want to lint your
entire workspace or project and want to see the warnings in the
Problems panel, then you can:
use gulp that or define a script inside the package.json that runs
tslint across your project.
define a VS Code task with a problem matcher
that extracts VS Code warnings from the tslint output.
For example, here is an excerpt from a package.json file that defines
a script to run tslint:
{
"name": "tslint-script-demo",
"version": "1.0.0",
"scripts": {
"lint": "tslint tests/*.ts -t verbose"
},
"devDependencies": {
"typescript": "^2.2.2",
"tslint": "^5.0.0" }
}
Next, define a Task which runs the npm script with a problem matcher
that extracts the tslint errors into warnings.
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "lint",
"problemMatcher": {
"base": "$tslint5",
"fileLocation": "relative"
}
}
]
}
Finally, when you then run the tslint task you will see the warnings produced by the npm script in the Problems panel and you can
navigate to the errors from there.
Here is the complete setup example setup.

VS Code - Failed to launch external program tsc.exe

I keep getting the "Failed to launch external program tsc.exe" in VS Code. I have installed typescript and set my path to where tsc.exe is located. Any suggestions
Here is my task file
// The command is tsc.
"command": "tsc",
// Show the output window only if unrecognized errors occur.
"showOutput": "silent",
// Under windows use tsc.exe. This ensures we don't need a shell.
"windows": {
"command": "tsc.exe"
},
// args is the HelloWorld program to compile.
"args": ["HelloWorld.ts"],
// use the standard tsc problem matcher to find compile problems
// in the output.
"problemMatcher": "$tsc"
You should try to install tsc this way:
npm install -g typescript
And then change tasks.json to:
...
"windows": {
"command": "tsc.cmd"
},
"args" : ["Myfilename.ts"]
...
And everything should work as expected, also, try to read this:
https://code.visualstudio.com/Docs/tasks
Well,
I came up with my own solution to generate modified version of tasks.json each time you config task runner(CTR), but I don't know if this is a really good pratice as VSCode is brand new I've not found a better solution, If anyone knows how to change CTR in the proper way PLEASE let me know!
There is a file called taskSampleConfig.json that is parsed everytime CTR runs, and this file is inside VSCode folder, so you may change it to:
...
"windows": {
"command": "tsc.cmd"
},
...
Since I can't comment yet I post it as an answer:
Since tsc.cmd must be executed in a command interpreter you need to configure it like this:
"windows": {
"command": "tsc",
"isShellCommand": true
}
The taskSampleConfig.json file is basically used as a template if VSCode can't auto detect a task runner. There is currently no support to customize the templating.
For me it works that way (Using VSCode in Admin-Mode on Win8):
Installing Typescript via npm (as jrabello wrote)
Setting up the task like this:
"version": "0.1.0",
"command": "tsc",
"showOutput": "silent",
"isShellCommand": true
Creating a tsconfig.json for your project with the compiler-options you need:
"compilerOptions": {
"target": "ES5",
"module": "commonjs",
"sourceMap": true
}