Skip to content

Contribute TypeScript repositories via an extension point #138

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

Merged

Conversation

lorenzodallavecchia
Copy link
Contributor

The embedded TypeScript and TSLint installations are retrieved directly from the ts.repository bundle (from root and archives subdir), making the mechanism completely hard-coded.

This makes it difficult or impossible to

  • deploy typescript.java without the embedded modules,
  • contribute modules in other way, for example because one needs a different version or wants to share with other Eclipse plugins.

This change introduces an extension point, similar to the one for Node.js installations. An extension can contribute one or more repositories, each containing TypeScript and TSLint. The default repository is choosen to be the one with the highest TypeScript version.

@angelozerr
Copy link
Owner

@lorenzodallavecchia have you seen that you can choose your TypeScript version with project preferences?

@lorenzodallavecchia
Copy link
Contributor Author

Yes I know about that possibility. In this case, however, I need to affect the available Embedded TypeScript options, not just change the default.

As you may have guessed, I am integrating typescript.java into a larger Eclipse-based product along with other plugins. Since I am already bundling TypeScript for my own needs, I did not like to have to include it twice (one inside ts.repository and one inside my own plugin), nor I wanted to access ts.repository directory from the bundle registry.
With an extension point I can remove ts.repository completely and have my own plugin also contribute to TypeScript.

@@ -222,4 +218,50 @@ public static void fixEmbeddedPreference(IEclipsePreferences preferences) {
}
}
}

Copy link
Owner

@angelozerr angelozerr Feb 1, 2017

Choose a reason for hiding this comment

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

I think it should b ebetter to create a new class IDETypeScriptRepositoryManager which extends TypeScriptRepositoryManager which consume your extension point, no?

Copy link
Owner

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have a doubt. There is already a TypeScriptRepositoryManager, but it currently has a "passive" role (the preference initializer populates it from the outside). Would you keep it that way and create a new different manager, or evolve it to auto-populate with TS repositories?

Personally I would go with the second option (evolving it), also making it similar to NodejsInstallManager.

Copy link
Owner

Choose a reason for hiding this comment

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

Sorry for my too quick comments. Please re-read my propistion with IDETypeScriptRepositoryManager. TypeScriptRepositoryManager must not be linked to Eclipse (core folder could be consumed with other IDE)

The default repository is chosen to be the one with the highest version.
All others are treated as archives.
@lorenzodallavecchia lorenzodallavecchia force-pushed the pr/repositories-extension-point branch from 26605d0 to eaf29c7 Compare February 1, 2017 15:54
@angelozerr angelozerr merged commit ed254df into angelozerr:master Feb 1, 2017
@angelozerr
Copy link
Owner

Thanks so much @lorenzodallavecchia !

@angelozerr angelozerr added this to the 1.2.0 milestone Feb 1, 2017
@lorenzodallavecchia lorenzodallavecchia deleted the pr/repositories-extension-point branch February 2, 2017 07:51
@angelozerr
Copy link
Owner

@lorenzodallavecchia I'm inegrating tslint by developping a TypeScript 2.3 plugin (not available for the moment), but I have found an hack to enable it (like angular2 language service).

The cool thing is that with my TypeScript 2.3 plugin, tslint is really well integrated with tsserver (the ts file is not parsed twice (once for completion, once for tslint), error appears when compile is done, (eclipse marker) and quick fixes starts working.

But I need to:

  • add in the repository my tslint plugin language service
  • update tsserver.js by adding a JS to load TypeScript 2.3 plugins

If you are interested with those features, I think we should discuss together about that (how to contribute to repository with new modules like tslint language service, etc) in order to you benefit with my tslint.

If you are interested with tslint, I will create a new issue to discuss about "how to contribute to repository with new module".

@lorenzodallavecchia
Copy link
Contributor Author

Hi @angelozerr thanks for querying me on this. I hope the extension point change does not cause too much trouble in evolving typescript.java!

As long as the solution is based on extension points it should be OK for me.
The part about changing tsserver.js looks a little hacky though. I don't know much about TS plugins: is that the only way for integrating them?

For the moment I am not using tslint, but I plan to integrate it in our workflow in the future. So yes, I am interested in collaborating on this feature. :)

@angelozerr
Copy link
Owner

The part about changing tsserver.js looks a little hacky though.

I have found an elegant solution. Please wait that I finish to commit https://github.com/angelozerr/tsserver-plugins

For the moment I am not using tslint, but I plan to integrate it in our workflow in the future. So yes, I am interested in collaborating on this feature. :)

Ok, here a demo with Angular2 & tslint integration:

angular2demo

Hope you will like it:

@lorenzodallavecchia
Copy link
Contributor Author

Amazing!
The way it understand about Angular templates is remarkable!

@angelozerr
Copy link
Owner

The way it understand about Angular templates is remarkable!

It's not my work but google& &microsoft work. Indeed it's amazing!

The tslint integration is my work. It uses microsoft/TypeScript#11976 which will be available in th efuture version of TypeScript but I have found a mean to consume those plugins with any version of TypeScript with https://github.com/angelozerr/tsserver-plugins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants