Skip to content

Merge more fixes into july release #12918

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

Merged
merged 7 commits into from
Jul 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
([#12732](https://github.com/Microsoft/vscode-python/issues/12732))
1. Show a prompt asking user to upgrade Code runner to new version to keep using it when in Deprecate PythonPath experiment.
([#12764](https://github.com/Microsoft/vscode-python/issues/12764))
1. Opening notebooks in the preview Notebook editor for [Visual Studio Code Insiders](https://code.visualstudio.com/insiders/).
* Install Python extension in the latest [Visual Studio Code Insiders](https://code.visualstudio.com/insiders/).
* Wait for `Python Extension` to get activated (e.g. open a `Python` file).
* Right click on an `*.ipynb (Jupyter Notebook)` file and select `Open in preview Notebook Editor`.
Comment on lines +37 to +39
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can get rid of these lines in change log. I can do this later when we make the release as well. Not really blocking.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can get rid of these lines in change log. I can do this later when we make the release as well. Not really blocking.

Thanks, don't want to wait for 1+ hrs for PR to go green

([#10496](https://github.com/Microsoft/vscode-python/issues/10496))

### Fixes

Expand Down Expand Up @@ -119,6 +124,10 @@
([#12656](https://github.com/Microsoft/vscode-python/issues/12656))
1. Add more telemetry for "Select Interpreter" command.
([#12722](https://github.com/Microsoft/vscode-python/issues/12722))
1. Add tests for trusted notebooks.
([#12554](https://github.com/Microsoft/vscode-python/issues/12554))
1. Update categories in `package.json`.
([#12844](https://github.com/Microsoft/vscode-python/issues/12844))

### Thanks

Expand Down
4 changes: 0 additions & 4 deletions news/1 Enhancements/10496.md

This file was deleted.

1 change: 0 additions & 1 deletion news/3 Code Health/12554.md

This file was deleted.

1 change: 0 additions & 1 deletion news/3 Code Health/12844.md

This file was deleted.

38 changes: 9 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,8 @@
"icon": {
"light": "resources/light/export_to_python.svg",
"dark": "resources/dark/export_to_python.svg"
}
},
"enablement": "notebookViewType == jupyter-notebook && python.datascience.isnotebooktrusted"
},
{
"command": "python.datascience.exportAsPythonScript",
Expand Down Expand Up @@ -702,16 +703,7 @@
"light": "resources/light/un-trusted.svg",
"dark": "resources/dark/un-trusted.svg"
},
"enablement": "notebookEditorFocused && !python.datascience.isnotebooktrusted && python.datascience.trustfeatureenabled"
},
{
"command": "python.datascience.notebookeditor.trusted",
"title": "%DataScience.notebookIsTrusted%",
"category": "Python",
"icon": {
"light": "resources/light/trusted.svg",
"dark": "resources/dark/trusted.svg"
}
"enablement": "notebookViewType == jupyter-notebook && !python.datascience.isnotebooktrusted && python.datascience.trustfeatureenabled"
},
{
"command": "python.datascience.notebookeditor.runallcells",
Expand Down Expand Up @@ -877,25 +869,19 @@
"command": "python.datascience.notebookeditor.restartkernel",
"title": "%python.command.python.datascience.restartkernel.title%",
"group": "navigation",
"when": "notebookEditorFocused"
"when": "notebookViewType == jupyter-notebook"
},
{
"command": "python.datascience.notebookeditor.trust",
"title": "%DataScience.trustNotebookCommandTitle%",
"group": "navigation@1",
"when": "notebookEditorFocused && !python.datascience.isnotebooktrusted && python.datascience.trustfeatureenabled"
},
{
"command": "python.datascience.notebookeditor.trusted",
"title": "%DataScience.notebookIsTrusted%",
"group": "navigation@1",
"when": "notebookEditorFocused && python.datascience.isnotebooktrusted && python.datascience.trustfeatureenabled"
"when": "notebookViewType == jupyter-notebook && !python.datascience.isnotebooktrusted && python.datascience.trustfeatureenabled"
},
{
"command": "python.datascience.export",
"title": "%DataScience.notebookExportAs%",
"group": "navigation",
"when": "notebookEditorFocused"
"when": "notebookViewType == jupyter-notebook"
}
],
"explorer/context": [
Expand Down Expand Up @@ -940,19 +926,19 @@
"command": "python.datascience.exportAsPythonScript",
"title": "%python.command.python.datascience.exportAsPythonScript.title%",
"category": "Python",
"when": "python.datascience.isnativeactive && python.datascience.featureenabled"
"when": "python.datascience.isnativeactive && python.datascience.featureenabled && python.datascience.isnotebooktrusted"
},
{
"command": "python.datascience.exportToHTML",
"title": "%python.command.python.datascience.exportToHTML.title%",
"category": "Python",
"when": "python.datascience.isnativeactive && python.datascience.featureenabled"
"when": "python.datascience.isnativeactive && python.datascience.featureenabled && python.datascience.isnotebooktrusted"
},
{
"command": "python.datascience.exportToPDF",
"title": "%python.command.python.datascience.exportToPDF.title%",
"category": "Python",
"when": "python.datascience.isnativeactive && python.datascience.featureenabled"
"when": "python.datascience.isnativeactive && python.datascience.featureenabled && python.datascience.isnotebooktrusted"
},
{
"command": "python.switchOffInsidersChannel",
Expand Down Expand Up @@ -1175,12 +1161,6 @@
"category": "Python",
"when": "python.datascience.featureenabled && notebookEditorFocused && !python.datascience.isnotebooktrusted && python.datascience.trustfeatureenabled"
},
{
"command": "python.datascience.notebookeditor.trusted",
"title": "%DataScience.notebookIsTrusted%",
"category": "Python",
"when": "config.noExists"
},
{
"command": "python.datascience.notebookeditor.runallcells",
"title": "%python.command.python.datascience.notebookeditor.runallcells.title%",
Expand Down
1 change: 0 additions & 1 deletion src/client/common/application/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,5 +184,4 @@ export interface ICommandNameArgumentTypeMapping extends ICommandNameWithoutArgu
[DSCommands.GatherQuality]: [string];
[DSCommands.EnableLoadingWidgetsFrom3rdPartySource]: [undefined | never];
[DSCommands.TrustNotebook]: [undefined | never | Uri];
[DSCommands.TrustedNotebook]: [undefined | never];
}
1 change: 0 additions & 1 deletion src/client/datascience/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export namespace Commands {
export const OpenNotebookNonCustomEditor = 'python.datascience.notebookeditor.open';
export const GatherQuality = 'python.datascience.gatherquality';
export const TrustNotebook = 'python.datascience.notebookeditor.trust';
export const TrustedNotebook = 'python.datascience.notebookeditor.trusted';
export const EnableLoadingWidgetsFrom3rdPartySource =
'python.datascience.enableLoadingWidgetScriptsFromThirdPartySource';
}
Expand Down
7 changes: 6 additions & 1 deletion src/client/datascience/interactive-ipynb/digestStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { inject, injectable } from 'inversify';
import * as os from 'os';
import * as path from 'path';
import { Uri } from 'vscode';
import { traceError } from '../../common/logger';
import { traceError, traceInfo } from '../../common/logger';
import { isFileNotFoundError } from '../../common/platform/errors';
import { IFileSystem } from '../../common/platform/types';
import { IExtensionContext } from '../../common/types';
Expand All @@ -13,6 +13,7 @@ import { IDigestStorage } from '../types';
export class DigestStorage implements IDigestStorage {
public readonly key: Promise<string>;
private digestDir: Promise<string>;
private loggedFileLocations = new Set();

constructor(
@inject(IFileSystem) private fs: IFileSystem,
Expand All @@ -26,6 +27,10 @@ export class DigestStorage implements IDigestStorage {
const fileLocation = await this.getFileLocation(uri);
// Since the signature is a hex digest, the character 'z' is being used to delimit the start and end of a single digest
await this.fs.appendFile(fileLocation, `z${signature}z\n`);
if (!this.loggedFileLocations.has(fileLocation)) {
traceInfo(`Wrote trust for ${uri.toString()} to ${fileLocation}`);
this.loggedFileLocations.add(fileLocation);
}
}

public async containsDigest(uri: Uri, signature: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import '../../common/extensions';
import { IDisposableRegistry, IExperimentService } from '../../common/types';
import { swallowExceptions } from '../../common/utils/decorators';
import { DataScience } from '../../common/utils/localize';
import { noop } from '../../common/utils/misc';
import { Commands } from '../constants';
import { INotebookStorageProvider } from '../interactive-ipynb/notebookStorageProvider';
import { INotebookEditorProvider, ITrustService } from '../types';
Expand All @@ -39,7 +38,6 @@ export class TrustCommandHandler implements IExtensionSingleActivationService {
const context = new ContextKey('python.datascience.trustfeatureenabled', this.commandManager);
context.set(true).ignoreErrors();
this.disposables.push(this.commandManager.registerCommand(Commands.TrustNotebook, this.onTrustNotebook, this));
this.disposables.push(this.commandManager.registerCommand(Commands.TrustedNotebook, noop));
}
@swallowExceptions('Trusting notebook')
private async onTrustNotebook(uri?: Uri) {
Expand Down
2 changes: 1 addition & 1 deletion src/client/datascience/notebookStorage/notebookModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class NativeEditorNotebookModel extends BaseNotebookModel {

// Dirty state comes from undo. At least VS code will track it that way. However
// skip file changes as we don't forward those to VS code
if (change.kind !== 'save' && change.kind !== 'saveAs') {
if (change.kind !== 'save' && change.kind !== 'saveAs' && change.kind !== 'updateTrust') {
this.changeCount += 1;
}

Expand Down
4 changes: 3 additions & 1 deletion src/datascience-ui/interactive-common/trustMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ export class TrustMessage extends React.PureComponent<ITrustMessageProps> {
};
const dynamicStyle: React.CSSProperties = {
maxWidth: getMaxWidth(textSize),
color: this.props.isNotebookTrusted ? undefined : 'var(--vscode-editorError-foreground)',
color: this.props.isNotebookTrusted
? 'var(--vscode-editor-foreground)'
: 'var(--vscode-editorError-foreground)',
cursor: this.props.isNotebookTrusted ? undefined : 'pointer'
};

Expand Down
10 changes: 7 additions & 3 deletions src/datascience-ui/native-editor/addCellLine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,23 @@ export class AddCellLine extends React.Component<IAddCellLineProps> {
const plus = this.props.includePlus ? (
<Image baseTheme={this.props.baseTheme} class="image-button-image" image={ImageName.InsertBelow} />
) : null;
const disabled = !this.props.isNotebookTrusted;
const innerFilter = disabled ? 'image-button-inner-disabled-filter' : '';
return (
<div className={className}>
<button
role="button"
aria-pressed="false"
title={tooltip}
disabled={!this.props.isNotebookTrusted}
disabled={disabled}
aria-label={tooltip}
className="add-cell-line-button"
onClick={this.props.click}
>
{plus}
<span className="add-cell-line-divider" />
<span className={innerFilter}>
{plus}
<span className="add-cell-line-divider" />
</span>
</button>
</div>
);
Expand Down