Open jibbers42 opened 7 years ago
In a quoted string? Could you please provide more details or code snippet for you scenario?
Reading it again, "quoted string" is confusing wording - I just meant when typing within quotes. From angular example code...
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `
<h1>{{title}}</h1>
<nav>
<a routerLink="/dashboard" routerLinkActive="active">Dashboard</a>
<a routerLink="/heroes" routerLinkActive="active">Heroes</a>
</nav>
<router-outlet></router-outlet>
`,
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'Tour of Heroes';
}
/*
Copyright 2017 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/
It would be nice if tag auto close only happened within quotes, for example in the template
section in the example code. Currently, angle brackets cause a completion when using generics within the AppComponent
class (not shown).
This is a pretty minor use case since you would probably put any templates of size into a dedicated html file instead of inline as shown above. For now I've just removed typescript from the active languages setting.
@jibbers42 Only closing inside of a template literal (backtick string) in typescript may what you are looking for. Is there a case when plain single quote or double quoted strings in typescript should be considered as html to be auto-closed?
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
Yeah, I think that would work out well. Is that something that can enabled now?
Not that I know of, just a suggestion for what an implementation of a code change should look for, IMHO.
Working in a language like typescript causes false tag closes when coding generics. A new setting that restricts closes to only when typing in a quoted string would allow users to keep this feature enabled with far less false closes. Coding angular inline templates is an example of where this might be used.
Edit: I'm not sure what information the extension environment provides. Maybe there is a better way, such as knowing you're in a generic - or something similar.