Skip to content

Commit

Permalink
Transpile theia to ES6
Browse files Browse the repository at this point in the history
  • Loading branch information
sgraband committed Apr 27, 2021
1 parent b722e4d commit 7327b85
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 13 deletions.
2 changes: 1 addition & 1 deletion configs/base.tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"resolveJsonModule": true,
"module": "commonjs",
"moduleResolution": "node",
"target": "es5",
"target": "es6",
"jsx": "react",
"lib": [
"es6",
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/browser/navigatable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ export namespace NavigatableWidget {
return arg instanceof BaseWidget && Navigatable.is(arg);
}
export function* getAffected<T extends Widget>(
widgets: IterableIterator<T> | ArrayLike<T>,
widgets: Iterable<T>,
context: MaybeArray<URI>
): IterableIterator<[URI, T & NavigatableWidget]> {
const uris = Array.isArray(context) ? context : [context];
return get(widgets, resourceUri => uris.some(uri => uri.isEqualOrParent(resourceUri)));
}
export function* get<T extends Widget>(
widgets: IterableIterator<T> | ArrayLike<T>,
widgets: Iterable<T>,
filter: (resourceUri: URI) => boolean = () => true
): IterableIterator<[URI, T & NavigatableWidget]> {
for (const widget of widgets) {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/browser/saveable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ export namespace SaveableWidget {
export function is(widget: Widget | undefined): widget is SaveableWidget {
return !!widget && 'closeWithoutSaving' in widget;
}
export function getDirty<T extends Widget>(widgets: IterableIterator<T> | ArrayLike<T>): IterableIterator<SaveableWidget & T> {
export function getDirty<T extends Widget>(widgets: Iterable<T>): IterableIterator<SaveableWidget & T> {
return get(widgets, Saveable.isDirty);
}
export function* get<T extends Widget>(
widgets: IterableIterator<T> | ArrayLike<T>,
widgets: Iterable<T>,
filter: (widget: T) => boolean = () => true
): IterableIterator<SaveableWidget & T> {
for (const widget of widgets) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/browser/tree/tree-widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ export class TreeWidget extends ReactWidget implements StatefulWidget {
decorations.push(node.decorationData);
}
if (this.decorations.has(node.id)) {
decorations.push(...this.decorations.get(node.id));
decorations.push(...this.decorations.get(node.id)!);
}
return decorations.sort(TreeDecoration.Data.comparePriority);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/monaco/src/typings/monaco/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ declare module monaco.actions {
* Retrieves all the registered menu items for the given menu.
* @param menuId - see https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/actions/common/actions.ts#L67
*/
getMenuItems(menuId: 7 /* EditorContext */ | 8 /* EditorContextPeek */ | 25 /* MenubarSelectionMenu */): IMenuItem | ISubmenuItem[];
getMenuItems(menuId: 7 /* EditorContext */ | 8 /* EditorContextPeek */ | 25 /* MenubarSelectionMenu */): Iterable<IMenuItem> | Iterable<ISubmenuItem>;
}

// https://github.com/theia-ide/vscode/blob/standalone/0.20.x/src/vs/platform/actions/common/actions.ts#L51
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ export class PluginContributionHandler {
}

if (contributions.colors) {
pushContribution('colors', () => this.colors.register(...contributions.colors));
pushContribution('colors', () => this.colors.register(...contributions.colors!));
}

if (contributions.taskDefinitions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ export class TreeViewWidget extends TreeViewWelcomeWidget {
});

const children = this.getCaption(node);
return React.createElement('div', attrs, ...children);
return React.createElement('div', attrs, children);
}

protected getCaption(node: TreeNode): React.ReactNode {
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-ext/src/plugin/command-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class CommandRegistryImpl implements CommandRegistryExt {
// Using the KnownCommand exclusions, convert the commands manually
return KnownCommands.map(id, args, (mappedId: string, mappedArgs: any[] | undefined, mappedResult: KnownCommands.ConversionFunction) => {
const mr: KnownCommands.ConversionFunction = mappedResult;
return this.proxy.$executeCommand(mappedId, ...mappedArgs).then((result: any) => {
return this.proxy.$executeCommand(mappedId, ...mappedArgs!).then((result: any) => {
if (!result) {
return undefined;
}
Expand Down
Loading

0 comments on commit 7327b85

Please sign in to comment.