Skip to content

Commit 96119c1

Browse files
author
David Kutugata
authored
Port gather survey and icon getting disabled while gathering (#13296)
* Add gather status bar and update survey link (#13225) * add status bar * add localization * Added news file * add a 2 second timeout * updated the gather survey link * Change the gather icon while gathering * moved the gathering redux function to interactive common added a constant * move css to common.css * removed the status bar message * changed noop import * update changelog
1 parent b0501a0 commit 96119c1

File tree

23 files changed

+191
-98
lines changed

23 files changed

+191
-98
lines changed

CHANGELOG.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
([#13218](https://github.com/Microsoft/vscode-python/issues/13218))
2929
1. Use jupyter inspect to get signature of dynamic functions in notebook editor when language server doesn't provide enough hint.
3030
([#13259](https://github.com/Microsoft/vscode-python/issues/13259))
31+
1. The gather icon will change and get disabled while gather is executing.
32+
([#13177](https://github.com/microsoft/vscode-python/issues/13177))
3133

3234
### Fixes
3335

@@ -36,7 +38,7 @@
3638
1. Don't loop selection through all failed tests every time tests are run.
3739
([#11743](https://github.com/Microsoft/vscode-python/issues/11743))
3840
1. Some tools (like pytest) rely on the existence of `sys.path[0]`, so
39-
deleting it in the isolation script can sometimes cause problems. The
41+
deleting it in the isolation script can sometimes cause problems. The
4042
solution is to point `sys.path[0]` to a bogus directory that we know
4143
does not exist (assuming noone modifies the extension install dir).
4244
([#11875](https://github.com/Microsoft/vscode-python/issues/11875))
@@ -47,7 +49,7 @@
4749
1. Make the data science variable explorer support high contrast color theme.
4850
([#12766](https://github.com/Microsoft/vscode-python/issues/12766))
4951
1. The change in PR #12795 led to one particular test suite to take longer
50-
to run. Here we increase the timeout for that suite to get the test
52+
to run. Here we increase the timeout for that suite to get the test
5153
passing.
5254
([#12833](https://github.com/Microsoft/vscode-python/issues/12833))
5355
1. Refactor data science filesystem usage to correctly handle files which are potentially remote.
@@ -6793,4 +6795,4 @@ the following people who contributed code:
67936795

67946796
## Version 0.0.3
67956797

6796-
- Added support for debugging using PDB
6798+
- Added support for debugging using PDB

package.nls.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@
500500
"DataScience.findJupyterCommandProgressCheckInterpreter": "Checking {0}.",
501501
"DataScience.findJupyterCommandProgressSearchCurrentPath": "Searching current path.",
502502
"DataScience.gatherError": "Gather internal error",
503-
"DataScience.gatheredScriptDescription": "# This file was generated by the Gather Extension.\n# It requires version 2020.7.94776 (or newer) of the Python Extension.\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",
503+
"DataScience.gatheredScriptDescription": "# This file was generated by the Gather Extension.\n# It requires version 2020.7.94776 (or newer) of the Python Extension.\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/gatherfeedback\n\n",
504504
"DataScience.gatheredNotebookDescriptionInMarkdown": "## Gathered Notebook\nGathered from ```{0}```\n\n| | |\n|---|---|\n|  &nbsp|This notebook was generated by the Gather Extension. It requires version 2020.7.94776 (or newer) of the Python Extension, please update [here](https://command:python.datascience.latestExtension). 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://command:python.datascience.gatherquality?yes) [No](https://command:python.datascience.gatherquality?no)",
505505
"DataScience.savePngTitle": "Save Image",
506506
"DataScience.jupyterSelectURIQuickPickTitle": "Pick how to connect to Jupyter",
@@ -584,10 +584,10 @@
584584
"DataScienceRendererExtension.downloadCompletedOutputMessage": "Notebook Renderers extension download complete.",
585585
"DataScience.uriProviderDescriptionFormat": "{0} (From {1} extension)",
586586
"DataScience.unknownPackage": "unknown",
587-
"DataScience.interactiveWindowTitle" : "Python Interactive",
588-
"DataScience.interactiveWindowTitleFormat" : "Python Interactive - {0}",
589-
"DataScience.interactiveWindowModeBannerTitle" : "Do you want to open a new Python Interactive window for this file? [More Information](command:workbench.action.openSettings?%5B%22python.dataScience.interactiveWindowMode%22%5D).",
590-
"DataScience.interactiveWindowModeBannerSwitchYes" : "Yes",
591-
"DataScience.interactiveWindowModeBannerSwitchAlways" : "Always",
592-
"DataScience.interactiveWindowModeBannerSwitchNo" : "No"
587+
"DataScience.interactiveWindowTitle": "Python Interactive",
588+
"DataScience.interactiveWindowTitleFormat": "Python Interactive - {0}",
589+
"DataScience.interactiveWindowModeBannerTitle": "Do you want to open a new Python Interactive window for this file? [More Information](command:workbench.action.openSettings?%5B%22python.dataScience.interactiveWindowMode%22%5D).",
590+
"DataScience.interactiveWindowModeBannerSwitchYes": "Yes",
591+
"DataScience.interactiveWindowModeBannerSwitchAlways": "Always",
592+
"DataScience.interactiveWindowModeBannerSwitchNo": "No"
593593
}

src/client/common/utils/localize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ export namespace DataScience {
925925
export const gatherError = localize('DataScience.gatherError', 'Gather internal error');
926926
export const gatheredScriptDescription = localize(
927927
'DataScience.gatheredScriptDescription',
928-
'# This file was generated by the Gather Extension.\n# It requires version 2020.7.94776 (or newer) of the Python Extension.\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'
928+
'# This file was generated by the Gather Extension.\n# It requires version 2020.7.94776 (or newer) of the Python Extension.\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/gatherfeedback\n\n'
929929
);
930930
export const gatheredNotebookDescriptionInMarkdown = localize(
931931
'DataScience.gatheredNotebookDescriptionInMarkdown',

src/client/datascience/commands/commandRegistry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ export class CommandRegistry implements IDisposable {
450450

451451
private reportGatherQuality(val: string) {
452452
sendTelemetryEvent(Telemetry.GatherQualityReport, undefined, { result: val[0] === 'no' ? 'no' : 'yes' });
453-
env.openExternal(Uri.parse(`https://aka.ms/gathersurvey?succeed=${val[0]}`));
453+
env.openExternal(Uri.parse(`https://aka.ms/gatherfeedback?succeed=${val[0]}`));
454454
}
455455

456456
private openPythonExtensionPage() {

src/client/datascience/gather/gatherListener.ts

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,18 @@ export class GatherListener implements IInteractiveWindowListener {
7474
break;
7575

7676
case InteractiveWindowMessages.GatherCode:
77+
this.postEmitter.fire({
78+
message: InteractiveWindowMessages.Gathering,
79+
payload: { cellId: payload.id, gathering: true }
80+
});
7781
this.handleMessage(message, payload, this.doGather);
7882
break;
7983

8084
case InteractiveWindowMessages.GatherCodeToScript:
85+
this.postEmitter.fire({
86+
message: InteractiveWindowMessages.Gathering,
87+
payload: { cellId: payload.id, gathering: true }
88+
});
8189
this.handleMessage(message, payload, this.doGatherToScript);
8290
break;
8391

@@ -142,18 +150,32 @@ export class GatherListener implements IInteractiveWindowListener {
142150
}
143151
}
144152

145-
private doGather(payload: ICell): void {
146-
this.gatherCodeInternal(payload).catch((err) => {
147-
traceError(`Gather to Notebook error: ${err}`);
148-
this.applicationShell.showErrorMessage(err);
149-
});
153+
private doGather(payload: ICell): Promise<void> {
154+
return this.gatherCodeInternal(payload)
155+
.catch((err) => {
156+
traceError(`Gather to Notebook error: ${err}`);
157+
this.applicationShell.showErrorMessage(err);
158+
})
159+
.finally(() =>
160+
this.postEmitter.fire({
161+
message: InteractiveWindowMessages.Gathering,
162+
payload: { cellId: payload.id, gathering: false }
163+
})
164+
);
150165
}
151166

152-
private doGatherToScript(payload: ICell): void {
153-
this.gatherCodeInternal(payload, true).catch((err) => {
154-
traceError(`Gather to Script error: ${err}`);
155-
this.applicationShell.showErrorMessage(err);
156-
});
167+
private doGatherToScript(payload: ICell): Promise<void> {
168+
return this.gatherCodeInternal(payload, true)
169+
.catch((err) => {
170+
traceError(`Gather to Script error: ${err}`);
171+
this.applicationShell.showErrorMessage(err);
172+
})
173+
.finally(() =>
174+
this.postEmitter.fire({
175+
message: InteractiveWindowMessages.Gathering,
176+
payload: { cellId: payload.id, gathering: false }
177+
})
178+
);
157179
}
158180

159181
private gatherCodeInternal = async (cell: ICell, toScript: boolean = false) => {

src/client/datascience/interactive-common/interactiveWindowTypes.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { DebugProtocol } from 'vscode-debugprotocol';
1010
import {
1111
CommonActionType,
1212
IAddCellAction,
13+
IChangeGatherStatus,
1314
ILoadIPyWidgetClassFailureAction,
1415
IVariableExplorerHeight,
1516
LoadIPyWidgetClassLoadAction,
@@ -98,6 +99,7 @@ export enum InteractiveWindowMessages {
9899
StopDebugging = 'stop_debugging',
99100
GatherCode = 'gather_code',
100101
GatherCodeToScript = 'gather_code_to_script',
102+
Gathering = 'gathering',
101103
LaunchNotebookTrustPrompt = 'launch_notebook_trust_prompt',
102104
TrustNotebookComplete = 'trust_notebook_complete',
103105
LoadAllCells = 'load_all_cells',
@@ -630,6 +632,7 @@ export class IInteractiveWindowMapping {
630632
public [InteractiveWindowMessages.StopDebugging]: never | undefined;
631633
public [InteractiveWindowMessages.GatherCode]: ICell;
632634
public [InteractiveWindowMessages.GatherCodeToScript]: ICell;
635+
public [InteractiveWindowMessages.Gathering]: IChangeGatherStatus;
633636
public [InteractiveWindowMessages.LaunchNotebookTrustPrompt]: never | undefined;
634637
public [InteractiveWindowMessages.TrustNotebookComplete]: never | undefined;
635638
public [InteractiveWindowMessages.LoadAllCells]: ILoadAllCells;

src/client/datascience/interactive-common/synchronization.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ const messageWithMessageTypes: MessageMapping<IInteractiveWindowMapping> & Messa
129129
[InteractiveWindowMessages.FocusedCellEditor]: MessageType.syncWithLiveShare,
130130
[InteractiveWindowMessages.GatherCode]: MessageType.other,
131131
[InteractiveWindowMessages.GatherCodeToScript]: MessageType.other,
132+
[InteractiveWindowMessages.Gathering]: MessageType.other,
132133
[InteractiveWindowMessages.GetAllCells]: MessageType.other,
133134
[InteractiveWindowMessages.ForceVariableRefresh]: MessageType.other,
134135
[InteractiveWindowMessages.GetVariablesRequest]: MessageType.other,

src/datascience-ui/history-react/interactiveCell.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,13 @@ export class InteractiveCell extends React.Component<IInteractiveCellProps> {
195195
!this.props.settings.gatherIsInstalled
196196
}
197197
tooltip={getLocString('DataScience.gatherCodeTooltip', 'Gather code')}
198+
disabled={this.props.cellVM.gathering}
198199
>
199-
<Image baseTheme={this.props.baseTheme} class="image-button-image" image={ImageName.GatherCode} />
200+
<Image
201+
baseTheme={this.props.baseTheme}
202+
class="image-button-image"
203+
image={this.props.cellVM.gathering ? ImageName.Sync : ImageName.GatherCode}
204+
/>
200205
</ImageButton>
201206
<ImageButton
202207
baseTheme={this.props.baseTheme}

src/datascience-ui/history-react/interactivePanel.less

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Import common styles and then override them below */
2-
@import "../interactive-common/common.css";
2+
@import '../interactive-common/common.css';
33

44
.toolbar-menu-bar-child {
55
background: var(--override-background, var(--vscode-editor-background));
@@ -37,27 +37,26 @@
3737
}
3838

3939
.cell-outer {
40-
display:grid;
40+
display: grid;
4141
grid-template-columns: auto minmax(0, 1fr) 8px;
4242
grid-column-gap: 3px;
4343
width: 100%;
4444
}
4545

46-
4746
.cell-output {
4847
margin: 0px;
4948
width: 100%;
5049
overflow-x: scroll;
5150
background: transparent;
5251
}
5352

54-
.cell-output>div {
53+
.cell-output > div {
5554
background: var(--override-widget-background, var(--vscode-notifications-background));
5655
}
5756

5857
xmp {
5958
margin: 0px;
60-
}
59+
}
6160

6261
.cell-input {
6362
margin: 0;
@@ -72,4 +71,4 @@ xmp {
7271
white-space: pre-wrap;
7372
word-break: break-all;
7473
overflow-x: hidden;
75-
}
74+
}

src/datascience-ui/history-react/redux/reducers/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,6 @@ export const reducerMap: Partial<IInteractiveActionMapping> = {
7171
[InteractiveWindowMessages.UpdateKernel]: Kernel.updateStatus,
7272
[SharedMessages.LocInit]: CommonEffects.handleLocInit,
7373
[InteractiveWindowMessages.UpdateDisplayData]: CommonEffects.handleUpdateDisplayData,
74-
[InteractiveWindowMessages.HasCell]: Transfer.hasCell
74+
[InteractiveWindowMessages.HasCell]: Transfer.hasCell,
75+
[InteractiveWindowMessages.Gathering]: Transfer.gathering
7576
};

0 commit comments

Comments
 (0)