Skip to content
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

Fix hover regression in webview editor #4299

Merged
merged 3 commits into from
Jan 5, 2021
Merged

Conversation

rchiodo
Copy link
Contributor

@rchiodo rchiodo commented Jan 5, 2021

For #4218

Root cause was the structure returned by the language server did not show 'hasOwnProperty' as true even though the field was present.

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

@rchiodo rchiodo requested a review from a team as a code owner January 5, 2021 20:24
@@ -339,20 +339,6 @@ jobs:
- name: Install dependencies (npm ci)
run: npm ci --prefer-offline

- name: Install Dot.net
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This isn't necessary for functional tests and was intermittently failing.

Copy link
Contributor

Choose a reason for hiding this comment

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

I added them with the intention of keeping all actions consistently the same...
Else it was getting too difficult to figure out what was reqquired
hate this copy paste nonense...

@@ -262,14 +262,16 @@ function convertToMonacoMarkdown(
| vscode.MarkedString
| vscode.MarkedString[]
): monacoEditor.IMarkdownString[] {
if (strings.hasOwnProperty('kind')) {
// tslint:disable-next-line: no-any
if (strings.hasOwnProperty('kind') || (strings as any).kind) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The new condition is sufficient (strings as any).kind, won't need hasOwnProperty

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's not true as (strings as any).kind will resolve as false if the value is 0 or false. I want it to continue to work if the property happens to be there.

Copy link
Member

Choose a reason for hiding this comment

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

Doesn't 'in' keyword work here? 'kind' in strings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me double check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes that seems to work. Not sure what the difference is. I assumed 'in' used hasOwnProperty under the covers.

Copy link
Member

@IanMatthewHuff IanMatthewHuff Jan 5, 2021

Choose a reason for hiding this comment

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

@rchiodo Heh, I only know because I'd been going through a JS basics book (felt like there was stuff that I didn't know jumping directly into TS) and just read the chapter covering JS object. hasOwnProperty is only checking the top level object prototype for the property, so if it's inherited it won't show up. 'in' keywork checkes the entire property chain. So for an object hasOwnProperty('toString') return false, since that method is in the base object prototype. kind must not be on the top object for some of those string types.

Copy link
Contributor

@DonJayamanne DonJayamanne left a comment

Choose a reason for hiding this comment

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

Might as well remove the check for hasOwnProperty

@codecov-io
Copy link

codecov-io commented Jan 5, 2021

Codecov Report

Merging #4299 (371be65) into main (e38708f) will increase coverage by 4%.
The diff coverage is 50%.

@@           Coverage Diff           @@
##            main   #4299     +/-   ##
=======================================
+ Coverage     70%     75%     +4%     
=======================================
  Files        389     389             
  Lines      25445   25456     +11     
  Branches    3637    3639      +2     
=======================================
+ Hits       18046   19191   +1145     
+ Misses      5996    4781   -1215     
- Partials    1403    1484     +81     
Impacted Files Coverage Δ
...ence/interactive-common/intellisense/conversion.ts 62% <50%> (ø)
...t/common/variables/environmentVariablesProvider.ts 77% <0%> (-4%) ⬇️
src/client/common/process/pythonDaemonPool.ts 80% <0%> (-3%) ⬇️
...er/jupyterInterpreterSubCommandExecutionService.ts 88% <0%> (-2%) ⬇️
src/client/datascience/jupyter/notebookStarter.ts 77% <0%> (-2%) ⬇️
...active-common/intellisense/intellisenseDocument.ts 67% <0%> (-1%) ⬇️
src/client/datascience/liveshare/liveshare.ts 66% <0%> (ø)
...ient/datascience/jupyter/kernels/kernelSelector.ts 80% <0%> (ø)
.../datascience/interactive-common/synchronization.ts 84% <0%> (ø)
...ience/interactive-common/interactiveWindowTypes.ts 100% <0%> (ø)
... and 75 more

@rchiodo rchiodo merged commit 4805e7e into main Jan 5, 2021
@rchiodo rchiodo deleted the rchiodo/hover_regression branch January 5, 2021 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants