
VS Code can do that? - kawera
https://vscodecandothat.com/
======
ggregoire
Some other ones:

\- In the Git view, select a modified file, select some lines of code you
modified, cmd shift P, Git: Stage Selected Ranges. I dropped my dedicated Git
GUI since I know this trick.

\- If you spend a lot of time coding in React, and have half of your files
named index.js, do yourself a favor, go in the settings and add
"workbench.editor.labelFormat": "short" (display the name of the file's folder
in all the tabs)

\- You can preview markdown files natively (button at the top right corner).

\- Real time collaborative development:
[https://marketplace.visualstudio.com/items?itemName=MS-
vsliv...](https://marketplace.visualstudio.com/items?itemName=MS-
vsliveshare.vsliveshare)

~~~
Tagore
I keep hearing good things about VSCode. If I weren't essentially married to
emacs I'd definitely try it out. I'm not sure I'd recommend emacs to everyone
at this point, though I think it remains a really solid choice of editor/OS
for people willing to get over the learning curve and put up with a bit of
clunkiness.

Re the git stuff though- one place that I'm pretty sure emacs is the
uncontested champ is in git integration via magit. I'd be inclined to
recommend using emacs as their git interface even to people who want to use a
different interface for everything else. It is that good, and IMHO the only
git porcelain that is strictly better than the standard git porcelain.

~~~
kenbolton
I started playing with emacs 24 years ago, then spent 20 years as a devoted
vim user with a two year work-enforced gap in Eclipse. I tried spacemacs in
evil mode about four years back and stayed for magit. I tried VSCode a few
weeks ago to see what the fuss was about and had my Eclipse PTSD triggered.
Magit, mu4e, elfeed, eww, multiterm, restclient.el, tramp, [edit]org-
mode![/edit], the list of replacements for bloated "native"\- and surveilling
web-apps keeps growing. I mentor an up-and-coming developer who has learned
more– about git, the filesystem, shells –in four weeks of using spacemacs than
the 23 months of using Atom and VSCode. I know emacs in evil mode makes me
smarter and more productive, and I'm seeing anecdotal corroborating evidence
in my community.

~~~
YetAnotherNick
I am using vim for years now, and I haven't written more than 50 lines of
vimscript apart from the bundles. Most of the thing that I have written is
just maps, some configuration for other bundles, and some copied better
defaults. I still don't get it when people say they heavily use elisp. Can
anyone give example of a highly custom thing that you do in emacs/vim/any
other editor, for which there is no famous bundle available.

~~~
kenbolton
The question is not elisp v. vimscript but rather the power of not having to
switch contexts. To write code for a locally-hosted RESTful API I used Chrome
to read the API docs, Postman to make the calls, iTerm2 to start/restart the
server and read the logs, and a text editor to make changes. I replaced that
flow with eww, restclient.el (amazing!), multiterm, and an editor buffer. No
changing of context, conserve about ~1GB RAM in Chrome instances, full-screen
if I want it, and everything is text (I'm looking at you, Postman).

On the "highly custom" level, I have a work-in-progress script that takes a
URL, sends it to a Splash server, and returns the rendered HTML to eww for
viewing. This is great for annoying SPAs like the article that spawned this
conversation.

My current goal is to swap out my development MBP with an eInk tablet and
bluetooth keyboard. Success will be measured as a function of productivity and
weather-/water-/environment-proofing of the device; the goal is productivity
in full sunlight and/or under water. Emacs will have a central role in that.
Just need to find an eInk device with adequate screen refresh rate and
Bluetooth support....

~~~
figgis
Not downplaying your choices but throwing this out there. Vim can and does all
of that as well.

vim $DOCUMENTATION_URL (curls the page and opens in vim)

vim-rest-console

:terminal (new!..ish. Works great.)

------
scottmf
Slightly off topic but this code in example #5:

    
    
      get() {
        return new Promise((resolve, reject) => {
          fetch(`${baseAPI}/heroes`)
            .then(response => response.json())
            .then(json => resolve(json))
            .catch(err => {
              reject (err);
            });
        });
      }
    

Why not just:

    
    
      get() {
        return fetch(`${baseAPI}/heroes`)
          .then(response => response.json());
      }

~~~
OutThisLife
or

    
    
      async get () {
        return await (await fetch(`${baseAPI}/heroes`)).json()
      }

~~~
Boulth
If you see `return await` glued together just like that you can drop the
`await` as it's effectively a no-op in this case.

------
coding123
My favorite is multi-selection mode. It's not the same as "Column Mode" you
find in other IDEs but try it and you will never want another editor again:

(Option)Alt-Cmd + Down or Up arrow key

From there, you can use arrow keys as normal, but instead of controlling one
carrot, you control all the ones you created. So if I use the shortcut key to
move to the next word, they all do, same with end of line, or what have you.
In the past I had to use regex in my editors to extract quoted text in each
line... now I just use multi-select. Each carrot can also be created with the
mouse in the Selection menu.

Edit: Apparently it's a feature lifted from Sublime and in other IDEs -
thanks!

~~~
staticassertion
This exists in most editors I've used (intellij is alt + shift + click or
double tap alt, if I recall). I don't know how people program without this
feature - they should teach this shit in school.

