The reason Linux never succeeded on the desktop is the lack of usability testing. Open-source programmers hate users, and created such an ugly baby that only a fanboy could love it. It's funny watching the same thing happen to "Visual Studio Code", Microsoft's answer to the Atom editor. You'd think with Microsoft behind it, that it'd be guided by usability testing. The opposite is true. It spends a lot of time hyping it, but every time I try to use it, I encounter unreasonable hurdles for the simplest of things. It's the standard open-source paradigm -- they only spend effort to make something work in theory without the extra effort to make it usable in practice.
The most common thing you'll want to do is first create a "hello world" program, then debug it. As far as I can tell, there are no resources that'll explain how to do this. So, for JavaScript on Windows, I thought I'd explain how this works.
Firstly, you'll need to install NodeJS and VS Code. Just choose the defaults, it's uneventful.
Secondly, you need to understand how projects work. This is the first hurdle everyone has with an IDE. You don't simply run the code or use a makefile. Instead, you manage a lot of other things, such as the debugging environment.
VSCode manages projects by putting things in a folder. In other words, you don't "open a project", but instead "open a folder". Any project files (or version control files) that it needs it'll create as it goes along. When you first tell it to start debugging, it'll create a config file for the debugger filled in with defaults that'll work for you.
The steps to create/debug a "hello world" program are therefore:
mkdir c:\tmp\foo
code c:\tmp\foo
[click new file icon in the project, create "app.js"]
console.log("hello world");
[click debug icon, save/close the launch.json file it creates for you]
[click go icon]
By default, execution starts at 'app.js'. If you've named your file something else, like 'hello.js', you'll need to change your launch.json settings. Otherwise, you'll get a "app.js does not exist" error message.
At this point you aren't out of the woods. When I tried this, I got the error message "cannot launch target (reason: spawn node ENOENT)"
Normally, I don't mind such error messages. When the user has done something so weird that the programmer can't figure out how broken things are, then cryptic error messages like this are expected.
But this isn't something weird, but the most common problem somebody is likely to have. Specifically, it can't find the path to "node.exe" to launch NodeJS. That's because I'd just installed both NodeJS and VSCode, and told the installer to launch VSCode directly. It meant the shell wouldn't have node.exe in it's path until I logged out and back in again. Every new user is going to have the same problem. Yet, there is really no help available anywhere that explains what's going on.
After you install both NodeJS and VSCode, make sure that these programs are "added to the PATH variable" (the default in the installer). Then, restart Windows. Or, at this point open a virgin new command-prompt, at which point they'll be in your path, so the steps I describe above on the command-line should work.
Then, I got my "hello world" to work:
I'm writing this post with the two error messages above in the hopes that Google can find them. When I googled the error messages, I got nothing helpful.
In general, when using VSCode, and you get stuck, just assume that the VSCode programmers are a bunch of fscking retards, and try to reverse engineer what retards would do. In my case, I knew that not having node.exe in the path was the most common problem in the world, but that retards would nonetheless have the most cryptic error message in the world when it encountered the problem.
Note that "Visual Studio Code" is a side Microsoft project. It's nothing like "Visual Studio", which is a rather awesome environment, though one that sadly doesn't support JavaScript.
Your experience with VS Code is not too far off from mine. I downloaded it 6 months ago hoping that it would be a "lite" version of Visual Studio (which I like) that I could use for Linux-based projects. It had a few cool ideas, but far more simple issues that hampered usability. For instance, when programming C++ (which is one of the "second class" supported languages), whenever you press Enter to make a newline, it thinks you want to autocomplete the last word you typed at the end of the line...even though you already typed all of it. Pressing Enter triggers autocomplete and doubles the last character of the word. Really. You wouldn't believe how many "wordd"s there are in my comments because of this.
ReplyDeleteMaybe it's been fixed in a newer version (I left feedback with the smiley button), but at this point I've given up and gone back to Vim. It's rudimentary, but at least usable if you can manage to remember all those commands.
Personally i would just use brackets or vs2015 community with the node js tooling (https://www.visualstudio.com/en-us/features/node-js-vs.aspx). I just dont see the point of diet vs when the community sku of full fat vs removed all of the retarded limitations that vs express had, i.e. can install plugins and do other more advanced things...
ReplyDelete