Skip to content
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
4 changes: 2 additions & 2 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,8 @@
"DataScience.findJupyterCommandProgress": "Active interpreter does not support {0}. Searching for the best available interpreter.",
"DataScience.findJupyterCommandProgressCheckInterpreter": "Checking {0}.",
"DataScience.findJupyterCommandProgressSearchCurrentPath": "Searching current path.",
"DataScience.gatheredScriptDescription": "# This file contains only the code required to produce the results of the gathered cell.\n",
"DataScience.gatheredNotebookDescriptionInMarkdown": "## Gathered Notebook\nGenerated from ```{0}```\n\nThis notebook contains only the code and cells required to produce the same results as the gathered cell.\n\nPlease note that the python analysis is quite conservative, so if it is unsure whether a line of code is necessary for execution, it will err on the side of including it.\n\nAs this is an experimental feature, please let us know how well Gather works for you at [https://aka.ms/gathersurvey](https://aka.ms/gathersurvey)",
"DataScience.gatheredScriptDescription":"# This file was generated by an experimental feature called 'Gather'.\n#\n# The intent is that it contains only the code required to produce\n# the same results as the cell originally selected for gathering.\n# Please note that the Python analysis is quite conservative, so if\n# it is unsure whether a line of code is necessary for execution, it\n# will err on the side of including it.\n#\n# Please let us know if you are satisfied with what was gathered here:\n# https://aka.ms/gathersurvey\n\n",
"DataScience.gatheredNotebookDescriptionInMarkdown": "## Gathered Notebook\nGathered from ```{0}```\n\n| | |\n|---|---|\n|  &nbsp|This notebook was generated by an experimental feature called \"Gather\". The intent is that it contains only the code and cells required to produce the same results as the cell originally selected for gathering. Please note that the Python analysis is quite conservative, so if it is unsure whether a line of code is necessary for execution, it will err on the side of including it.|\n\n**Are you satisfied with the code that was gathered?**\n\n[Yes](https://aka.ms/gathersurvey?succeed_value=1) [No](https://aka.ms/gathersurvey?succeed_value=0)",
"DataScience.savePngTitle": "Save Image",
"DataScience.jupyterSelectURIQuickPickTitle": "Pick how to connect to Jupyter",
"DataScience.jupyterSelectURIQuickPickPlaceholder": "Choose an option",
Expand Down
4 changes: 2 additions & 2 deletions src/client/common/utils/localize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -722,11 +722,11 @@ export namespace DataScience {
);
export const gatheredScriptDescription = localize(
'DataScience.gatheredScriptDescription',
'# This file contains only the code required to produce the results of the gathered cell.\n'
'# This file was generated by an experimental feature called "Gather".\n#\n# The intent is that it contains only the code required to produce\n# the same results as the cell originally selected for gathering.\n# Please note that the Python analysis is quite conservative, so if\n# it is unsure whether a line of code is necessary for execution, it\n# will err on the side of including it.\n#\n# Please let us know if you are satisfied with what was gathered here:\n# https://aka.ms/gathersurvey\n\n'
);
export const gatheredNotebookDescriptionInMarkdown = localize(
'DataScience.gatheredNotebookDescriptionInMarkdown',
'## Gathered Notebook\nGenerated from ```{0}```\n\nThis notebook contains only the code and cells required to produce the same results as the gathered cell.\n\nPlease note that the python analysis is quite conservative, so if it is unsure whether a line of code is necessary for execution, it will err on the side of including it.\n\nAs this is an experimental feature, please let us know how well Gather works for you at [https://aka.ms/gathersurvey](https://aka.ms/gathersurvey)'
'# Gathered Notebook\nGathered from ```{0}```\n\n| | |\n|---|---|\n|  &nbsp|This notebook was generated by an experimental feature called "Gather". The intent is that it contains only the code and cells required to produce the same results as the cell originally selected for gathering. Please note that the Python analysis is quite conservative, so if it is unsure whether a line of code is necessary for execution, it will err on the side of including it.|\n\n**Are you satisfied with the code that was gathered?**\n\n[Yes](https://aka.ms/gathersurvey?succeed_value=1) [No](https://aka.ms/gathersurvey?succeed_value=0)'
);
export const savePngTitle = localize('DataScience.savePngTitle', 'Save Image');
export const fallbackToUseActiveInterpeterAsKernel = localize(
Expand Down
1 change: 1 addition & 0 deletions src/client/datascience/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ export enum Telemetry {
NewFileForInteractiveWindow = 'DS_INTERNAL.NEW_FILE_USED_IN_INTERACTIVE',
KernelInvalid = 'DS_INTERNAL.INVALID_KERNEL_USED',
GatherCompleted = 'DATASCIENCE.GATHER_COMPLETED',
GatheredNotebookSaved = 'DATASCIENCE.GATHERED_NOTEBOOK_SAVED',
ZMQNotSupported = 'DATASCIENCE.ZMQ_NATIVE_BINARIES_NOT_LOADING'
}

Expand Down
8 changes: 6 additions & 2 deletions src/client/datascience/gather/gather.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { IConfigurationService, IDisposableRegistry } from '../../common/types';
import * as localize from '../../common/utils/localize';
// tslint:disable-next-line: no-duplicate-imports
import { Common } from '../../common/utils/localize';
import { Identifiers } from '../constants';
import { sendTelemetryEvent } from '../../telemetry';
import { Identifiers, Telemetry } from '../constants';
import { CellState, ICell as IVscCell, IGatherProvider } from '../types';

/**
Expand Down Expand Up @@ -46,7 +47,9 @@ export class GatherProvider implements IGatherProvider {
);
}
} catch (ex) {
traceInfo('Gathering tools could not be activated. Indicates build of VSIX was not');
traceInfo(
'Gathering tools could not be activated. Indicates build of VSIX could not find @msrvida/python-program-analysis'
);
}
}
}
Expand All @@ -72,6 +75,7 @@ export class GatherProvider implements IGatherProvider {
*/
public gatherCode(vscCell: IVscCell): string {
if (!this._executionSlicer) {
sendTelemetryEvent(Telemetry.GatherCompleted, undefined, { result: 'unavailable' });
return '# %% [markdown]\n## Gather not available';
}

Expand Down
13 changes: 11 additions & 2 deletions src/client/datascience/gather/gatherListener.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { inject, injectable } from 'inversify';
import { IDisposable } from 'monaco-editor';
import * as uuid from 'uuid/v4';
import { Event, EventEmitter, Position, Uri, ViewColumn } from 'vscode';
import { createMarkdownCell } from '../../../datascience-ui/common/cellFactory';
Expand Down Expand Up @@ -173,9 +174,17 @@ export class GatherListener implements IInteractiveWindowListener {

const notebook = await this.jupyterExporter.translateToNotebook(cells);
if (notebook) {
notebook.metadata.gatheredNotebook = true;
const contents = JSON.stringify(notebook);
await this.ipynbProvider.createNew(contents);
const editor = await this.ipynbProvider.createNew(contents);

let disposable: IDisposable;
const handler = () => {
sendTelemetryEvent(Telemetry.GatheredNotebookSaved);
if (disposable) {
disposable.dispose();
}
};
disposable = editor.saved(handler);
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/client/telemetry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1894,8 +1894,12 @@ export interface IEventNamePropertyMapping {
/**
* result indicates whether the gather was completed to a script, notebook or suffered an internal error.
*/
result: 'err' | 'script' | 'notebook';
result: 'err' | 'script' | 'notebook' | 'unavailable';
};
/**
* Telemetry event sent when a gathered notebook has been saved by the user.
*/
[Telemetry.GatheredNotebookSaved]: undefined | never;
/**
* Telemetry event sent when the ZMQ native binaries do not work.
*/
Expand Down