Skip to content

Fixes bugs #11777 and #11726, 'outputPrepend' needed to be cleared on each cell execute. #11871

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
May 18, 2020
Merged

Fixes bugs #11777 and #11726, 'outputPrepend' needed to be cleared on each cell execute. #11871

merged 7 commits into from
May 18, 2020

Conversation

BarryNolte
Copy link

@BarryNolte BarryNolte commented May 17, 2020

Changed 'outputPrepend' to be a per 'execution' tag instead of a per 'session' tag. Once it got saved in the ipynb file, it never went away, thus always showing the truncation message. All fixed an egregious spelling error.

  • Has unit tests & system/integration tests
  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR).
  • Title summarizes what is changing.
  • Has a news entry file (remember to thank yourself!).
  • Appropriate comments and documentation strings in the code.
  • Has sufficient logging.
  • Has telemetry for enhancements.
  • Unit tests & system/integration tests are added/updated.
  • Test plan is updated as appropriate.
  • package-lock.json has been regenerated by running npm install (if dependencies have changed).
  • The wiki is updated with any design decisions/details.

Changed 'outputPrepend' to be a per 'execution' tag instead of a per 'session' tag.  Once it got saved in the ipynb file, it never went away, thus always showing the truncation message.  All fixed an egregious spelling error.
@@ -1283,8 +1283,8 @@ export class JupyterNotebookBase implements INotebook {
trimFunc: (str: string) => string
) {
const data: nbformat.ICodeCell = cell.data as nbformat.ICodeCell;
let originalTextLenght = 0;
let trimmedTextLenght = 0;
let originalTextLength = 0;

Choose a reason for hiding this comment

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

Also not sure how this addresses https://github.com/microsoft/vscode-python/issues/11777
I think we need some tests to confirm the fix.
Again will wait for feedback from the rest of the team.

Copy link
Author

Choose a reason for hiding this comment

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

The spelling error fix is a side effect of fixing the actual bug, as in, leave the area nicer than you found it. Clearing the tag, fixes the bug. The truncating always worked, it was when the warning showed up that didn't.

@@ -589,6 +589,9 @@ export class NativeEditor extends InteractiveBase implements INotebookEditor {
// Clear the result if we've run before
await this.clearResult(cell.id);

// Clear 'per run' data passed to WebView before execution
cell.data.metadata.tags = [];

Choose a reason for hiding this comment

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

Thanks for submitting this PR, however I fail to see how this will solve the issue.
Doesn't this just blow away all of the tags in the metadata, meaning we're throwing away client data stored in tags.

Will wait for feedback from the rest of the team.

Copy link
Author

Choose a reason for hiding this comment

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

At the moment, this is the only tag that ever gets passed over to the client. Until there is another one added, it's just a single complicated flag.

Copy link

Choose a reason for hiding this comment

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

Yeah this should only be clearing the flag we add. Other metadata tags may have already been there and we don't want to clear them.


In reply to: 426679031 [](ancestors = 426679031)

Copy link

Choose a reason for hiding this comment

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

Additionally we should not blindly push the outputPrepend tag in jupyterNotebook.ts


In reply to: 426727089 [](ancestors = 426727089,426679031)

Copy link

@rchiodo rchiodo May 18, 2020

Choose a reason for hiding this comment

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

Hi Barry, should have been more clear there.

cell.data.metadata.tags can be written to by external tools (like this one https://ipypublish.readthedocs.io/en/latest/metadata_tags.html)

We added the outputprepend tag, but we don't want to remove other tags that might already be there. So something like

cell.data.metadata.tags = cell.metadata.tags.filter(t => t !== 'outputPrepend')

would be better.

The real bug is that we're just blindly pushing the outputPrepend tag instead of doing it just once.

Copy link
Author

Choose a reason for hiding this comment

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

Got it. My repro case is too simplistic, as in no external tools involved. That starts to explain a lot. This is a rabbit hole :). I'll submit yet another PR.

Copy link

@rchiodo rchiodo left a comment

Choose a reason for hiding this comment

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

🕐

Changed 'outputPrepend' to be a per 'execution' tag instead of a per 'session' tag.  Once it got saved in the ipynb file, it never went away, thus always showing the truncation message.  All fixed an egregious spelling error.
…e/vscode-python into Truncation-Message-Fix

# Conflicts:
#	src/client/datascience/interactive-ipynb/nativeEditor.ts
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link

@rchiodo rchiodo left a comment

Choose a reason for hiding this comment

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

:shipit:

@rchiodo rchiodo added the no-changelog No news entry required label May 18, 2020
@rchiodo rchiodo merged commit bbfb239 into microsoft:master May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog No news entry required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants