Skip to content

Commit

Permalink
Merge branch 'master' into 4084_show_refs_command
Browse files Browse the repository at this point in the history
  • Loading branch information
tsmaeder authored Feb 26, 2019
2 parents c5b598e + 6bd4786 commit e0b2ba4
Show file tree
Hide file tree
Showing 65 changed files with 1,085 additions and 539 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ jobs:
- os: osx
env: CXX=c++
before_script: skip
script: travis_retry yarn test:theia ;
script:
- travis_retry yarn test:theia ;
- stage: deploy
if: NOT type IN (cron, pull_request)
os: linux
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

## v0.4.0
- [plugin] added `tasks.onDidEndTask` Plug-in API
- [plugin] Introduce `vscode.previeHtml` command support
- [cpp] fixed `CPP_CLANGD_COMMAND` and `CPP_CLANGD_ARGS` environment variables
- [electron] open markdown links in the OS default browser
- [plugin] the "Command" interface has been split into two: "CommandDescription" and "Command". "Command" has been
made compatible with the "Command" interface in vscode. This is not a breaking change, currently, but fields in those interfaces
have been deprecated and will be removed in the future.
- [plugin] added ability to display webview panel in 'left', 'right' and 'bottom' area
- [plugin] added `tasks.taskExecutions` Plug-in API

