You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add Angular support in editor (done in TypeScript files, TODO in HTML files) #138
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.
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.
According to angular/vscode-ng-language-service, they are running a duplicate version of typescript service along with @angular/language-service.
So I think the result of using a separate angular language server would be equivalent to adding angular/language-service plugin for tsserver as @angelozerr have suggested. I think it would be easiest to take the plugins approach as a similar thing is involved with tslint.
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.
It's a very good question and it's one reason why vscode doesn't use directly the angular language service.
So how does VSCode provide Angular completion in HTML documents then?
Our last experiments show the exact same issue as angelozerr/angular-eclipse#97 . Do you know how to work around it?
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.
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.
Moreover, it allows us to start checking the buzzword bingo line "Angular support out-of-the-box" and try to fish some new users with it ;)
I'm ok with the proposal. It's better to have the latest angular-service than nothing.
If someone need a specific angular-service for a project, we can open a new issue and work on specific integration.
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 @angular/language-service?
Based on what I've read about tsserver plugin so far, I wrote a summary here. Would very much welcome additional inputs/suggestions. Thank you!
@kyliau Hi, thanks for coming here.
FYI, @yanxi0830 is not working on Wild Web Developer any more, but the project still have high interest in improving Angular support.
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.
Is there a dedicated ticket to track this issue in @angular/language-service?
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".
From the setup you mentioned, I couldn't think of any places this is done other than the getExternalFiles() call to the @angular/language-service.
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:
@mickaelistria are you sure the node_modules folder was updated with the version you want?
See #170 (comment) for some explanations about update to new version of dependencies through npm.
changed the title [-]Add Angular support (done in TypeScript files, TODO in HTML files)[/-][+]Add Angular support in editor (done in TypeScript files, TODO in HTML files)[/+]on Aug 2, 2019
Activity
mickaelistria commentedon Mar 1, 2019
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.
emvidi commentedon Mar 1, 2019
wow, I was just going to open an issue exactly for this
:)
angelozerr commentedon Mar 1, 2019
@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.
angelozerr commentedon Mar 2, 2019
@mickaelistria instead of managing plugin inside tsconfig.json, we could do that like you suggest with tslint #110 (comment)
yanxi0830 commentedon Mar 4, 2019
According to angular/vscode-ng-language-service, they are running a duplicate version of typescript service along with
@angular/language-service.So I think the result of using a separate angular language server would be equivalent to adding
angular/language-serviceplugin for tsserver as @angelozerr have suggested. I think it would be easiest to take the plugins approach as a similar thing is involved with tslint.mickaelistria commentedon Mar 4, 2019
Ok. But how is the typescript-language-server going to work with HTML documents?
angelozerr commentedon Mar 4, 2019
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.
mickaelistria commentedon Mar 11, 2019
So how does VSCode provide Angular completion in HTML documents then?
Our last experiments show the exact same issue as angelozerr/angular-eclipse#97 . Do you know how to work around it?
angelozerr commentedon Mar 11, 2019
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
mickaelistria commentedon Mar 12, 2019
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.
angelozerr commentedon Mar 12, 2019
Yes like I have done with Angular Eclipse. It should be sam ething than #110 (comment)
yanxi0830 commentedon Mar 15, 2019
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
mickaelistria commentedon Mar 15, 2019
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.
yanxi0830 commentedon Mar 15, 2019
@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.
mickaelistria commentedon Mar 15, 2019
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.
Moreover, it allows us to start checking the buzzword bingo line "Angular support out-of-the-box" and try to fish some new users with it ;)
jabby commentedon Mar 17, 2019
I'm ok with the proposal. It's better to have the latest angular-service than nothing.
If someone need a specific angular-service for a project, we can open a new issue and work on specific integration.
mickaelistria commentedon May 3, 2019
Angular works in TypeScript files, this bug can still be used to track support for ng attributes in HTML files.
[-]Add Angular support[/-][+]Add Angular support (done in TypeScript files, TODO in HTML files)[/+]kyliau commentedon Jun 3, 2019
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
@angular/language-service?Based on what I've read about tsserver plugin so far, I wrote a summary here. Would very much welcome additional inputs/suggestions. Thank you!
yanxi0830 commentedon Jun 4, 2019
@kyliau Hello there! If I remember correctly, I integrated through setting via the global plugins
initializationOptionshere https://github.com/eclipse/wildwebdeveloper/blob/master/org.eclipse.wildwebdeveloper/src/org/eclipse/wildwebdeveloper/jsts/JSTSLanguageServer.java#L48which does something like adding
--pluginProbeLocationsargument while initializing the server.mickaelistria commentedon Jun 4, 2019
@kyliau Hi, thanks for coming here.
FYI, @yanxi0830 is not working on Wild Web Developer any more, but the project still have high interest in improving Angular support.
Wild Web Developer includes
@angular/language-service7.2.9 (and I also tried with 8.0.0) as you can see in https://github.com/eclipse/wildwebdeveloper/blob/master/org.eclipse.wildwebdeveloper/language-servers/package-lock.json#L8 ; this plugin is passed as aninitializationOptionto https://github.com/theia-ide/typescript-language-server which then passes it to tsserver both as a--globalPluginsand--pluginProbeLocations(see https://github.com/theia-ide/typescript-language-server/blob/6faea64ba5b0c748601197fa4db309e83b838fb0/server/src/lsp-server.ts#L108 and then https://github.com/theia-ide/typescript-language-server/blob/9addd3b5c97f553503b4ae1338c51ef2f7a84883/server/src/tsp-client.ts#L96 ).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.
Is there a dedicated ticket to track this issue in @angular/language-service?
kyliau commentedon Jun 4, 2019
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".
From the setup you mentioned, I couldn't think of any places this is done other than the
getExternalFiles()call to the@angular/language-service.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 ..
mickaelistria commentedon Jun 5, 2019
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
/usr/bin/node /home/mistria/git/wildwebdeveloper/org.eclipse.wildwebdeveloper/language-servers/node_modules/typescript/lib/tsserver.js --globalPlugins @angular/language-service,typescript-plugin-css-modules,typescript-lit-html-plugin --pluginProbeLocations file:/home/mistria/eclipse-SDK/../git/wildwebdeveloper/org.eclipse.wildwebdeveloper/language-servers/node_modules/@angular/language-service/,file:/home/mistria/eclipse-SDK/../git/wildwebdeveloper/org.eclipse.wildwebdeveloper/language-servers/node_modules/typescript-plugin-css-modules/,file:/home/mistria/eclipse-SDK/../git/wildwebdeveloper/org.eclipse.wildwebdeveloper/language-servers/node_modules/typescript-lit-html-plugin/ --cancellationPipeName /tmp/a87f2fc895baf8159915072680a39ce3/tscancellation*jabby commentedon Jun 5, 2019
@mickaelistria are you sure the node_modules folder was updated with the version you want?
See #170 (comment) for some explanations about update to new version of dependencies through
npm.[-]Add Angular support (done in TypeScript files, TODO in HTML files)[/-][+]Add Angular support in editor (done in TypeScript files, TODO in HTML files)[/+]mickaelistria commentedon Sep 2, 2019
WIP at https://github.com/mickaelistria/wildwebdeveloper/pull/new/angular , based on new information available at angular/vscode-ng-language-service#375 (comment)
mickaelistria commentedon Nov 29, 2019
This was fixed last month.