Smart tricks / hacks

Started by
6 comments, last by Servant of the Lord 8 years ago
The other day, I had an error from Lua that it missed an "end" at <EOF>, from a function that started 300 lines up.

My editor knows how to jump to matching parentheses, but it doesn't know how to jump to a matching 'start of statement' from and 'end', so how to solve this?

Then I realized the syntax highlighting colors "end" of a normal statement blue, and "end" of a function yellow, and I could use that to find the point of the missing "end".
So I inserted an "end" at a line at the top-level. If it got colored yellow, I'd be too high, if it got colored blue I'd be too low.
By using this trick I found the missing "end" statement in less than a minute.
Advertisement
(Syntactically significant whitespace languages FTW... Well, at least, most of the time)

My editor knows how to jump to matching parentheses, but it doesn't know how to jump to a matching 'start of statement' from and 'end', so how to solve this?

Get a better editor?

Any competent editor should be able to figure out the beginning/end of a scope in languages with syntactically-significant whitespace these days.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Well, following the thread "When you realize how dumb a bug is"?, we could do a smart substitution and have "When you realize how dumb an editor is"

can't help being grumpy...

Just need to let some steam out, so my head doesn't explode...

I thought it would be fun to exchange clever tricks, but if you want to change it into an editor or language war, be my guest, but I won't play.

I thought it would be fun to exchange clever tricks, but if you want to change it into an editor or language war, be my guest, but I won't play.

Very true, all is just for fun, exchange clever tricks or talking about not so clever editors. All the same jokes mate, no wars, just jokes, absolutely nothing personal

can't help being grumpy...

Just need to let some steam out, so my head doesn't explode...

Lua doesn't even have syntactically significant whitespace :P

which is why it's a decent language ????( º _ º?)

I thought it would be fun to exchange clever tricks, but if you want to change it into an editor or language war, be my guest, but I won't play.

You posted it in the "coding horror" humor section, so I genuinely thought by "clever tricks" you jokingly meant bad tricks or tricks to work around bad tools.

That's why other posters mentioned turning it into a joking thread of mistakes their favorite editors make - not an editor war trying to claim which is best.

This topic is closed to new replies.

Advertisement