Skip to content

Conversation

@RyanCavanaugh
Copy link
Contributor

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x")

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior? (You can also link to an open issue here)
No language service for the new TypeScript plugin model exists

What is the new behavior?
A language service for the new TypeScript plugin model exists

Does this PR introduce a breaking change? (check one with "x")

[ ] Yes
[x] No

Other information:

Commits in this PR:

  • Add some null checking: Additional diagnostics
  • Avoid crashing in certain situations: Null checks were missing in a few places
  • Port ts2.1 compat fixes from Chuck: Patches from @chuckjaz to make things cross-compatible with TS2.0 and TS2.1
  • Support new plugin model from TypeScript: New proxy LS plugin model
  • 'create' method from LS module: Expose the plugin factory function from the language-service module

When the corresponding PR microsoft/TypeScript#12231 goes in, the following workflow will be enabled:

  • Clone angular/quickstart
  • Add "plugins": [{ "name": "@angular/language-service" }, }] to tsconfig.json
  • npm install --save-dev @angular/language-service
  • 🎉 Completions, go-to-def, diagnostics, and hover info appear in VS Code and other tsserver-based plugins

@RyanCavanaugh RyanCavanaugh changed the title Ls fixes Support TypeScript plugin extensibility model for Language Service features Dec 30, 2016
Copy link
Contributor

@chuckjaz chuckjaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please squash changes into one or two changes that describe the change and make logical sense.

Please change the commit messages to conform to https://github.com/angular/angular/blob/master/CONTRIBUTING.md (e.g. refactor(compiler): check invalid parameters, feat(language-service): support TypeScript 2.2 plugin model.)

Please fix the tslint error reported in CI.

Consider converting the tests in ts-plugin.spec.ts to using the new plugin.
Consider removing the old plugin.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why throw here? Is this left-over debugging code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

@RyanCavanaugh
Copy link
Contributor Author

@chuckjaz thanks for review - pushed up a fresh commit

Copy link
Contributor

@chuckjaz chuckjaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good. However we are particular about the commit message slugs because we use an automated process to add the into the change log.

Please change your commit message to "feat(language-service): support TS2.2 plugin model" (note the lower case in "support").

@RyanCavanaugh
Copy link
Contributor Author

Done

@chuckjaz chuckjaz added action: merge The PR is ready for merge by the caretaker pr_state: LGTM labels Jan 9, 2017
@matsko
Copy link
Contributor

matsko commented Jan 9, 2017

Landed as 99aa49a

@matsko matsko closed this Jan 9, 2017
@cyrilletuzi
Copy link
Contributor

cyrilletuzi commented Jan 21, 2017

Do we agree it's landed in 4.0.0-beta.3 but still not usable, as we're waiting for microsoft/TypeScript#12231, even with last typescript@next ? Or is there a way to already test that (seems strange that the PR has been merged without testing) ?

@chuckjaz
Copy link
Contributor

I agree it is a bit strange but one of them had to be first. This code replaces previous plug-in specific code that was based on a previous TypeScript plug-in proposal.

The TypeScript plug-in has unit tests and the @angular/language-service is, itself, is usable in as part of a vscode plugin (https://github.com/angular/vscode-ng-language-service/).

@cyrilletuzi
Copy link
Contributor

Thanks (it wasn't to criticize, just to check I didn't miss something, because it's a long awaited feature that will help people a lot in my courses)

@cyrilletuzi
Copy link
Contributor

microsoft/TypeScript#12231 has been merged ! Does this mean we can finally use @angular/language-service directly from tsconfig.json ?

@chuckjaz
Copy link
Contributor

This should work in nightly but I haven't added CI tests yet to verify that it continues to work with out latest builds.

@cyrilletuzi
Copy link
Contributor

For info, I tried with yesterday and today nightly, and last stable version of @angular/language-service (2.4.7). Can't get it work, but no errors from tsserver.

@RyanCavanaugh
Copy link
Contributor Author

I've got some sample / documentation repos up you can try.

https://github.com/RyanCavanaugh/angular2-seed
https://github.com/RyanCavanaugh/sample-ts-plugin

(Note: about to head out on vacation for 2 weeks with no internet access, so... hopefully you can get them to work!)

@cyrilletuzi
Copy link
Contributor

cyrilletuzi commented Feb 17, 2017

@RyanCavanaugh is there anything specific except "plugins": [ { "name": "@angular/language-service"} ] in tsconfig.json ? Because I have the exact same config and versions, and I don't get any completion in VS Code.

@RyanCavanaugh
Copy link
Contributor Author

@cyrilletuzi you'll also need the VS Code workspace settings to enable loading the local version of the language service

@cyrilletuzi
Copy link
Contributor

Problem was the version of @angular/language-service. Works with 4.0.0-beta.3 (as in angular-seed) and last beta 4.0.0-beta.8. But not with 4.0.0-beta.7 and not with 2.4.x.

HerringtonDarkholme referenced this pull request in mhartington/nvim-typescript Apr 11, 2017
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker cla: yes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants