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
Strict nulls for everything except logconsole #7657
Changes from 1 commit
0bdce26
479815c
df0b0f7
98e2a16
db21fd2
a9efefe
f5019d8
51f9943
fed1b82
4569342
56bbec9
cf623f1
e84817e
d5995b2
3238bf4
1b3930d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -312,8 +312,9 @@ export class SettingRegistry implements ISettingRegistry { | |
const { composite, user } = plugins[plugin].data; | ||
|
||
return { | ||
composite: key in composite ? copy(composite[key]) : undefined, | ||
user: key in user ? copy(user[key]) : undefined | ||
composite: | ||
composite[key] !== undefined ? copy(composite[key]!) : undefined, | ||
user: user[key] !== undefined ? copy(user[key]!) : undefined | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should behave correctly, but it is a logic change. |
||
}; | ||
} | ||
|
||
|
@@ -785,8 +786,9 @@ export class Settings implements ISettingRegistry.ISettings { | |
const { composite, user } = this; | ||
|
||
return { | ||
composite: key in composite ? copy(composite[key]) : undefined, | ||
user: key in user ? copy(user[key]) : undefined | ||
composite: | ||
composite[key] !== undefined ? copy(composite[key]!) : undefined, | ||
user: user[key] !== undefined ? copy(user[key]!) : undefined | ||
}; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -401,9 +401,11 @@ export function parseDSV(options: IParser.IOptions): IParser.IResults { | |
case NEW_ROW: | ||
nrows++; | ||
|
||
// If we just parsed the first row and the ncols is undefined, set it to | ||
// the number of columns we found in the first row. | ||
if (nrows === 1 && ncols === undefined) { | ||
// If ncols is undefined, set it to the number of columns in this row (first row implied). | ||
if (ncols === undefined) { | ||
if (nrows !== 1) { | ||
throw new Error('Error parsing default number of columns'); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jasongrout Will these be logically equivalent? |
||
ncols = col; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -468,6 +468,13 @@ function addCommands( | |
} | ||
const context = docManager.contextForWidget(shell.currentWidget!); | ||
const type = fileType(shell.currentWidget!, docManager); | ||
if (!context) { | ||
return showDialog({ | ||
title: 'Cannot Reload', | ||
body: 'No context found for current widget!', | ||
buttons: [Dialog.okButton()] | ||
}); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a bunch of failure dialogs like this here, based on the pattern for one of the commands. Not sure if silent failure is better? |
||
return showDialog({ | ||
title: `Reload ${type} from Disk`, | ||
body: `Are you sure you want to reload | ||
|
@@ -492,6 +499,13 @@ function addCommands( | |
return; | ||
} | ||
const context = docManager.contextForWidget(shell.currentWidget!); | ||
if (!context) { | ||
return showDialog({ | ||
title: 'Cannot Revert', | ||
body: 'No context found for current widget!', | ||
buttons: [Dialog.okButton()] | ||
}); | ||
} | ||
return context.listCheckpoints().then(checkpoints => { | ||
if (checkpoints.length < 1) { | ||
return; | ||
|
@@ -531,6 +545,13 @@ function addCommands( | |
// Checks that shell.currentWidget is valid: | ||
if (isEnabled()) { | ||
let context = docManager.contextForWidget(shell.currentWidget!); | ||
if (!context) { | ||
return showDialog({ | ||
title: 'Cannot Save', | ||
body: 'No context found for current widget!', | ||
buttons: [Dialog.okButton()] | ||
}); | ||
} | ||
if (context.model.readOnly) { | ||
return showDialog({ | ||
title: 'Cannot Save', | ||
|
@@ -583,6 +604,13 @@ function addCommands( | |
// Checks that shell.currentWidget is valid: | ||
if (isEnabled()) { | ||
let context = docManager.contextForWidget(shell.currentWidget!); | ||
if (!context) { | ||
return showDialog({ | ||
title: 'Cannot Save', | ||
body: 'No context found for current widget!', | ||
buttons: [Dialog.okButton()] | ||
}); | ||
} | ||
return context.saveAs(); | ||
} | ||
} | ||
|
@@ -596,6 +624,13 @@ function addCommands( | |
// Checks that shell.currentWidget is valid: | ||
if (isEnabled()) { | ||
let context = docManager.contextForWidget(shell.currentWidget!); | ||
if (!context) { | ||
return showDialog({ | ||
title: 'Cannot Download', | ||
body: 'No context found for current widget!', | ||
buttons: [Dialog.okButton()] | ||
}); | ||
} | ||
return context.download(); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -252,7 +252,7 @@ export class DocumentWidgetManager implements IDisposable { | |
* | ||
* @param widget - The target widget. | ||
*/ | ||
protected setCaption(widget: Widget): Promise<void> { | ||
protected async setCaption(widget: Widget): Promise<void> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should fix the return type from the naked There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i.e. I assume the return type should stay the currently typed |
||
let context = Private.contextProperty.get(widget); | ||
if (!context) { | ||
return; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -412,7 +412,7 @@ export class CodeMirrorSearchProvider | |
|
||
// if the last thing on the line was a match, make sure we still | ||
// emit the changed signal so the display can pick up the updates | ||
if (stream.eol) { | ||
if (stream.eol()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume this is a fix, and not a break... |
||
this._changed.emit(undefined); | ||
} | ||
return 'searching'; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -270,7 +270,7 @@ function activateLogConsole( | |
} else { | ||
source = null; | ||
} | ||
if (logConsoleWidget) { | ||
if (logConsolePanel) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume this is a fix, and not a break... |
||
logConsolePanel.source = source; | ||
} | ||
status.model.source = source; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -355,7 +355,11 @@ export class LogConsolePanel extends StackedPanel { | |
const viewId = `source:${sender.source}`; | ||
const outputArea = this._outputAreas.get(viewId); | ||
if (outputArea) { | ||
outputArea.rendermime = change.newValue; | ||
if (change.newValue) { | ||
outputArea.rendermime = change.newValue; | ||
} else { | ||
outputArea.dispose(); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm unsure why I made this change, but it think it made sense at the time. Please review carefully... |
||
} | ||
}, this); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -336,6 +336,7 @@ export function addCommands( | |
Terminal = (await Private.ensureWidget()).Terminal; | ||
} catch (err) { | ||
Private.showErrorMessage(err); | ||
return; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume this is a fix, and not a break... |
||
} | ||
|
||
const name = args['name'] as string; | ||
|
@@ -401,7 +402,7 @@ export function addCommands( | |
label: 'Increase Terminal Font Size', | ||
execute: async () => { | ||
let { fontSize } = options; | ||
if (fontSize < 72) { | ||
if (fontSize && fontSize < 72) { | ||
vidartf marked this conversation as resolved.
Show resolved
Hide resolved
|
||
try { | ||
await settingRegistry.set(plugin.id, 'fontSize', fontSize + 1); | ||
} catch (err) { | ||
|
@@ -415,7 +416,7 @@ export function addCommands( | |
label: 'Decrease Terminal Font Size', | ||
execute: async () => { | ||
let { fontSize } = options; | ||
if (fontSize > 9) { | ||
if (fontSize && fontSize > 9) { | ||
try { | ||
await settingRegistry.set(plugin.id, 'fontSize', fontSize - 1); | ||
} catch (err) { | ||
|
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 resolves a possible race condition?