Multicursor is amazing.

One thing it's been great for:

I have code like:

byte b1 = array[0];

And I want to do this for 16 bytes. Control + D to duplicate 15x. Double tap
control, hit up 15 times - now there's a cursor at every row. Hold control,
hit right (jump by word), index to end of 'b1' on each line. Ctrl + shift + a,
'increment duplicates' \- now every line is 1, 2, 3, 4... 16. `ctrl + right`
my way to the index key and do the same thing.

It's awesome.

edit: I just found 'duplicate and increment' :o

~~~
solipsism
_I don 't know how people program without this feature_

You must do some kind of programming I've not encountered in my many years.
While my editor of choice can do this, I would have no idea how, because a
feature like "increment duplicates" is needed so infrequently that I would
never remember the shortcut.

~~~
derimagia
It's one of those things that is incredibly useful. Of course it's possible to
survive without it, but it's like saying "I don't know how people program
without Copy and Paste". It helps.

~~~
khedoros1
Copy and paste is something that I use many times a day, even when I'm not
programming. Needing to do the same edits over multiple lines doesn't happen
often in my code.

There are appropriate plugins available for my editor, but I've never felt the
need to install them.

~~~
staticassertion
I don't use this as much as copy/paste, but I absolutely use it daily.

------
outside2344
My favorite is when you have a git merge conflict - just open the file in
VSCode and you can visually merge it. I can't explain the feeling of joy I had
when I discovered this - and this keeps happening over and over with VSCode.

~~~
dawnerd
Atom got this recently too and it’s such a lifesaver. I keep switching back
and forth each time one gets a feature the other doesn’t have.

------
cowmix
For the past 2+ years I've continued to be amazed by VS Code. The most amazing
thing about it, it works best (in my experience) on Linux.

~~~
boterock
for me it doesn't work well with non-standard keyboard (colemak). All
shortcuts break (at least on fedora 28 it does)

~~~
narimiran
I'm a colemak user with no problems with shortcuts. Try putting in your
settings:

    
    
        "keyboard.dispatch": "keyCode"
    

and see if it helps.

