Skip to content
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

Upgrade to typescript 3.5.1 #6440

Merged
merged 3 commits into from May 31, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 14 additions & 22 deletions packages/fileeditor-extension/src/index.ts
Expand Up @@ -145,14 +145,10 @@ export const tabSpaceStatus: JupyterFrontEndPlugin<void> = {

// Keep a reference to the code editor config from the settings system.
const updateSettings = (settings: ISettingRegistry.ISettings): void => {
const cached = settings.get('editorConfig').composite as Partial<
CodeEditor.IConfig
>;
const config: CodeEditor.IConfig = {
item.model!.config = {
...CodeEditor.defaultConfig,
...cached
...(settings.get('editorConfig').composite as JSONObject)
};
item.model!.config = config;
};
void Promise.all([
settingRegistry.load('@jupyterlab/fileeditor-extension:plugin'),
Expand Down Expand Up @@ -215,7 +211,7 @@ function activate(
tracker.currentWidget !== null &&
tracker.currentWidget === shell.currentWidget;

let config = { ...CodeEditor.defaultConfig };
let config: CodeEditor.IConfig = { ...CodeEditor.defaultConfig };

// Handle state restoration.
if (restorer) {
Expand All @@ -230,15 +226,11 @@ function activate(
* Update the setting values.
*/
function updateSettings(settings: ISettingRegistry.ISettings): void {
let cached = settings.get('editorConfig').composite as Partial<
CodeEditor.IConfig
>;
Object.keys(config).forEach((key: keyof CodeEditor.IConfig) => {
config[key] =
cached[key] === null || cached[key] === undefined
? CodeEditor.defaultConfig[key]
: cached[key];
});
config = {
...CodeEditor.defaultConfig,
...(settings.get('editorConfig').composite as JSONObject)
};

// Trigger a refresh of the rendered commands
app.commands.notifyCommandChanged();
}
Expand Down Expand Up @@ -313,7 +305,7 @@ function activate(
const currentSize = config.fontSize || cssSize;
config.fontSize = currentSize + delta;
return settingRegistry
.set(id, 'editorConfig', config)
.set(id, 'editorConfig', (config as unknown) as JSONObject)
.catch((reason: Error) => {
console.error(`Failed to set ${id}: ${reason.message}`);
});
Expand All @@ -325,7 +317,7 @@ function activate(
execute: () => {
config.lineNumbers = !config.lineNumbers;
return settingRegistry
.set(id, 'editorConfig', config)
.set(id, 'editorConfig', (config as unknown) as JSONObject)
.catch((reason: Error) => {
console.error(`Failed to set ${id}: ${reason.message}`);
});
Expand All @@ -342,7 +334,7 @@ function activate(
const lineWrap = (args['mode'] as wrappingMode) || 'off';
config.lineWrap = lineWrap;
return settingRegistry
.set(id, 'editorConfig', config)
.set(id, 'editorConfig', (config as unknown) as JSONObject)
.catch((reason: Error) => {
console.error(`Failed to set ${id}: ${reason.message}`);
});
Expand All @@ -361,7 +353,7 @@ function activate(
config.tabSize = (args['size'] as number) || 4;
config.insertSpaces = !!args['insertSpaces'];
return settingRegistry
.set(id, 'editorConfig', config)
.set(id, 'editorConfig', (config as unknown) as JSONObject)
.catch((reason: Error) => {
console.error(`Failed to set ${id}: ${reason.message}`);
});
Expand All @@ -377,7 +369,7 @@ function activate(
execute: () => {
config.matchBrackets = !config.matchBrackets;
return settingRegistry
.set(id, 'editorConfig', config)
.set(id, 'editorConfig', (config as unknown) as JSONObject)
.catch((reason: Error) => {
console.error(`Failed to set ${id}: ${reason.message}`);
});
Expand All @@ -391,7 +383,7 @@ function activate(
execute: () => {
config.autoClosingBrackets = !config.autoClosingBrackets;
return settingRegistry
.set(id, 'editorConfig', config)
.set(id, 'editorConfig', (config as unknown) as JSONObject)
.catch((reason: Error) => {
console.error(`Failed to set ${id}: ${reason.message}`);
});
Expand Down
49 changes: 17 additions & 32 deletions packages/notebook-extension/src/index.ts
Expand Up @@ -18,7 +18,7 @@ import {

import { CodeCell } from '@jupyterlab/cells';

import { CodeEditor, IEditorServices } from '@jupyterlab/codeeditor';
import { IEditorServices } from '@jupyterlab/codeeditor';

import {
ISettingRegistry,
Expand All @@ -31,7 +31,7 @@ import { IDocumentManager } from '@jupyterlab/docmanager';

import { ArrayExt } from '@phosphor/algorithm';

import { UUID } from '@phosphor/coreutils';
import { UUID, JSONObject } from '@phosphor/coreutils';

import { DisposableSet } from '@phosphor/disposable';

Expand Down Expand Up @@ -594,36 +594,21 @@ function activateNotebookHandler(
* Update the setting values.
*/
function updateConfig(settings: ISettingRegistry.ISettings): void {
let cached = settings.get('codeCellConfig').composite as Partial<
CodeEditor.IConfig
>;
let code = { ...StaticNotebook.defaultEditorConfig.code };
Object.keys(code).forEach((key: keyof CodeEditor.IConfig) => {
code[key] =
cached[key] === null || cached[key] === undefined
? code[key]
: cached[key];
});
cached = settings.get('markdownCellConfig').composite as Partial<
CodeEditor.IConfig
>;
let markdown = { ...StaticNotebook.defaultEditorConfig.markdown };
Object.keys(markdown).forEach((key: keyof CodeEditor.IConfig) => {
markdown[key] =
cached[key] === null || cached[key] === undefined
? markdown[key]
: cached[key];
});
cached = settings.get('rawCellConfig').composite as Partial<
CodeEditor.IConfig
>;
let raw = { ...StaticNotebook.defaultEditorConfig.raw };
Object.keys(raw).forEach((key: keyof CodeEditor.IConfig) => {
raw[key] =
cached[key] === null || cached[key] === undefined
? raw[key]
: cached[key];
});
let code = {
...StaticNotebook.defaultEditorConfig.code,
...(settings.get('codeCellConfig').composite as JSONObject)
};

let markdown = {
...StaticNotebook.defaultEditorConfig.markdown,
...(settings.get('markdownCellConfig').composite as JSONObject)
};

let raw = {
...StaticNotebook.defaultEditorConfig.raw,
...(settings.get('rawCellConfig').composite as JSONObject)
};

factory.editorConfig = { code, markdown, raw };
factory.notebookConfig = {
scrollPastEnd: settings.get('scrollPastEnd').composite as boolean,
Expand Down
16 changes: 7 additions & 9 deletions packages/terminal-extension/src/index.ts
Expand Up @@ -108,17 +108,14 @@ function activate(
});
}

// The terminal options from the setting editor.
// The cached terminal options from the setting editor.
let options: Partial<ITerminal.IOptions>;

/**
* Update the option values.
* Update the cached option values.
*/
function updateOptions(settings: ISettingRegistry.ISettings): void {
options = settings.composite as Partial<ITerminal.IOptions>;
Object.keys(options).forEach((key: keyof ITerminal.IOptions) => {
ITerminal.defaultOptions[key] = options[key];
});
options = settings.composite;
jasongrout marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand Down Expand Up @@ -164,7 +161,7 @@ function activate(
});
});

addCommands(app, tracker, settingRegistry);
addCommands(app, tracker, settingRegistry, options);

if (mainMenu) {
// Add "Terminal Theme" menu below "JupyterLab Themes" menu.
Expand Down Expand Up @@ -248,7 +245,8 @@ function activate(
export function addCommands(
app: JupyterFrontEnd,
tracker: InstanceTracker<MainAreaWidget<ITerminal.ITerminal>>,
settingRegistry: ISettingRegistry
settingRegistry: ISettingRegistry,
options: Partial<ITerminal.IOptions>
) {
const { commands, serviceManager } = app;

Expand All @@ -274,7 +272,7 @@ export function addCommands(
.catch(() => serviceManager.terminals.startNew())
: serviceManager.terminals.startNew());

const term = new Terminal(session);
const term = new Terminal(session, options);

term.title.icon = TERMINAL_ICON_CLASS;
term.title.label = '...';
Expand Down