outFiles in launch.json seems useless - debugging

Location string of sourcemap file is in generated javascript file,
VSCode can find sourcemap file from javascript file.
So why we need "outFiles" setting? The official doc says "VS Code will search your entire workspace, excluding node_modules, for sourcemaps". why should VS Code do that?

Related

Suppress warnings/errors in Visual Studio 2017 for certain file

I have a project which is using TypeScript and some external libraries.
I'm searching a way to block all errors and warnings for all .js, .ts, .d.ts etc. files in node_modules folder and the folder with other libraries which relative path to the project root is assets/plugins . I've tried creating a .eslintignore file with the following content:
./node_modules/*
./assets/plugins/*
and also
./node_modules/**/*.js
./node_modules/**/*.ts
./node_modules/**/*.d.ts
./assets/plugins/**/*.js
./assets/plugins/**/*.ts
./assets/plugins/**/*.d.ts
but this didn't work.
Just to recap, I want to block errors and warnings for those files only and remain visible for all other files in the project.
P.S.: All those errors and warnings in .ts and .js files are visible only in Visual Studio 2017 when the project is opened in Visual Studio 2015 there are no errors and warnings.
Adding an .eslintignore to the root of the project, containing the following, and then restarting VS did the trick for me (for now at least)
**/*.d.ts
**/node_modules/*
In order to suppress all warnings for node_modules (both ECMAScript and TypeScript) you should create an .eslintignore file with the following content:
**/*.d.ts
**/node_modules/*
**/assets/plugins/*
and also create configuration for the typescript compiler (tsconfig.json file) in the project root containing the following:
{
"exclude": [
"node_modules/*",
"assets/plugins/*"
]
}

Typescript Type Definition References

I have a project with multiple typescript files.
If I add a new typescript file I have to reference typings in order to compile it, VS couldn't resolve them itself. Also I have empty .ts file that doesn't require referencing typings, so I put code into it and it works.
When I found out it I kept the file and now when I need to create new .ts file, I copy that file and everything works like a charm.
So suppose in a folder I have two .ts files side by side: a copy of a magic file and a newly created one.
If I put this code in the magic file
class Test {
test: KnockoutObservable<string>;
}
it compiles. If I put the same code into another file it says
Cannot find name KnockoutObservable
What is so special about the first file?
I'm using Visual Studio 2015.
I have installed Knockout typings.
I have empty tsconfig.json file in the solution.
I don't want to reference typings using /// reference comment.
Thanks.
You need to use TSD and install appropriate ".d.ts" file, e.g. for knockout:
tsd install knockout
It downloads "knockout.d.ts" into your project and places definition into typings folder:
typings/knockout/knockout.d.ts
Then you can add corresponding reference to the top or your "ts" file. e.g.:
/// <reference path="../../typings/knockout/knockout.d.ts" />

IDEA 14 - debugging typescript

We've a project in Idea with some typescript files and use an ant file to transpile it generating the matching js and map files.
When debugging through IDEA (html file) breakpoints in the typescript files do not work and we don't see the map files in chrome even though existing.
What is the expected structure of the js, ts and map files for debugging typescript with IDEA ?
Debugging with chrome/firefox is fine.
You have to install Jetbrains IDE Support extension for Chrome (I also allowed this extension on incognito - chrome://extensions) and a plugin named Javascript Debugger for Intellij Idea or Webstorm (it needs Spy-js and NodeJs plugins to be enabled also).
After that you just have to do a right click on your project's .html file and click on 'Debug your-html.html'
Update: Sourcemap files are needed to debug, while compiling typescript --sourcemap option must be set.
I just ran into this. However I am not working on a frontend project.. but it might help just as well.
To debug in intellij, I first compile my typescript files.
I defined tsconfig.json
I used tsc -p tsconfig.json to compile.
To make debugging work I did the following
Added "sourceMap": true to tsconfig.json
I ran the compiled js file
==> debug just works when I put a breakpoint in the ts file.
Let me know if this does not resolve your scenario, I will investigate an modify the answer.
This is the project I am working on for reference: https://github.com/coder-on-deck/easy-typescript-setup

Phpstorm scss file watcher issue

I have this file structure and wacther configuration:
The problem is that when I save my scss file the css file is updated in IDE only if I switch focus from IDE window and back again.
P.S.: if I configure scss watcher to compile css files in the same directory where source scss files are located, then css files are uptated right after compilation(as it should).
As suggested in my comment: alter your path in "Output paths to refresh" to point to the actual output file (as in "Arguments" field) and not just folder: i.e. add /$FileNameWithoutExtension$.css at the end.

Is there a way to extract info from vs project, eg cl.exe command line

Since I write a command line program to check cpp files, and it need lib path and include path of those cpp files.
How can I get the include and lib path info from visual studio project? Our project uses property sheets to make up those information.
It is made up from 3 distinct sources:
Tools + Options, Projects and Solutions, VC++ Directories. In turn built up from several registry keys
the settings in your .vsprops project property sheets
the settings in your .vcproj project
The first part is the hardest, you can get it by running vc\vsvarsall.bat. The .vsprops and .vcproj files are XML, easy to parse.
If you just want to find out what the command line should look like then you can get it from the buildlog.htm file, produced when building from the IDE. Or you could use vcbuild.exe on the command line to build your project from the .vcproj file. Or you could build using devenv.exe /build.
Check out the Visual Studio project files - they're typically only XML files, so you should be able to extract out whatever you need from those, really. Just a matter of understanding and parsing your XML contents in the project file, really.

Resources