------
wink
Really nice idea, but 90% focused on Web (frontend?) development. HTML, JS,
and not much else. :(

Still found 2 useful things for me, Parens colorizer and settings sync via
Github Gist.

~~~
Dinux
I use it for most of my C++ projects, and it almost does a better job than
Visual Studio itself.

~~~
wink
I meant the suggested addons on that page, not VS Code per se.

I'm also using it as my main editor on my Windows box at home where don't do
serious development.

My only real annoyance is that I seem to run into multiple addons that can't
be properly installed for one reason or another and sometimes "Ignore this"
doesn't work and then the popup gets stuck and you can't see the top three
lines...

Apart from that it's been really nice for Rust, Go, and Python.

~~~
jxub
> the popup gets stuck and you can't see the top three lines...

The newest version has smaller popups on the bottom-right of the window, and
that was a nice surprise for me.

~~~
wink
Yeah I just noticed. Just reinstalled the 64bit version instead of the 32bit
one. (Apparently it's one of those applications that act a bit wonky if you're
using multiple users on Windows.. it wasn't in the start menu and the Binary
was in AppData, so I thought I'd need to reinstall it - but first I had to
uninstall the old one.. same with Discord...)

------
vjeux
So honored to see Prettier being the #3 tip!

~~~
Tagore
I'm an evangelizing convert to Prettier. I was hesitant about it until I tried
it, but... I am sold on it now. Prettier has costs- there are cases where I'd
like to format things based on semantics not syntax, to show intent, and
Prettier can't read my mind (feature request: make Prettier read my mind.)

But the costs are more than offset by the benefits. I didn't realize how much
of a cognitive burden thinking about formatting was until I stopped thinking
about it, and it turns out that using formatting to signal intent is perilous
when people don't agree on how formatting signals intent.

I'm pushing to have Prettier used across all our JS code- there is some
resistance to the idea of running it across a several hundred k line non-
prettified codebase and some resistance to the idea of using it at all. And
this causes problems. Prettier is best when you use it for everything.

But I'm pretty sure we'll eventually just move to prettification. It seems
like the right thing to me, and I'm generally right ;). Anyway, thanks for
Prettier- I am not actually a huge JS fan despite mostly writing it
professionally, but Prettier does away with some of my complaints about JS,
and just generally makes my life easier.

------
FBISurveillance
One thing I really miss in VSCode is Sublime-like search result display in a
new tab that shows the result and surrounding lines. The "panel" search
results view VSCode has now is far from perfect.

~~~
omn1
Check out this:
[https://github.com/Microsoft/vscode/issues/23931#issuecommen...](https://github.com/Microsoft/vscode/issues/23931#issuecomment-376060761)

Add this to your settings:

``` "search.location": "panel", ```

Not perfect, but it's a start.

------
devbug
And yet it still doesn't respect the Insert key.

[https://marketplace.visualstudio.com/items?itemName=adammara...](https://marketplace.visualstudio.com/items?itemName=adammaras.overtype)

~~~
SquareWheel
People actually use "work deletion mode" on purpose?

I've always wished this key at least had an LED indicator along with Caps
Lock.

~~~
digi_owl
Once upon a time, hitting insert resulted in the caret switching from line to
rectangle to indicate input mode.

~~~
rhizome
It used to be that normal mode was an underline cursor and insert mode was a
vertical cursor, but now that I guess vertical cursors are everywhere, Sublime
switches between a vertical cursor for normal mode and an underline cursor for
insert mode. A bit of a drag, but I don't use insert much at all.

One thing I'd like from the past is a blinking block cursor.

~~~
jgtrosh
As a vim guy, and I say this because I think it makes more sense in vim, I
think you mean insert mode (the “normal” mode) and replace mode (the “insert”
mode). The fact that the insert is used to toggle out of the default insertion
behaviour seems to add confusion.

~~~
rhizome
I wasn't using the terms in the vi/m sense, but insert/replace does make more
sense.

------
Groxx
tbh I wish editors would _get rid_ of "log breakpoints". Teach people to use
the conditional breakpoint and just enter `console.log(...)` instead, it's
overwhelmingly more powerful. A specialized "log breakpoint" doesn't teach
them that it's _just code_. (I've run into quite a few programmers who have
known about log breakpoints for years, used them fairly heavily, but never
knew you could _do things_ in conditional breakpoints)

Want to collect all values of something as your code runs? conditional
breakpoint: `x = (x || []).append(val)` and then print it whenever you feel
like it. Log breakpoint? spit it out each time and... browse by hand? hope
nothing's logged in between? bah.

~~~
setr
I've never even seen log breakpoints before but is it really just a wrapper
for inserting console.log()? That seems... kinda useless. From the video, it
doesn't even look like it's that easy to clean-up once you're done with them
(though maybe there's a remove-all function)

>Teach people to use the conditional breakpoint and just enter
`console.log(...)` instead, it's overwhelmingly more powerful.

If you're going to print things for insight at breakpoint time, wouldn't it
make more sense to just use watch expressions?

~~~
Groxx
"stop the world and view expression(X)" is time-consuming when you're trying
to _discover_ patterns that you can later be more selective about (e.g. to
turn them into a conditional breakpoint). With logs you can pretty trivially
spit out thousands of them and eyeball / grep / etc however you need, which
could take hours if you had to stop each time, and didn't have specialized
tools to help you search for needles in the haystack.

But very frequently yes, all you need is a breakpoint and an expression, and
hit "continue" a few times. I absolutely do that when I can.

\---

As to "just a wrapper for console.log", yes. It's a bit of an infection,
though I'm not seeing as many as I used to, so maybe we're fighting it off.
but e.g.:

jetbrains has stuff like "evaluate and log":
[https://www.jetbrains.com/help/phpstorm/configuring-
breakpoi...](https://www.jetbrains.com/help/phpstorm/configuring-
breakpoints.html)

Visual Studio has "condition" and "action" options for breakpoints:
[https://msdn.microsoft.com/en-
us/library/5557y8b4.aspx](https://msdn.microsoft.com/en-
us/library/5557y8b4.aspx) one of which is "log a message":
[http://www.visualmicro.com/page/User-
Guide.aspx?doc=Working-...](http://www.visualmicro.com/page/User-
Guide.aspx?doc=Working-With-Breakpoints-When-Hit.html) (mindlessly copying
this UI, because what VS does is Good™ (it generally is!), used to be more
common from what I can remember)

even Chrome [1] and MDN [2] refer to conditional breakpoints, but only mention
"will stop when condition is true", not "by the way you can mutate state in
here, call funcs, anything you like".

[1]: [https://developers.google.com/web/tools/chrome-
devtools/java...](https://developers.google.com/web/tools/chrome-
devtools/javascript/breakpoints#conditional-loc)

[2]: [https://developer.mozilla.org/en-
US/docs/Tools/Debugger/How_...](https://developer.mozilla.org/en-
US/docs/Tools/Debugger/How_to/Set_a_conditional_breakpoint)

\---

It's oddly crippling to not know this kind of stuff. Ever had a bug, and you
wanted to see how it would behave if var X was the right value? _You can just
override it in a conditional breakpoint_ and "fix" the bug without rebuilding,
to see what happens.

Thankfully there are at least a handful of people who have realized this,
despite docs essentially never calling it out:
[https://davidwalsh.name/debugging-conditional-
breakpoints](https://davidwalsh.name/debugging-conditional-breakpoints)

In many languages, a debugger is very nearly a REPL. Wish Java would have a
REPL? Sure, a simple CLI command would be nice, but I've done "live" coding of
android apps for years. Just add a periodic callback to the main thread with a
disabled breakpoint - once there, modify your views in the expression editor,
and your app - on your _phone_ \- updates in the very next view tick. There
are limitations, like (kinda) not being able to import new things, but they're
not hard to work within and the time savings can be immense.

------
itwy
I recently switched to JetBrains products. Their IDEs are much smarter.
Infinitely better than VS Code, Sublime and whatnot. It's the closest thing to
pair coding!

~~~
aleksi
VS Code can do that too: [https://code.visualstudio.com/visual-studio-live-
share](https://code.visualstudio.com/visual-studio-live-share)

~~~
itwy
I meant the IDE acts as another pair of eyes on your code.

------
cryptonector
Just say no to those ligatures.

~~~
Sawamara
I actually love using them, especially with Fira Code.

~~~
Skunkleton
Why? Not poking at you, just curious.

~~~
okanesen
Not OP but for me it's just a preference like a color scheme is to anybody
else. It is visually appealing and helps to distinguish different aspects of
some context specific things.

I get that it's not for everybody but being so against it is something I
really do not understand.

Why use color schemes or different fonts at all then?

~~~
Skunkleton
A font is pretty different sort of thing. I'm questioning why you would want
multiple characters combined.

------
wolco
Has anyone figured out how to edit files directly from a remote directory over
ssh/ftp?

~~~
reedr
I use sshfs for that..

~~~
dragonshed
+1 for sshfs. I had it working on macOS at one point when frequently working
on a raspberry pi, but haven't needed it since.

------
tjr225
I've been using VS Code as a light sql server workbench.

I have got to check out the docker features as well.

------
carapace
Blank page without JS, static content with JS. C'mon!

I really like VSCode. MS is innovating in UX.

------
reitanqild
My favourite "features": the ecosystem and the development speed.

It keeps getting better and better and better month by month and it now even
knows how to fix small stupid mistakes like a missing this. when trying to
access a field in ts etc.

------
stevefan1999
VSCode can do all sorts of thing, but the huge runtime dependency
(Electron/CEF) and slow startup time is kind of unfavourable.

Well, maybe it’s my extensions that made it slow.

------
didibus
Oh, most of those are for HTML/JS. I was hoping it was gonna talk about
performance improvement or support for additional languages and features.

~~~
petee
There are a ton of language extensions available, is there a particular one
you are missing?

~~~
arbie
Perl?

~~~
vgy7ujm
+1

------
Boulth
One thing I miss with VS Code is something akin of Eclipse Mylyn. When working
with large code bases it's invaluable!

------
prepend
Is there a way to have intellisense sense work with python dictionaries? It
seems like intellisense for json would be a similar issue as nested dictionary
representations in json, but I can’t find anything that does this and don’t
want to use another class just for faster coding.

~~~
crdoconnor
You'd need access to the runtime environment in order to do that.

That said I wish somebody would make an IDE that would tightly integrate
IPython so I could get IDE autocompletion in a paused test. I spend way too
much time writing code in IPython prompts and copying it back.

~~~
prepend
You can check design time for any strings placed in source. Which is really
what I want. I don’t need intellisense for stuff populated at runtime as much.

------
opencl
Will it ever get encoding autodetect? That's one of the big reasons I've
stayed on Notepad++. VS Code clearly _does_ detect the encoding, because when
you go to change it it suggests the right one, but it doesn't load correctly.

~~~
coldtea
It shouldn't matter in 2018. Why aren't 99.9% of your input files in either
ASCII or UTF-8?

~~~
opencl
I would be thrilled if 99.9% of my input files were UTF-8, but I'm not the one
writing them. SJIS remains in widespread use in Japanese companies and tons of
legacy codebases do not work with UTF-8. If you're lucky there's a config flag
for UTF-16.

------
gbaygon
I don't know how is it now, but I've used it for a couple of months for web
dev on my mac and switched to Atom when noticed my cpu was 70%+ of usage all
the time. I suspected it was because of the typescript plugin, but honestly I
don't care Atom doesn't do that and I'm happy with it.

~~~
orf
I'd have at least spent 15 minutes working out what was causing it before
taking the jump and switching editors?

~~~
gbaygon
I had, but this was several version back, couldn't find any info of what was
failing and also waited a major version update before doing the switch.
Switching editors always causes stress. That's why it's hard to gain users
back once you made a mistake on this (very competitive) field. I would only
try VS Code again if Atom messes up, no matter what new micro site Microsoft
PR puts online.

Edit-to-add: with your downvote you are invited to explain why/if I'm wrong.

------
kenbolton
Q: But does it org-mode?

A: No.

Long A: Org-mode is plain text. So it org-modes, but not in a meaningful way.

~~~
gecko
Meh, it's nascent, but it's not _so_ underpowered as to be genuinely useless:

[https://github.com/ajtoo/vscode-org-mode](https://github.com/ajtoo/vscode-
org-mode)

I've used it over Emacs for simple use cases without any real issues, and the
project's under very active development.

~~~
tincholio
If you're only using org basically as an outliner, then it might be ok for
editing. But I see no indication of babel, exporting, agendas, etc...

------
swrobel
Can't Atom do all of this as well?

------
moltar
Pretty basic list of things...

------
bunderbunder
In the spirit of cranky HN bikeshedding, I present: The page body, as seen by
a NoScript user:

    
    
      <body>
        <div id=app></div>
        <script type=text/javascript src=/static/js/manifest.14a76fad9b304f57d579.js></script>
        <script type=text/javascript src=/static/js/vendor.ffa8aef8ba29f634abaf.js></script>
        <script type=text/javascript src=/static/js/app.08230312c2e739a44ea1.js></script>
      </body>
    
    

Web developers: Please, you can do better than this.

~~~
Ninn
Please know that no one really cares. You must realise you cannot expect to
consume our applications but only on your own terms. Theres no contract saying
you should ONLY serve HTML on the web.

~~~
JoshMnem
In general, one should serve HTML on the web unless you're doing something
that _requires_ JavaScript. JS is a big security/privacy risk. At the moment,
I keep JS and CSS off by default on my main browsing profile, overriding it
with umatrix when a site requires it and it looks useful enough to bother.

~~~
allover
In general, one should consider the audience of the content, not NoScript
users, in this case.

> JS is a big security/privacy risk.

No, 3rd party JS (and 3rd party cookies, JS regardless) allow you to be
tracked. And ad-blockers deal with that. Blocking 1st party JS is of tenuous
benefit w.r.t security/privacy.

~~~
Amezarak
> Blocking 1st party JS is of tenuous benefit w.r.t security/privacy.

Blocking all JS lets me click on any link fearlessly.

~~~
arbie
What is your primary fear with JS enabled? Tracking/keylogging/cryptomining?

------
nabc45
Can it launch in less than 10 secs with a mechanical disk?

Can it not be unresponsive if you have a mechanical disk or a weak CPU?

Ooops, I'll stick to Sublime

~~~
shawnz
Unfortunate that you're being downvoted because the slow start time of VS code
is honestly such a big blocker that it outweighs most of these features for
me. I just can't wait 10 seconds every single time I want to take a note.

~~~
rp1229
What is your workflow like that a few second delay is a major blocker?

I used to feel the same way early in my career. Now I don’t feel the need to
be in a rush all the time.

~~~
epicide
I've seen some people make the argument that they want to use their editor for
quick edits to single files, which is a fine use-case. However, VS Code is
really not designed to be optimized for that case. It's really about editing
code (hence the name) as opposed to quick edits to configs, etc.

It's usually best if one knows a few different tools designed for different
scenarios. Right tool for the job.

~~~
shawnz
At the same time though, it is purposely not positioned to replace a full-
blown IDE. So what is the use case that it's optimized for? Why does it offer
to add an "open with code" context menu item to every file if it's not
expected that you'll be using it for quick edits on individual files?

------
coldtea
If only the core was some sturdy C++ or Rust or whatever as opposed to JS and
a nice GUI/Canvas lib as opposed to DOM.

~~~
snarfy
Wouldn't it just be Visual Studio then? We would get updates once a year
instead of once a month. There are less C++ devs than JS devs. The size of the
community that could contribute would shrink also.

~~~
coldtea
> _Wouldn 't it just be Visual Studio then?_

No, but it would "just be" an open source, MS backed, version of Sublime or
TextMate. The concept of Visual Studio is different.

> _We would get updates once a year instead of once a month._

The language the core is in is irrelevant as to whenever we would see updates.
That's a concern of the release process.

> _There are less C++ devs than JS devs._

Not really important, as most of the contributors are MS guys anyway. In fact
a single person has made Sublime Text, an editor that offers most of what
VSCode offers, with 1/100 the budget and manpower. If only it was Open Source
too, or had a few more devs...

~~~
Tagore
Parsing C++ is a nightmare....

