Skip to content

Commit

Permalink
Merge branch 'master' into untitledShimon
Browse files Browse the repository at this point in the history
  • Loading branch information
ShimonBenYair authored Jan 15, 2020
2 parents d6052d6 + 193c85f commit de302a9
Show file tree
Hide file tree
Showing 140 changed files with 3,831 additions and 4,390 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ cache:
- packages/editor-preview/node_modules
- packages/editor/node_modules
- packages/editorconfig/node_modules
- packages/extension-manager/node_modules
- packages/file-search/node_modules
- packages/filesystem/node_modules
- packages/getting-started/node_modules
Expand Down
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"packages/core/coverage/lcov.info",
"packages/editor/coverage/lcov.info",
"packages/filesystem/coverage/lcov.info",
"packages/extension-manager/coverage/lcov.info",
"packages/go/coverage/lcov.info",
"packages/java/coverage/lcov.info",
"packages/languages/coverage/lcov.info",
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

Breaking changes:

- [core] removed `virtual-renderer`. `react-renderer` should be used instead [#6885](https://github.com/eclipse-theia/theia/pull/6885)
- [core] removed `virtual-widget`. `react-widget` should be used instead [#6885](https://github.com/eclipse-theia/theia/pull/6885)
- [task] renamed method `getStrigifiedTaskSchema()` has been renamed to `getStringifiedTaskSchema()` [#6780](https://github.com/eclipse-theia/theia/pull/6780)
- [task] renamed method `reorgnizeTasks()` has been renamed to `reorganizeTasks()` [#6780](https://github.com/eclipse-theia/theia/pull/6780)
- Support VS Code icon and color theming. [#6475](https://github.com/eclipse-theia/theia/pull/6475)
Expand Down Expand Up @@ -42,7 +44,7 @@ Breaking changes:
});
```
- or install from a VS Code extension.
- One should not introduce css color variables anymore or hardcode colors in css.
- One should not introduce css color variables anymore or hardcode colors in css.
- One can contribute new colors by implementing `ColorContribution` contribution point and calling `ColorRegistry.register`.
It's important that new colors are derived from existing VS Code colors if one plans to allow installation of VS Code extension contributing color themes.
Otherwise, there is no guarantee that new colors don't look alien for a random VS Code color theme.
Expand Down
1 change: 1 addition & 0 deletions examples/electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"@theia/preview": "^0.14.0",
"@theia/process": "^0.14.0",
"@theia/python": "^0.14.0",
"@theia/scm": "^0.14.0",
"@theia/search-in-workspace": "^0.14.0",
"@theia/task": "^0.14.0",
"@theia/terminal": "^0.14.0",
Expand Down
27 changes: 22 additions & 5 deletions packages/core/src/browser/common-frontend-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export namespace CommonMenus {
export const VIEW_PRIMARY = [...VIEW, '0_primary'];
export const VIEW_VIEWS = [...VIEW, '1_views'];
export const VIEW_LAYOUT = [...VIEW, '2_layout'];
export const VIEW_TOGGLE = [...VIEW, '3_toggle'];

// last menu item
export const HELP = [...MAIN_MENU_BAR, '9_help'];
Expand Down Expand Up @@ -1540,6 +1541,22 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
hc: 'editorGutter.addedBackground'
}, description: 'Background color of success widgets (like alerts or notifications).'
},
{
id: 'warningBackground',
defaults: {
dark: 'editorWarning.foreground',
light: 'editorWarning.foreground',
hc: 'editorWarning.border'
}, description: 'Background color of warning widgets (like alerts or notifications).'
},
{
id: 'warningForeground',
defaults: {
dark: 'inputValidation.warningBackground',
light: 'inputValidation.warningBackground',
hc: 'inputValidation.warningBackground'
}, description: 'Foreground color of warning widgets (like alerts or notifications).'
},
// Statusbar
{
id: 'statusBar.offlineBackground',
Expand Down Expand Up @@ -1577,9 +1594,9 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
{
id: 'secondaryButton.foreground',
defaults: {
dark: 'button.foreground',
light: 'button.foreground',
hc: 'button.foreground'
dark: 'dropdown.foreground',
light: 'dropdown.foreground',
hc: 'dropdown.foreground'
}, description: 'Foreground color of secondary buttons.'
},
{
Expand All @@ -1593,8 +1610,8 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
{
id: 'secondaryButton.background',
defaults: {
dark: Color.lighten('button.background', 0.5),
light: Color.lighten('button.background', 0.5)
dark: Color.lighten('dropdown.background', 0.5),
light: Color.lighten('dropdown.background', 0.5)
}, description: 'Background color of secondary buttons.'
},
{
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/browser/frontend-application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ export class FrontendApplication {
performance.measure(name, startMark, endMark);
for (const item of performance.getEntriesByName(name)) {
if (item.duration > 100) {
console.warn(item.name + ' is slow, took: ' + item.duration + ' ms');
console.warn(item.name + ' is slow, took: ' + item.duration.toFixed(1) + ' ms');
} else {
console.debug(item.name + ' took ' + item.duration + ' ms');
console.debug(item.name + ' took ' + item.duration.toFixed(1) + ' ms');
}
}
performance.clearMeasures(name);
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/browser/icons/add-inverse.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions packages/core/src/browser/icons/add.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 6 additions & 4 deletions packages/core/src/browser/icons/circle-bright.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 6 additions & 4 deletions packages/core/src/browser/icons/circle-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/core/src/browser/icons/close-all-bright.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/core/src/browser/icons/close-all-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion packages/core/src/browser/icons/close-bright.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion packages/core/src/browser/icons/close-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion packages/core/src/browser/icons/collapse.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion packages/core/src/browser/icons/expand.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 7 additions & 8 deletions packages/core/src/browser/keyboard/keyboard-layout-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export class KeyboardLayoutService {
if (mapping.hasOwnProperty(code)) {
const keyMapping = mapping[code];
const mappedKey = Key.getKey(code);
if (this.isValidKey(mappedKey)) {
if (mappedKey && this.shouldIncludeKey(code)) {
if (isWindows) {
this.addWindowsKeyMapping(key2KeyCode, mappedKey, (keyMapping as IWindowsKeyMapping).vkey, keyMapping.value);
} else {
Expand All @@ -172,13 +172,12 @@ export class KeyboardLayoutService {
return { key2KeyCode, code2Character };
}

protected isValidKey(key?: Key): key is Key {
return key !== undefined
&& key !== Key.ADD
&& key !== Key.SUBTRACT
&& key !== Key.MULTIPLY
&& key !== Key.DIVIDE
&& key !== Key.DECIMAL;
protected shouldIncludeKey(code: string): boolean {
// Exclude all numpad keys because they produce values that are already found elsewhere on the keyboard.
// This can cause problems, e.g. if `Numpad3` maps to `PageDown` then commands bound to `PageDown` would
// be resolved to `Digit3` (`Numpad3` is associated with `Key.DIGIT3`), effectively blocking the user
// from typing `3` in an editor.
return !code.startsWith('Numpad');
}

private addKeyMapping(key2KeyCode: KeyCode[], mappedKey: Key, value: string, shift: boolean, alt: boolean): void {
Expand Down
25 changes: 25 additions & 0 deletions packages/core/src/browser/keyboard/keys.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,29 @@ describe('keys api', () => {
expect(first.key).is.equal(Key.F10);
expect(second.key).is.equal(Key.KEY_B);
});

it('should parse minus as key', () => {
const keycode = KeyCode.parse('ctrl+-');
expect(keycode.ctrl).to.be.true;
expect(keycode.key).is.equal(Key.MINUS);
});

it('should parse minus as key and seprator', () => {
const keycode = KeyCode.parse('ctrl--');
expect(keycode.ctrl).to.be.true;
expect(keycode.key).is.equal(Key.MINUS);
});

it('should parse plus as separator', () => {
const keycode = KeyCode.parse('ctrl-+-');
expect(keycode.ctrl).to.be.true;
expect(keycode.key).is.equal(Key.MINUS);
});

it('should not parse plus as key but separator', () => {
const keycode = KeyCode.parse('ctrl++-');
expect(keycode.ctrl).to.be.true;
expect(keycode.key).is.equal(Key.MINUS);
});

});
14 changes: 13 additions & 1 deletion packages/core/src/browser/keyboard/keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,19 @@ export class KeyCode {
}

const schema: KeyCodeSchema = {};
const keys = keybinding.trim().toLowerCase().split(/[-+]/g);
const keys = [];
let currentKey = '';
for (const character of keybinding.trim().toLowerCase()) {
if (currentKey && (character === '-' || character === '+')) {
keys.push(currentKey);
currentKey = '';
} else if (character !== '+') {
currentKey += character;
}
}
if (currentKey) {
keys.push(currentKey);
}
/* If duplicates i.e ctrl+ctrl+a or alt+alt+b or b+alt+b it is invalid */
if (keys.length !== new Set(keys).size) {
throw new Error(`Can't parse keybinding ${keybinding} Duplicate modifiers`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export class QuickPickServiceImpl implements QuickPickService {
async show(elements: (string | QuickPickItem<Object>)[], options?: QuickPickOptions): Promise<Object | undefined> {
return new Promise<Object | undefined>(resolve => {
this.items = this.toItems(elements, resolve);
if (this.items.length === 0) {
resolve(undefined);
return;
}
// Set `runIfSingle` to the value passed through options, else defaults to true.
const runIfSingle: boolean = (options && options.runIfSingle !== undefined) ? options.runIfSingle : true;
if (runIfSingle && this.items.length === 1) {
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/browser/shell/tab-bar-toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@ export class TabBarToolbar extends ReactWidget {
if (iconClass) {
classNames.push(iconClass);
}
const tooltip = item.tooltip || (command && command.label);
return <div key={item.id} className={`${TabBarToolbar.Styles.TAB_BAR_TOOLBAR_ITEM}${command && this.commandIsEnabled(command.id) ? ' enabled' : ''}`}
onMouseDown={this.onMouseDownEvent} onMouseUp={this.onMouseUpEvent} onMouseOut={this.onMouseUpEvent} >
<div id={item.id} className={classNames.join(' ')} onClick={this.executeCommand} title={item.tooltip}>{innerText}</div>
<div id={item.id} className={classNames.join(' ')} onClick={this.executeCommand} title={tooltip}>{innerText}</div>
</div>;
}

Expand Down
12 changes: 12 additions & 0 deletions packages/core/src/browser/source-tree/source-tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ export class SourceTree extends TreeImpl {
const updated = existing && <TreeElementNode>Object.assign(existing, { element, parent });
if (CompositeTreeElement.hasElements(element)) {
if (updated) {
if (!ExpandableTreeNode.is(updated)) {
Object.assign(updated, { expanded: false });
}
if (!CompositeTreeNode.is(updated)) {
Object.assign(updated, { children: [] });
}
return updated;
}
return {
Expand All @@ -65,6 +71,12 @@ export class SourceTree extends TreeImpl {
delete updated.children;
}
if (updated) {
if (ExpandableTreeNode.is(updated)) {
delete updated.expanded;
}
if (CompositeTreeNode.is(updated)) {
delete updated.children;
}
return updated;
}
return {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/browser/source-tree/tree-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// tslint:disable:no-any

import { ReactNode } from 'react';
import { injectable } from 'inversify';
import { injectable, unmanaged } from 'inversify';
import { Emitter, Event } from '../../common/event';
import { MaybePromise } from '../../common/types';
import { Disposable, DisposableCollection } from '../../common/disposable';
Expand Down Expand Up @@ -57,7 +57,7 @@ export abstract class TreeSource implements Disposable {
readonly id: string | undefined;
readonly placeholder: string | undefined;

constructor(options: TreeSourceOptions = {}) {
constructor(@unmanaged() options: TreeSourceOptions = {}) {
this.id = options.id;
this.placeholder = options.placeholder;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/browser/style/alert-messages.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@

/* warning message */
.theia-warning-alert {
background-color: var(--theia-editorWarning-foreground);
color: var(--theia-inputValidation-warningBackground);
background-color: var(--theia-warningBackground);
color: var(--theia-warningForeground);
padding: 10px;
}

Expand Down
12 changes: 12 additions & 0 deletions packages/core/src/browser/style/icons.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,15 @@
height: var(--theia-icon-size);
background: var(--theia-icon-open-json) no-repeat;
}

.theia-collapse-all-icon {
background: var(--theia-icon-collapse-all) center center no-repeat;
}

.theia-remove-all-icon {
background: var(--theia-icon-remove-all) center center no-repeat;
}

.theia-add-icon {
background: var(--theia-icon-add) center center no-repeat;
}
2 changes: 1 addition & 1 deletion packages/core/src/browser/style/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ code {
}

blockquote {
color: var(--theia-textBlockQuote-background);
background: var(--vscode-textBlockQuote-background);
border: var(--theia-border-width) solid var(--theia-textBlockQuote-border);
}

Expand Down
Loading

0 comments on commit de302a9

Please sign in to comment.