-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Transpile theia to ES2017 #9436
Transpile theia to ES2017 #9436
Conversation
@sgraband feel free to use the following commit to address the issues you were mentioning with The The |
packages/workspace/src/browser/workspace-variable-contribution.ts
Outdated
Show resolved
Hide resolved
Also, what about the following configuration? theia/dev-packages/application-manager/src/generator/webpack-generator.ts Lines 177 to 196 in 61200ef
It transpiles some ES6 dependencies down to ES5, but those should no longer be required right? |
c79a1f6
to
e2bf52d
Compare
I tested the support for es5 theia plugins. It is working as intended. I noticed that it is enough to apply the @paul-marechal could you do a final review please? I will set this PR as ready for review. |
I noticed a couple of classes not decorated by theia/packages/plugin-ext/src/plugin/types-impl.ts Lines 1478 to 1479 in bede031
theia/packages/plugin-ext/src/plugin/types-impl.ts Lines 1577 to 1578 in bede031
theia/packages/plugin-ext/src/plugin/types-impl.ts Lines 1599 to 1600 in bede031
theia/packages/plugin-ext/src/plugin/types-impl.ts Lines 1778 to 1779 in bede031
theia/packages/plugin-ext/src/plugin/types-impl.ts Lines 2301 to 2302 in bede031
theia/packages/plugin-ext/src/plugin/types-impl.ts Lines 2336 to 2337 in bede031
theia/packages/plugin-ext/src/plugin/types-impl.ts Lines 2347 to 2348 in bede031
theia/packages/plugin-ext/src/plugin/types-impl.ts Lines 2376 to 2377 in bede031
theia/packages/plugin-ext/src/plugin/types-impl.ts Lines 2389 to 2390 in bede031
theia/packages/plugin-ext/src/plugin/types-impl.ts Lines 2568 to 2569 in bede031
theia/packages/plugin-ext/src/plugin/types-impl.ts Lines 2578 to 2579 in bede031
theia/packages/plugin-ext/src/plugin/types-impl.ts Lines 2590 to 2591 in bede031
|
Good Catch! They were missing because these classes are not part of the vscode API, which i looked at first. However, it is probably a good idea to decorate all the classes to ensure compatibility with plugins, that use the theia specific classes. I pushed my changes (which should also solve the build issues). |
Rebased to master and added entry to changelog. |
CI is red, please fix :) |
776b81b
to
200b7e4
Compare
CI is still failing. Feel free to ask a committer that would be in your timezone to approve and run the CI for you in order to make the feedback loop shorter, or run the tests locally before pushing. |
b64ecb9
to
5e5f6e1
Compare
I fixed the error in the CI. The error that is currently happening seems to be unrelated to my changes, as the master build has the same error. |
I've been looking at the generated ES6 code and it looks mostly good! I am only slightly bothered by the output for async functions. When targeting ES6, TypeScript will output things like: // source
async function test() {
await 1
} // generated ES6 (ES2015)
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
function test() {
return __awaiter(this, void 0, void 0, function* () {
yield 1;
});
} We currently target Node 12.14.1 which supports at least ES2017 and native async/await notation. Since we share the same configuration between backend and frontend it means outputting native async/await would have to be supported in browsers to. Using ES2017 gives: // generated ES2017
"use-strict";
async function test() {
await 1;
} Thankfully it looks like most browsers/users support this: https://caniuse.com/async-functions We also already expect the browser to support WebAssembly which is supposedly "newer" than async/await support:
I think we should at least target ES2017. The biggest breaking change happened when new style classes got introduced. Since then most things look backward-compatible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! @eclipse-theia/core?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as well. Couldn't notice any regression on browser or electron (Ubuntu+Windows).
CHANGELOG.md
Outdated
@@ -15,6 +15,7 @@ | |||
- [core] added support for `resourceDirName` and `resourcePath` context keys [#9499](https://github.com/eclipse-theia/theia/pull/9499) | |||
- [core] added support for a unique id for non-command toolbar items [#9586](https://github.com/eclipse-theia/theia/pull/9586) | |||
- [core] fixed incorrectly wrapped disposable [#9376](https://github.com/eclipse-theia/theia/pull/9376) | |||
- [core] transpile theia to es6 [#9436](https://github.com/eclipse-theia/theia/pull/9436) - Contributed on behalf of STMicroelectronics |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: As 1.15 was released last month, this should probably be removed.
I'm just wondering what the impact of the change on adopters will be. Will they have to update their build story as well? Maybe a good topic for the community call. |
@tsmaeder we tested this with a theia template from the yeoman generator and there is no need for adopters to change their build story. If for some reason they still need an es5 codebase they should be able to transpile back to es5 using webpack. I am not quite sure if this is really a use case and if we should add this to the breaking changes section in the changelog? |
Yes. As I mentioned in the dev meeting last week, we use some |
CHANGELOG.md
Outdated
@@ -56,6 +56,7 @@ | |||
<a name="breaking_changes_1.16.0">[Breaking Changes:](#breaking_changes_1.16.0)</a> | |||
|
|||
- [callhierarchy] `CurrentEditorAccess` is deprecated. Use the version implemented in the `editor` package instead. The services in `call-hierarchy` that previously used the local `CurrentEditorAccess` no longer do [#9681](https://github.com/eclipse-theia/theia/pull/9681) | |||
- [core] moved from ES5 to ES2017 [#9436](https://github.com/eclipse-theia/theia/pull/9436) - Contributed on behalf of STMicroelectronics |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be placed under 1.17.0 breaking changes now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we have a migration guide, how about adding a section on what adopters will have to do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I placed the changelog entry in the 1.17.0 breaking changes. However, i am not sure what you mean with the migration guide? Should i add more information to the changelog? If yes, what information would you expect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sgraband you forgot to remove the old entry under 1.16.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed the old changelog entry.
4d283b8
to
d036518
Compare
I added an entry to the migration guide and rebased to master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code changes look good to me, I did not notice any regressions when testing (verified inversify
and phosphor
as well) 👍
d036518
to
3cafe5a
Compare
Is there anything else to do? Or can this be merged? |
Let's bring that up during the dev meeting tomorrow and merge after that if there's no objections. |
@sgraband can you rebase? If CI is green after that and you don't notice anything while running then I think it is fine to merge! |
Transpiles theia to ES2017. To keep support of es5 based vscode extensions, the @es5ClassCompat tag was used. The tag was also applied to be used with theia es5 plugins. Contributed on behalf of STMicroelectronics Signed-off-by: Simon Graband <sgraband@eclipsesource.com> Co-authored-by: Paul Maréchal <paul.marechal@ericsson.com>
3cafe5a
to
552df8f
Compare
I rebased and could not find any regressions. Could someone approve the workflow? |
What it does
This is is a PR for transpiling Theia to ES2017. To continue supporting es5 based VSCode extensions, the
@es5ClassCompat
tag was used.The tag was also applied to be used with Theia es5 plugins.
We would like to gather feedback while tackling the remaining issues, so feel free to comment on this PR!
Open issues:
@es5ClassCompat
tag is not working for all of the classes intypes-impl.ts
.The tag is failing on
Location
andDiagnosticRelatedInformation
because of anCannot access Location before its initialization
errorApplying the tag to
CodeLens
,TreeItem
,ProgressExecution
,ShellExecution
andDebugAdapterExecutable
will result in aCan't resolve @theia/plugin ERROR
.phosphorjs
andinversifyjs
, however we could not find any regressions while testing. This may need some further research.Contributed on behalf of STMicroelectronics
Signed-off-by: Simon Graband sgraband@eclipsesource.com
How to test
To test the support for es5 VSCode extensions, you can try out one of the extensions described here: microsoft/vscode#68698.
Review checklist
Reminder for reviewers