Breaking changes:
- menus aligned with built-in VS Code menus [#4173](https://github.com/theia-ide/theia/pull/4173)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ const electron = require('electron');
const { join, resolve } = require('path');
const { isMaster } = require('cluster');
const { fork } = require('child_process');
const Storage = require('electron-store');
const electronStore = new Storage();
const { app, shell, BrowserWindow, ipcMain, Menu } = electron;
const applicationName = \`${this.pck.props.frontend.config.applicationName}\`;
Expand All @@ -150,8 +152,26 @@ if (isMaster) {
const y = Math.floor(bounds.y + (bounds.height - height) / 2);
const x = Math.floor(bounds.x + (bounds.width - width) / 2);
const windowStateName = 'windowstate';
const windowState = electronStore.get(windowStateName, {
width, height, x, y
});
let windowOptions = {
show: false,
title: applicationName,
width: windowState.width,
height: windowState.height,
x: windowState.x,
y: windowState.y
};
if (windowState.isMaximized) {
windowOptions.isMaximized = true;
}
// Always hide the window, we will show the window when it is ready to be shown in any case.
const newWindow = new BrowserWindow({ width, height, x, y, show: false, title: applicationName });
const newWindow = new BrowserWindow(windowOptions);
windowOptions.isMaximized && newWindow.maximize();
newWindow.on('ready-to-show', () => newWindow.show());
// Prevent calls to "window.open" from opening an ElectronBrowser window,
Expand All @@ -161,6 +181,20 @@ if (isMaster) {
shell.openExternal(url);
});
const saveState = () => {
const bounds = newWindow.getBounds();
electronStore.set(windowStateName, {
isMaximized: newWindow.isMaximized(),
width: bounds.width,
height: bounds.height,
x: bounds.x,
y: bounds.y
})
}
newWindow.on('close', saveState);
newWindow.on('resize', saveState);
newWindow.on('move', saveState);
if (!!theUrl) {
newWindow.loadURL(theUrl);
}
Expand Down
7 changes: 6 additions & 1 deletion dev-packages/cli/src/check-hoisting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ interface Diagnostic {

type DiagnosticMap = Map<string, Diagnostic[]>;

/**
* Folders to skip inside the `node_modules` when checking the hoisted dependencies. Such as the `.bin` and `.cache` folders.
*/
const toSkip = ['.bin', '.cache'];

function collectIssues(): DiagnosticMap {
console.log('🔍 Analyzing hoisted dependencies in the Theia extensions...');
const root = process.cwd();
Expand All @@ -45,7 +50,7 @@ function collectIssues(): DiagnosticMap {
const extensionPath = path.join(packages, extension);
const nodeModulesPath = path.join(extensionPath, 'node_modules');
if (fs.existsSync(nodeModulesPath)) {
for (const dependency of fs.readdirSync(nodeModulesPath).filter(name => name !== '.bin')) {
for (const dependency of fs.readdirSync(nodeModulesPath).filter(name => toSkip.indexOf(name) === -1)) {
const dependencyPath = path.join(nodeModulesPath, dependency);
const version = versionOf(dependencyPath);
let message = `Dependency '${dependency}' ${version ? `[${version}] ` : ''}was not hoisted to the root 'node_modules' folder.`;
Expand Down
2 changes: 1 addition & 1 deletion examples/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"watch": "concurrently -n compile,bundle \"theiaext watch --preserveWatchOutput\" \"theia build --watch --mode development\"",
"start": "export THEIA_DEFAULT_PLUGINS=local-dir:../../plugins && theia start",
"start:debug": "yarn start --log-level=debug",
"test": "wdio --max-old-space-size=4096 wdio.conf.js",
"test": "wdio wdio.conf.js",
"test-non-headless": "wdio wdio-non-headless.conf.js",
"coverage:compile": "yarn build --config coverage-webpack.config.js",
"coverage:remap": "remap-istanbul -i coverage/coverage.json -o coverage/coverage-final.json --exclude 'frontend/index.js' && rimraf coverage/coverage.json",
Expand Down
2 changes: 1 addition & 1 deletion examples/browser/wdio.base.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ function makeConfig(headless) {
try {
result = browser.execute("return window.__coverage__;");
} catch (error) {
console.error(`Error retreiving the coverage: ${error}`);
console.error(`Error retrieving the coverage: ${error}`);
return;
}
try {
Expand Down
1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"ajv": "^6.5.3",
"body-parser": "^1.17.2",
"electron": "^2.0.14",
"electron-store": "^2.0.0",
"es6-promise": "^4.2.4",
"express": "^4.16.3",
"file-icons-js": "^1.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ export interface PreferenceItem {
}

export interface PreferenceSchemaProperty extends PreferenceItem {
description: string;
description?: string;
scope?: 'application' | 'window' | 'resource' | PreferenceScope;
}

export interface PreferenceDataProperty extends PreferenceItem {
description: string;
description?: string;
scope?: PreferenceScope;
}
export namespace PreferenceDataProperty {
Expand Down
10 changes: 9 additions & 1 deletion packages/core/src/browser/style/scrollbars.css
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
/* Make horizontal scrollbar, decorations overview ruler and vertical scrollbar arrows opaque */
.vs .monaco-scrollable-element > .scrollbar,
.vs-dark .monaco-scrollable-element > .scrollbar,
.decorationsOverviewRuler, {
.decorationsOverviewRuler {
background: var(--theia-scrollbar-rail-color);
}

Expand All @@ -157,10 +157,18 @@
background: var(--theia-scrollbar-active-thumb-color) !important;
}

.monaco-scrollable-element > .visible.scrollbar.vertical:hover > .slider {
background: var(--theia-scrollbar-thumb-color) !important;
}

.monaco-scrollable-element > .scrollbar.vertical > .slider {
width: var(--theia-scrollbar-width) !important;
}

.monaco-scrollable-element > .scrollbar.vertical > .slider.active {
background: var(--theia-scrollbar-active-thumb-color) !important;
}

.monaco-scrollable-element > .scrollbar.horizontal > .slider {
height: var(--theia-scrollbar-width) !important;
}
9 changes: 6 additions & 3 deletions packages/core/src/browser/style/tabs.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
height: calc(var(--theia-private-horizontal-tab-height) + var(--theia-private-horizontal-tab-scrollbar-rail-height) / 2);
min-width: 35px;
line-height: var(--theia-private-horizontal-tab-height);
padding: 0px 8px;
padding: 0px 2px 0px 4px;
background: var(--theia-layout-color3);
}

Expand Down Expand Up @@ -95,16 +95,19 @@
}

.p-TabBar.theia-app-centers .p-TabBar-tab.p-mod-closable > .p-TabBar-tabCloseIcon {
margin-left: 4px;
padding-top: 6px;
height: 16px;
width: 16px;
background-image: var(--theia-icon-close);
background-size: 16px;
background-position: center;
background-repeat: no-repeat;
}

.p-TabBar.theia-app-centers .p-TabBar-tab.p-mod-closable:hover > .p-TabBar-tabCloseIcon,
.p-TabBar.theia-app-centers .p-TabBar-tab.p-mod-current > .p-TabBar-tabCloseIcon {
background-image: var(--theia-icon-close);
}

.p-TabBar.theia-app-centers .p-TabBar-tab.p-mod-closable.theia-mod-dirty > .p-TabBar-tabCloseIcon {
background-size: 10px;
background-image: var(--theia-icon-circle);
Expand Down
9 changes: 9 additions & 0 deletions packages/core/src/node/messaging/ipc-protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,22 @@ export function checkParentAlive(): void {

export const ipcEntryPoint = process.env[THEIA_ENTRY_POINT];

const THEIA_ENV_REGEXP_EXCLUSION = new RegExp('THEIA_*');
export function createIpcEnv(options?: {
entryPoint?: string
env?: NodeJS.ProcessEnv
}): NodeJS.ProcessEnv {
const op = Object.assign({}, options);
const childEnv = Object.assign({}, op.env);

for (const key of Object.keys(childEnv)) {
if (THEIA_ENV_REGEXP_EXCLUSION.test(key)) {
delete childEnv[key];
}
}

childEnv[THEIA_PARENT_PID] = String(process.pid);
childEnv[THEIA_ENTRY_POINT] = op.entryPoint;

return childEnv;
}
9 changes: 9 additions & 0 deletions packages/editor/src/browser/editor-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ export namespace EditorCommands {
category: EDITOR_CATEGORY,
label: 'Go to Last Edit Location'
};
/**
* Command that clears the editor navigation history.
*/
export const CLEAR_EDITOR_HISTORY: Command = {
id: 'textEditor.commands.clear.history',
category: EDITOR_CATEGORY,
label: 'Clear Editor History'
};
}

@injectable()
Expand Down Expand Up @@ -121,6 +129,7 @@ export class EditorCommandContribution implements CommandContribution {
registry.registerCommand(EditorCommands.GO_BACK);
registry.registerCommand(EditorCommands.GO_FORWARD);
registry.registerCommand(EditorCommands.GO_LAST_EDIT);
registry.registerCommand(EditorCommands.CLEAR_EDITOR_HISTORY);

registry.registerCommand(CommonCommands.AUTO_SAVE, {
isToggled: () => this.isAutoSaveOn(),
Expand Down
4 changes: 4 additions & 0 deletions packages/editor/src/browser/editor-navigation-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ export class EditorNavigationContribution implements Disposable, FrontendApplica
execute: () => this.locationStack.reveal(this.locationStack.lastEditLocation()),
isEnabled: () => !!this.locationStack.lastEditLocation()
});
this.commandRegistry.registerHandler(EditorCommands.CLEAR_EDITOR_HISTORY.id, {
execute: () => this.locationStack.clearHistory(),
isEnabled: () => this.locationStack.locations().length > 0
});
}

async onStart(): Promise<void> {
Expand Down
38 changes: 35 additions & 3 deletions packages/editor/src/browser/editor-preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,23 @@ import {
PreferenceSchema,
PreferenceChangeEvent
} from '@theia/core/lib/browser/preferences';
import { isOSX } from '@theia/core/lib/common/os';
import { isWindows, isOSX } from '@theia/core/lib/common/os';

const DEFAULT_WINDOWS_FONT_FAMILY = 'Consolas, \'Courier New\', monospace';
const DEFAULT_MAC_FONT_FAMILY = 'Menlo, Monaco, \'Courier New\', monospace';
const DEFAULT_LINUX_FONT_FAMILY = '\'Droid Sans Mono\', \'monospace\', monospace, \'Droid Sans Fallback\'';

export const EDITOR_FONT_DEFAULTS = {
fontFamily: (
isOSX ? DEFAULT_MAC_FONT_FAMILY : (isWindows ? DEFAULT_WINDOWS_FONT_FAMILY : DEFAULT_LINUX_FONT_FAMILY)
),
fontWeight: 'normal',
fontSize: (
isOSX ? 12 : 14
),
lineHeight: 0,
letterSpacing: 0,
};

export const editorPreferenceSchema: PreferenceSchema = {
'type': 'object',
Expand All @@ -38,9 +54,24 @@ export const editorPreferenceSchema: PreferenceSchema = {
},
'editor.fontSize': {
'type': 'number',
'default': (isOSX) ? 12 : 14,
'default': EDITOR_FONT_DEFAULTS.fontSize,
'description': 'Configure the editor font size.'
},
'editor.fontFamily': {
'type': 'string',
'default': EDITOR_FONT_DEFAULTS.fontFamily,
'description': 'Controls the font family.'
},
'editor.lineHeight': {
'type': 'number',
'default': EDITOR_FONT_DEFAULTS.lineHeight,
'description': 'Controls the line height. Use 0 to compute the line height from the font size.'
},
'editor.letterSpacing': {
'type': 'number',
'default': EDITOR_FONT_DEFAULTS.letterSpacing,
'description': 'Controls the letter spacing in pixels.'
},
'editor.lineNumbers': {
'enum': [
'on',
Expand Down Expand Up @@ -435,7 +466,7 @@ export const editorPreferenceSchema: PreferenceSchema = {
'800',
'900'
],
'default': 'normal',
'default': EDITOR_FONT_DEFAULTS.fontWeight,
'description': 'Controls the editor\'s font weight.'
},
'diffEditor.renderSideBySide': {
Expand Down Expand Up @@ -488,6 +519,7 @@ export const editorPreferenceSchema: PreferenceSchema = {

export interface EditorConfiguration {
'editor.tabSize': number
'editor.fontFamily': string
'editor.fontSize': number
'editor.fontWeight'?: 'normal' | 'bold' | 'bolder' | 'lighter' | 'initial'
| 'inherit' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,15 @@ export class NavigationLocationService {
return this._lastEditLocation;
}

/**
* Clears the navigation history.
*/
clearHistory(): void {
this.stack = [];
this.pointer = -1;
this._lastEditLocation = undefined;
}

/**
* Reveals the location argument. If not given, reveals the `current location`. Does nothing, if the argument is `undefined`.
*/
Expand Down
Loading

0 comments on commit e0b2ba4

Please sign in to comment.