Typescript: Visual Studio: Support "Automatic brace completion"

Created on 15 Dec 2014  Â·  38Comments  Â·  Source: microsoft/TypeScript

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.

Automatic brace completion options 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_

Fixed Suggestion Visual Studio

Most helpful comment

Dear anyone who is going to post "+1" in the future!

Please note that Github recently added reactions. Just scroll up to the top and click the little smiley button

Add a reaction

All 38 comments

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.:

  1. /
  2. "
  3. '
  4. (
  5. {
  6. [

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.
bracecompletion

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...

image

+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

+1

+1

With new reactions added to github issues I suggest adding the "+1" to the the main issue to indicate an "up vote"

+1

+1
Also I still do not see split window support ( for ts => js )returned, despite several post saying it was...

@pgorbas were did you see the split window support mentioned? It never was a feature of TypeScript, but part of Web Essentials.

Dear anyone who is going to post "+1" in the future!

Please note that Github recently added reactions. Just scroll up to the top and click the little smiley button

Add a reaction

Wondering if there is an update?

Started with Angular 2 + TypeScript, and really looking for this feature on Visual Studio 2015 (Even not available with latest Update 2).

Thanks a bunch!

@abdu292 I checked in the script side changes, but there needs to be Visual Studio support to make this work, that should be in the next release for TypeScript.

Yeah kind of crazy that this is in code but not enterprise, vs 2015 update 2 just came out and this still isn't there after being in the backlog for almost 2 years.

@brendon-colburn I feel your pain, and that's the reason I stick to pure VS. We're getting some breathing room to spend more time on features, by making improvements to our infrastructure. And hopefully we can publish nightly drops of the VS tools soon.

Interesting. Could you define "pure VS" for me? It's just a nuisance
really, but I felt a need to say something due to the length of time this
has been in backlog status. Not trying to be a nag, I understand that
certain development tasks take priority.

Thanks,

Brendon

On Mon, Apr 18, 2016 at 2:03 PM, Paul van Brenk [email protected]
wrote:

@brendon-colburn https://github.com/brendon-colburn I feel your pain,
and that's the reason I stick to pure VS. We're getting some breathing room
to spend more time on features, by making improvements to our
infrastructure. And hopefully we can publish nightly drops of the VS tools
soon.

—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
https://github.com/Microsoft/TypeScript/issues/1484#issuecomment-211504997

"pure vs" == no extensions like ReSharper etc.

This is nonsense. When are we going to get this?? How hard could it be to implement this???

@VSG24 it's not the work itself, it's just that this will be part of a release. we should have it in TypeScript 2.0, but you'll have to be patient in the mean time.

This is the first feature I turn OFF immediately if the editor does it. I know EXACTLY when and why I will add a closing brace to my code, and I don't need some dumb software appending it for me.

Hopefully this stays WONTFIX forever

Automatic brace completion should be supported with TS 2.0 RC and later. The feature can be enabled/disabled from tools options (as noted in the OP).

Instead of saying won't fix for all the people that want it, wouldnt making it a toggle option be better?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Zlatkovsky picture Zlatkovsky  Â·  3Comments

uber5001 picture uber5001  Â·  3Comments

Antony-Jones picture Antony-Jones  Â·  3Comments

siddjain picture siddjain  Â·  3Comments

bgrieder picture bgrieder  Â·  3Comments