Live data from Hacker News

Tern – Intelligent JavaScript editing

ternjs.net

21–30 of 82 posts

Re: Tern – Intelligent JavaScript editing

#21

I find most of these attempts to code-completion in JS to be annoying, like bad speech recognition, if the accuracy is poor, it becomes frustrating. Not to knock their attempt, but I find that if codeassist isn't like 98% accurate, it often becomes more work to step through all of the wrong entries and not find what I want, then to just type it out. The closest I've seen to something that works well is IntelliJ IDEA…

The newest PyCharm uses an interesting dynamic approach. You can run your app in their debugger and enable collecting of type parameter info (at a significant performance loss, however).

So when you have a function like: def foobarize(f): return f.something *2; then it will know what types f might have when foobarize is called. Now when you go back into the editor, it can give you a hint about it.

Other than that, it uses some type hints from docstrings (you can tell it type foo is YourClass and it will complete based on that) and light type guessing.

Re: Tern – Intelligent JavaScript editing

#22
post #6
post #5

Earlier quoted context omitted.

Working fine on Chrome 24 on Linux/x64.

The browser tab hangs on Chromium 24.0.1312.56 on Kubuntu 12.10 (when typing [[[[).

Weird, I'm on almost the exact same version (24.0.1312.57) and it does nothing when typing any number of '['. I have the branded version of Chrome, though, but still, weird!

Re: Tern – Intelligent JavaScript editing

#23
It might sound like an abomination, but Visual Studio is apart from obv. being excellent in C++/C# also a very pleasant IDE for Javascript, Python or even PHP!

In fact i have been an "texteditor-only" type in the past, but coding C# in Visual Studio has really been a revelation for me.

Re: Tern – Intelligent JavaScript editing

#25
post #22
post #6

Earlier quoted context omitted.

The browser tab hangs on Chromium 24.0.1312.56 on Kubuntu 12.10 (when typing [[[[).

Weird, I'm on almost the exact same version (24.0.1312.57) and it does nothing when typing any number of '['. I have the branded version of Chrome, though, but still, weird!

The problem is fixed now, so the fact that it works shouldn't come as a surprise.

Re: Tern – Intelligent JavaScript editing

#26
post #23

It might sound like an abomination, but Visual Studio is apart from obv. being excellent in C++/C# also a very pleasant IDE for Javascript, Python or even PHP! In fact i have been an "texteditor-only" type in the past, but coding C# in Visual Studio has really been a revelation for me.

I know. I was blown away by VS when I was researching what others were doing in this space. Their approach is also very clever -- there's an interesting talk about it at http://channel9.msdn.com/Events/TechEd/NorthAmerica/2012/DEV...

Re: Tern – Intelligent JavaScript editing

#27
post #15

I find most of these attempts to code-completion in JS to be annoying, like bad speech recognition, if the accuracy is poor, it becomes frustrating. Not to knock their attempt, but I find that if codeassist isn't like 98% accurate, it often becomes more work to step through all of the wrong entries and not find what I want, then to just type it out. The closest I've seen to something that works well is IntelliJ IDEA…

If you're using completion to verify that a thing has the type you thought it has, then yes, Tern won't help you much. If you're using it to save keystrokes, it certainly will. Slightly related, I'm working on a feature where it distinguishes wild guesses from probably correct information by showing a different icon in the completion list.

I love autocompletion (even when it is half working, like intellij when the inheritance marking annotations don't always follow through, my cleverly optimized jsdoc markup for backbone and co broke down when switching to idea12). It saves me so much time looking stuff up and APIs, and if it can indicate the number and name of arguments required, i usually don't have to use the docs anymore.

And M-./find usages is very useful too, even when it is not perfect.

I pledged, and hope you will get enough funds together.

Re: Tern – Intelligent JavaScript editing

#28
Looks cool! How do you gauge the difficulty of adding support for CoffeeScript to this?

Re the indiegogo campaign: I think you should consider adding an extra supporter tier between 25 USD and 1000 USD. The 200 USD tier of CoffeeScript Redux http://www.kickstarter.com/projects/michaelficarra/make-a-be... brought in over 20% of the total amount pledged.

Re: Tern – Intelligent JavaScript editing

#29
post #23

It might sound like an abomination, but Visual Studio is apart from obv. being excellent in C++/C# also a very pleasant IDE for Javascript, Python or even PHP! In fact i have been an "texteditor-only" type in the past, but coding C# in Visual Studio has really been a revelation for me.

"In fact i have been an "texteditor-only" type in the past, but coding C# in Visual Studio has really been a revelation for me."

The fact that application X is "just a text editor" is not a justification for X having poor editing functions. In fact, you'd expect a specialized text editor to have better editing functions that an IDE, since an IDE can have other selling points, such as an integrated build system, a version manager, a profiler or a debugger, whereas an editor can only impress you solely by its usability for...well, editing.

Re: Tern – Intelligent JavaScript editing

#30
post #28

Looks cool! How do you gauge the difficulty of adding support for CoffeeScript to this? Re the indiegogo campaign: I think you should consider adding an extra supporter tier between 25 USD and 1000 USD. The 200 USD tier of CoffeeScript Redux http://www.kickstarter.com/projects/michaelficarra/make-a-be... brought in over 20% of the total amount pledged.

Interesting. Their 200 dollar tier is basically my 'all backers' tier (name in a readme file). But I can probably come up with something slightly more valuable to offer at ~250€.

As for CoffeeScript support -- the only major piece missing there is an error-tolerant CoffeeScript parser. Given that, one could simply run the CoffeeScript compiler over code, and analyze the output. There'd be some shuffling with source maps needed to translate source locations in the various representations of the code, but that's a solved problem. Well, and of course you might see some translation artifacts. The CS output code is semantically close to the input, but there are differences.

Post reply on HN