Visual Studio: Support "Automatic brace completion"
In Visual Studio if you go into the options for TypeScript(Tools > Options > Text Editor > TypeScript > General) the "Automatic brace completion" option is grayed out.

I was wondering why this is and if there is any way to turn this on.
Visual Studio Version: Visual Studio Express 2013 for Web v12.0.31101.00 Update 4
OS: *Windows 8.1
We don't currently support this feature in visual studio. It is on our backlog though.
@CyrusNajmabadi May I ask why? At least with my limited knowledge it seams that the brace completion would be similar to JavaScript's brace completion.
However I imagine there is probably a very good reason why it is not enabled
It was simply a matter of schedule and resources. Features are never really free, and this one simply hasn't made the cut so far. One issue is that this is a synchronous blocking feature that depends on needing to properly syntactically understand your code. Right now there are some limitations in our architecture that makes that hard. We could provide support for this, but its likely the performance would not be good enough and t the experience could feel chunky in large files.
Until we can provide the feature with great performance, I'm holding off on this.
Fortunately, we're making several architectural improvements that should make this more feasible in the next year.
Any updates on this?
This is still on our backlog at the moment.
I need this feature wow.
+1
+1
Tho resharper adds the feature, I would preffer using vanilla studio when using pure JS code. +1
+1
For those talking about resharper, could you let me know what they do with something like this:
var foo = 0;
var v = foo<
as well as
function foo<T>(t: T) { }
var v = foo<
In the first example, you should not get automatic completion as you are typing an arithmetic expression. in the latter, you should, because you're typing generic type arguments.
However, to do this properly, you need both your syntax tree up to date, and you need your semantics to be accurate as well (so you can tell what 'foo' means). Getting that correct is easy. Getting it correct and fast is very very hard. And this feature needs to be fast as it interacts with typing in a blocking fashion.
Of course, we could just not have auto-completion on <. However, even for the other cases, i.e.:
- /
- "
- '
- (
- {
- [
We'd still need fairly accurate syntactic understanding of your file to ensure that we didn't, for example, autocomplete these guys inside a comment or a string.
@mhegazy If you did this, i'd actually recommend a dedicated thread just for this feature. Because it needs to be synchronous, but is also involved with typing it really needs to be uninterrupted when it runs. If you avoid completion on < then you don't need semantics and you can just have another syntactic thread.
@mhegazy If you did this, i'd actually recommend a dedicated thread just for this feature. Because it needs to be synchronous, but is also involved with typing it really needs to be uninterrupted when it runs. If you avoid completion on < then you don't need semantics and you can just have another syntactic thread.
how about using the formatting thread? all these trigger characters are not formatting trigger characters, so we know the thread will be likely idle.
@mhegazy Ah, I think you're right. None of the characters should overlap. And because they're all synchronous, we'll essentially only ever have one in the queue at a time, so we don't have to worry about bottlenecks. So that thread should be a good choice here.
Many requests for this feature are coming from folks who use text editors that have nowhere near enough understanding of the code to be 100% correct in their completion behavior. Let's not let the perfect be the enemy of the good.
In Sublime < is not completed. Most of the others characters are completed in any non-string context. The closing element is skipped over when you type the closing element. It's immensely useful and the kind of feature that seems like a 'nice to have' for those who aren't used to it but an actual adoption blocker for people who are used to it.

See https://github.com/Microsoft/TypeScript-Sublime-Plugin/issues/95
Let's not let the perfect be the enemy of the good.
Agreed. I think we can just forget about < for now.
This is really a great feature, nice to have it. It could improvement productivity.
As I install visual studio code, and vs code have typescript auto brace, why didn't VS2015 didin't have...

+1 Any update on this issue? it's a little annoying having to close every brace manually
+1 But guys please don't shout like "I pay money give me what I want". Still a young product, many features are requested...
+1