Description
At first I explain you what I would like to do with tsserver. @dbaeumer I think you could be interested with this issue for VSCode and Angular2 support.
Take the sample https://angular.io/docs/ts/latest/quickstart.html with Angular2 & TypeScript. There is a ts file:
import {Component} from 'angular2/angular2';
@Component({
selector: 'my-app'
})
class AppComponent { }
And the HTML:
<my-app></my-app>
The HTML contains <my-app>
which is binded with decorator @Component/selector property. My goal is to provide completion, navigation inside HTML (Eclipse) editor for <my-app>
. In other words, I need to collect the whole @Component/selector node of the project to use it in a HTML editor. I tell me how I could do that:
- with TypeScript language service? Develop a walk kind which loop for each @component decorators? If yes, could you give me some info please to do that.
- after that I will need to provide this new command to tsserver. So it should be very cool if tsserevr could provide the capability to contribute with custom tsserver command (without compiling a custom tsserver).
With ternjs it's possible to write a tern plugin which is able to do that (collect @Component/selector) because:
- ternjs gives the capability to write a tern plugin where you can add your custom function when AST is walked (to help inference engine to create the well type, or collect modules like I have done with Angular Explorer .
- ternjs load tern plugin which follow a name pattern (tern-xxxx) from the node_modules to load it. See https://github.com/ternjs/tern/blob/master/bin/tern#L120
tsserver could do the same thing by searching inside node_modules with a pattern name like tsserver-xxxx
to provide a custom command. After that any editor will be able to consume it just by installing with `npm installl tsserver-angular2'
Hope you will understand my issue.