-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Angular support in editor (done in TypeScript files, TODO in HTML files) #138
Comments
We may try to extract the LS from VSCode like we do for some LS already, but things would be much simple if we manage to get angular/vscode-ng-language-service#317 resolved first. |
wow, I was just going to open an issue exactly for this |
@mickaelistria I had managed angular support inside Eclipse with https://github.com/angelozerr/angular-eclipse It uses tsserver instead of using LSP, but now you have integrated https://github.com/theia-ide/typescript-language-server you should be able to use typescript plugin . The angular project provides a tsserver plugin for angular. To enable it, you must declare it in your tsconfig.json: {
"compilerOptions": {
...
"plugins": [
{ "name": "@angular/language-service"}
]
}
} and install angular/language-service before. See my explanation at https://github.com/angelozerr/angular-eclipse/wiki/New-and-Noteworthy-1.3.0#angular-language-service The TS language server must be executed too for HTML content type too. Never tried, but I think it's the right direction. The VS code ng language service uses the angular language service if I remember. |
@mickaelistria instead of managing plugin inside tsconfig.json, we could do that like you suggest with tslint #110 (comment) |
According to angular/vscode-ng-language-service, they are running a duplicate version of typescript service along with |
Ok. But how is the typescript-language-server going to work with HTML documents? |
Indeed it was the same problem with old vscode-tslint, that's why I had created https://github.com/angelozerr/tslint-language-service which is a typescript plugin and https://www.npmjs.com/package/typescript-tslint-plugin replaces now my project. In other words using @angular/language-service as typescript plugin is the well mean.
It's a very good question and it's one reason why vscode doesn't use directly the angular language service. See angular/vscode-ng-language-service#43 (comment) In my Angular Eclipse project which uses tsserver and angular language service, I call tsserver for js, ts and html files. But it cause troubles if you don't use angular ls. See angelozerr/angular-eclipse#97 To fix this bug, tsserver must fix microsoft/TypeScript#17151 but I'm afraid it's not in the priority of typescript team. |
So how does VSCode provide Angular completion in HTML documents then? |
It doesn't use angular ls directly and use extra code which consumes angular ls. In other words, it doesn't use LSP.
The only ugly mean that I found is to modify the tsserver.js angelozerr/angular-eclipse#97 (comment) In other words we must wait for microsoft/TypeScript#17151 |
Can't we already include support for Angular in the TS files? The typescript-language-server is currently only associated with .js/.ts file so it shouldn't pollute the HTML ones and we may already get some value from Angular support without much trouble. |
Yes like I have done with Angular Eclipse. It should be sam ething than #110 (comment) |
Currently using the @angular/language-service with typescript-language-server only works with typescript files, and executing the language server with html templates reports ts errors. I've opened typescript-language-server/typescript-language-server#104 |
Thanks @yanxi0830 , do you already have the @angular/language-server working in Wild Web Developer? If yes, does it bring enough value in your opinion? If yes, then feel free to submit a PR for that part and we'll take care of the HTML part when upstream issues has a solution or a good workaround. |
@mickaelistria yes, currently it is working with TS files. I'll make a PR soon, although I think this only brings a little value since users can add the @angular/language-server to tsconfig.json in their Angular project if they want to accomplish the same thing. |
I think support out of the box is much nicer than having to tweak some config files. The way tsconfig.json works (user having to care about the tool) is arguable, so if we can be a bit better, that's nice. |
I'm ok with the proposal. It's better to have the latest angular-service than nothing. |
Angular works in TypeScript files, this bug can still be used to track support for ng attributes in HTML files. |
Hello all! Kinda late to the party here, but I've started working on the Angular LS, and I wonder if there's anything I can help. @yanxi0830, could you please share your setup? How do you load |
@kyliau Hello there! If I remember correctly, I integrated through setting via the global plugins which does something like adding |
@kyliau Hi, thanks for coming here. Wild Web Developer includes With both @angular/language-service 7.2.9 and 8.0.0, I get good assistance for Angular components in .ts files, but I see HTML files getting filled with parsing errors, as if they were parsed as TypeScript files, when I let the Language-server/tsserver take care of them. |
I've seen the exact issue (HTML gets parsed as TS) before, but I could no longer reproduce the behavior using TS 3.4.5. What's the TS version that you tested with? Somehow the plugin must tell tsserver to "pass me HTML files in addition to TS". In my setup, I tested with the workspace version of typescript instead of vscode's version. This is the exact tsserver spawn command from the logs:
tldr; I'd first need to reproduce the error before I could fix it .. |
I've locally upgraded to TypeScript 3.5.8, typescript-language-server 0.3.8 and @angular/language-service 8.0.0 and still see the error parsing HTML. The tsserver command is |
@mickaelistria are you sure the node_modules folder was updated with the version you want? |
WIP at https://github.com/mickaelistria/wildwebdeveloper/pull/new/angular , based on new information available at angular/vscode-ng-language-service#375 (comment) |
This was fixed last month. |
Angular provides a language server ( https://github.com/angular/vscode-ng-language-service/tree/master/server ) which is already used by VSCode.
We should try to add this into Wild Web Developer.
The text was updated successfully, but these errors were encountered: