Tuesday, April 11, 2017

VSCode: Hiding .js and .map files generated by Typescript compiler

Visual Studio Code is Microsoft's New Open Source Code Editor. It is small, fast, flexible and yet very powerful. Coming from Visual Studio 2015 Professional / Ultimate, it feels such a relief when all you want to do is code and not worry about other things e.g. creating a solution, iis express / web server, etc. Visual Studio 2015 and 2017 are more full featured IDEs. If you want to just dive into Angular 2 with node web server quickly, Visual Studio Code (VS Code) is a pretty good contender. In addition, it is free and open source. There are tons of plugins available.
Auto-generated files in VS Code 

Excited, I decided to whip up an Angular 2 application in VS Code. However, as my project grew number of files in the left panel tripled. This is due to the *.js and *.map files generated by Typescript compiler. Files are sorted alphabetically, so .ts file is not going to be first in the list. I went into a Wookie rampage. I did not have this problem in Visual Studio 2015. It would neatly nest the auto-generated files.





After a little bit of research, found a way to hide these files. After some trial and error, I was also able to order to hide *.map files. Problem solved:

  • Click on Files / Preferences / Settings  menu. If using a Mac, click on Code / Preferences / Settings.
  • This opens the settings.json file. Left panel will show the current settings. Right panel is where custom / override settings go. 
Settings.json file in Visual Studio Code
  • Paste the following code in the right panel:
    •  "files.exclude": {
              "**/*.js": { "when""$(basename).ts" },
              "**/**.js": { "when""$(basename).tsx" },
              "**/*.js.map": { "when""$(basename)" }

          }
  • Save the file and voila! auto-generated files disappear instantly:

Visual Studio Code - auto-generated files hidden

Explanation

The left side of the setting i.e. "**/*.js" is called a "glob pattern". It will match any file with JS extension inside any folder. Towards the right side is an expression "when""$(basename).ts" }  that will be evaluated to true if same file with a TS extension exists. 

At the moment, VS Code supports a subset of glob patterns and only the "when" expression. You can check out the source code here.

Wednesday, March 1, 2017

2017 Alienware R3 15" Wifi Connection Issues

2017 Alienware R3 15" Wifi Woes

Bought my first Alienware last month and I love it. First two weeks were rough though. She was dropping wifi connection randomly. I was going crazy. Life was miserable. We were on the verge of divorce. Wireless connection would only work for less than 30 seconds, then drop. To fix it, I had to switch to anther wifi connection. Resetting, rebooting, running troubleshooter, etc., did not work. Even prayers did not work. Reinstalled drivers multiple times, searched both the northwestern and southeastern corners of the internet. Then spent 3-4 hours with Alienware support but no luck.
 Alienware R3 15" - 2017 cover closed

Reinstalled Windows 10 a few times (another long story). Then it magically worked. I was on Cloud 9. Life was good. The trick was to not install the Killer app or Killer drivers. I just let Windows install whatever default drivers it came with.
Alienware R3 15" - 2017 cover open

So if you are having issues with Wifi:

  • Backup your files
  • Download all Alienware drivers from Dell support
  • Take a printout of the page that shows the order of driver installation
  • Reformat / Reinstall Windows 10. Take a break.
  • If it does not install Wifi / ethernet drivers automatically for you, repeat Windows install. It did not install drivers during 1 out of 3 times for me. Not exactly sure why.
  • Reinstall all drivers except Killer drivers in the suggested order. Absolutely do not install the Killer software. It is junk and causes wifi to drop.
  • Enjoy!