Earlier quoted context omitted.
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 e…
In Vim: just write the first line. Then iterate on this key sequence: YP l That can be recorded into a register (say "a") with qaYP l q then replayed with @a, and further repeated with @@. This is nothing new; I was doing this in Vim 20 years ago.
VS Code can do that?
261–270 of 280 posts
Re: VS Code can do that?
#262Earlier quoted context omitted.
E.g., it's easier to count the number of =s if there's no ligature.
What use cases do you have to regularly count characters eyeballing it? The characters are still distinct and equal width in the code and the line length doesn't shift, so it's just a visual thing...
Re: VS Code can do that?
#263Earlier quoted context omitted.
What use cases do you have to regularly count characters eyeballing it? The characters are still distinct and equal width in the code and the line length doesn't shift, so it's just a visual thing...
= vs == vs ===.
Re: VS Code can do that?
#264tbh 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 break…
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…
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...
Visual Studio has "condition" and "action" options for breakpoints: 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-... (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...
[2]: https://developer.mozilla.org/en-US/docs/Tools/Debugger/How_...
---
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
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.
Re: VS Code can do that?
#265Earlier quoted context omitted.
Or you could write a macro?
That sounds like considerably more work.
for x in type1 type2 type3 type4 type5 type6 ; do
cat for ProcessNode {
fn into(self) -> $x {
$x {some_boilerplate(self)}
}
}
!
done
Now do a line-oriented visual select of all the lines from for to done (using V + cursor movements). Then pipe to shell with !sh[Enter].Poof! The above is replaced with the following:
impl Into for ProcessNode {
fn into(self) -> type1 {
type1 {some_boilerplate(self)}
}
}
impl Into for ProcessNode {
fn into(self) -> type2 {
type2 {some_boilerplate(self)}
}
}
impl Into for ProcessNode {
fn into(self) -> type3 {
type3 {some_boilerplate(self)}
}
}
impl Into for ProcessNode {
fn into(self) -> type4 {
type4 {some_boilerplate(self)}
}
}
impl Into for ProcessNode {
fn into(self) -> type5 {
type5 {some_boilerplate(self)}
}
}
impl Into for ProcessNode {
fn into(self) -> type6 {
type6 {some_boilerplate(self)}
}
}
Don't write in some insane boilerplate-driven programming language in the first place. Anyone proliferating this kind of duplication (whether with multi-cursors or shell here docs or any other way) should be flogged.Re: VS Code can do that?
#266tbh 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 break…
Don't teach people to program using IDEs if you actually want them to learn how things work.
No. This stance is complete nonsense. People who don't want to learn how things work won't learn either way, but an IDE can at least make them safer and more productive. For people who do, an IDE can magnify your abilities quite a lot. All of which is true for any (decent[1]) tool in any field.
[1] here, have a twitter rant. You're advocating for the Hole Hawg: https://twitter.com/myrrlyn/status/980148201456943104
Re: VS Code can do that?
#267Earlier quoted context omitted.
Why? Not poking at you, just curious.
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?
Re: VS Code can do that?
#268Q: But does it org-mode? A: No. Long A: Org-mode is plain text. So it org-modes, but not in a meaningful way.
Meh, it's nascent, but it's not so underpowered as to be genuinely useless: 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.
Re: VS Code can do that?
#269Earlier quoted context omitted.
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 bloat…
There's an old joke: "Emacs is a great OS, but it lacks a decent text editor." Only vi users are allowed to tell that joke with a straight face, IMHO. Evil-mode solves that, and just as magit is better than git evil-mode seems, to me, better than vi. Emacs is better than ever (though you do need to use auto-formatting for languages like JS that change a lot- there is no emacs mode that has kept up with ES whatever. L…
Re: VS Code can do that?
#270Earlier quoted context omitted.
I recently discovered a vscode extension literally called "Insert Cursor at Beginning of Each Line Selected". Super handy when you want multiple cursors to line up at the start of every line (by default vscode will wrap the cursor around to the end of the longer lines if you try to move around with the arrow keys). There's about 20 other extensions I routinely use, which I documented at https://nickjanetakis.com/blog…
What's this do differently from just pressing Home with multicursors?
Additionally, there is a case where if you don't select the last line until the end, you end up in a state where the last cursor is already at the beginning. If you press "Home" now, you end up having that last cursor at the beginning of the line - and the other ones at the indentation level (see https://github.com/Microsoft/vscode/issues/14919#issuecommen...)
(Disclaimer: Author of the mentioned plugin, so I am heavily biased against my own workflow and saving-keypresses-obsession :P)