Skip to content

Fix when clauses for new interactive cell shortcuts - #13273

Merged
Joyce Er (joyceerhl) merged 1 commit into
microsoft:masterfrom
joyceerhl:interactive-cell-shortcuts
Aug 5, 2020
Merged

Joyce Er (joyceerhl) merged 1 commit into
microsoft:masterfrom
joyceerhl:interactive-cell-shortcuts

Conversation

@joyceerhl

@joyceerhl Joyce Er (joyceerhl) commented Aug 4, 2020 •

Copy link
Copy Markdown

For #13271

  • Actually show interactive cell shortcuts only when there is a python file with code cells (and ensure they're hidden when the notebook editor has focus)
  • Also fix capitalization on 'Debug cell' codelens

cells

Kinda weird that the editorFocus context key seems to break things. VSCode docs suggest that they're responsible for setting that key. editorLangId == python is harmless. Still, I'm dropping them for now as what I have here should be sufficient to ensure correct behavior.

  • 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.

@sonarqubecloud

sonarqubecloud Bot commented Aug 4, 2020

Copy link
Copy Markdown

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.7% 0.7% Duplication

@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Aug 4, 2020 •

Copy link
Copy Markdown

Codecov Report

Merging #13273 into master will decrease coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #13273      +/-   ##
==========================================
- Coverage   59.80%   59.78%   -0.03%     
==========================================
  Files         670      670              
  Lines       37183    37183              
  Branches     5265     5265              
==========================================
- Hits        22237    22228       -9     
- Misses      13818    13824       +6     
- Partials     1128     1131       +3     
Impacted Files Coverage Δ
src/client/common/utils/localize.ts 96.20% <100.00%> (ø)
src/client/common/utils/platform.ts 64.70% <0.00%> (-11.77%) ⬇️
src/client/datascience/crossProcessLock.ts 79.41% <0.00%> (-11.77%) ⬇️
src/client/linters/pydocstyle.ts 86.66% <0.00%> (-2.23%) ⬇️
src/client/datascience/debugLocationTracker.ts 76.56% <0.00%> (-1.57%) ⬇️
src/client/common/process/proc.ts 14.49% <0.00%> (-0.73%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0b2d404...6517369. Read the comment docs.

Comment thread package.json
"title": "%python.command.python.datascience.insertCellBelowPosition.title%",
"category": "Python",
"when": "python.datascience.hascodecells && editorFocus && editorLangId == python && python.datascience.featureenabled"
"when": "python.datascience.hascodecells && python.datascience.featureenabled && !notebookEditorFocused"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Don't you also need editorFocus && editorLangId == python
So that we display these commands only for python files?

@joyceerhl Joyce Er (joyceerhl) Aug 5, 2020 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yeah I saw that that's what you recommended in #12529, but it turns out that:

  1. editorFocus doesn't work at all for some reason. It completely hides those commands. Possibly codelenses interfering? I'm not totally sure what's going on there. But it doesn't do what we want. This was why the commands weren't showing up for Jim Griesmer (@greazer) during demo earlier today.
  2. The python.datascience.hascodecells context key is equivalent to editorLangId == python, because we only set hascodecells if activeEditor.document.languageId === PYTHON_LANGUAGE:

if (activeEditor && activeEditor.document.languageId === PYTHON_LANGUAGE) {
// Inform the editor context that we have cells, fire and forget is ok on the promise here
// as we don't care to wait for this context to be set and we can't do anything if it fails
editorContext.set(hasCells(activeEditor.document, this.configuration.getSettings().datascience)).catch();

);
export const addCellBelowCommandTitle = localize('DataScience.addCellBelowCommandTitle', 'Add cell');
export const debugCellCommandTitle = localize('DataScience.debugCellCommandTitle', 'Debug cell');
export const debugCellCommandTitle = localize('DataScience.debugCellCommandTitle', 'Debug Cell');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks like the command above should be changed to match up.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Is the Add Cell codelens even supposed to be showing up anymore?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I guess you could check the telemetry. It's still a command though.

Comment thread package.nls.json
"DataScience.jupyterDataRateExceeded": "Cannot view variable because data rate exceeded. Please restart your server with a higher data rate limit. For example, --NotebookApp.iopub_data_rate_limit=10000000000.0",
"DataScience.addCellBelowCommandTitle": "Add cell",
"DataScience.debugCellCommandTitle": "Debug cell",
"DataScience.debugCellCommandTitle": "Debug Cell",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should all of the 'cell' commands have 'Cell' instead of 'cell'? There's others.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Agreed, we have localize('DataScience.addCellBelowCommandTitle', 'Add cell');, shouldn't this be Add Cell
FYI - in VS Code, they are capatalized, i.e. i'd make this change everywhere.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The rest of them don't even show up, I think we decided at some point last year not to show those codelenses. Can we remove them altogether?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Oops just saw Rich's followup above.

@rchiodo Rich Chiodo (rchiodo) left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⏲️

@DavidKutu

Copy link
Copy Markdown

Just make the names consistent, either 'cell' or 'Cell'

@joyceerhl

Joyce Er (joyceerhl) commented Aug 5, 2020 •

Copy link
Copy Markdown
Author

I want to make sure I address the localization capitalization everywhere and I don't want to wait for CI to run all over again, so I'm gonna merge this one (since the Debug Cell codelens is the only one that is user-visible in the interactive python file experience).

@joyceerhl
Joyce Er (joyceerhl) merged commit 98f5b49 into microsoft:master Aug 5, 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.

6 participants