Skip to content

Commit

Permalink
Merge pull request #867 from yamaton/fix-uncleared-hover-cache
Browse files Browse the repository at this point in the history
Fix hover tooltip not updated after character deletions
  • Loading branch information
krassowski authored Mar 15, 2023
2 parents e9eae5d + b623a0e commit 7b2f81f
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Requires JupyterLab `>=3.6.0,<4.0.0a0` and Python 3.8 or newer.
- fix `undefined` being inserted for path-like completion items with no `insertText` ([#833])
- reduce signature flickering when typing and hover flicker when moving mouse ([#836])
- fix sporadic misplacement of hover tooltips ([#860], thanks @yamaton)
- fix hover tooltip not updated after character deletions ([#867], thanks @yamaton)
- handle potential race condition in feature settings loading ([#882])
- refactoring:
- changed NPM packages namespace from `@krassowski` to `@jupyter-lsp` ([#862])
Expand Down Expand Up @@ -63,6 +64,7 @@ Requires JupyterLab `>=3.6.0,<4.0.0a0` and Python 3.8 or newer.
[#852]: https://github.com/jupyter-lsp/jupyterlab-lsp/pull/852
[#860]: https://github.com/jupyter-lsp/jupyterlab-lsp/pull/860
[#864]: https://github.com/jupyter-lsp/jupyterlab-lsp/pull/864
[#867]: https://github.com/jupyter-lsp/jupyterlab-lsp/pull/867
[#882]: https://github.com/jupyter-lsp/jupyterlab-lsp/pull/882
[#893]: https://github.com/jupyter-lsp/jupyterlab-lsp/pull/893

Expand Down
13 changes: 13 additions & 0 deletions atest/05_Features/Hover.robot
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,19 @@ Hover works in foreign code (javascript)
Trigger Tooltip Math
Element Should Contain ${HOVER_BOX} Math: Math

Update hover after character deletion
Enter Cell Editor 4
Trigger Tooltip atan2
Element Text Should Be ${HOVER_SIGNAL} atan2
Capture Page Screenshot 01-hover-before-delection.png
Element Should Contain ${HOVER_BOX} atan2(y: SupportsFloat, x: SupportsFloat, /)
Place Cursor In Cell Editor At 4 line=2 character=13
Press Keys None DELETE
Trigger Tooltip atan
Element Text Should Be ${HOVER_SIGNAL} atan
Capture Page Screenshot 02-hover-after-delection.png
Element Should Contain ${HOVER_BOX} atan(x: SupportsFloat, /)


*** Keywords ***
Last Occurrence
Expand Down
2 changes: 1 addition & 1 deletion atest/05_Features/Jump.robot
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Clean Up Folder With Spaces
FOR ${file} IN @{files}
Remove File ${NOTEBOOK DIR}${/}${FOLDER WITH SPACE}${/}${file}
END
Remove Directory ${NOTEBOOK DIR}${/}${FOLDER WITH SPACE} recursive=True
Remove Directory ${NOTEBOOK DIR}${/}${FOLDER WITH SPACE} recursive=True

Select Token Occurrence
[Arguments] ${token} ${type}=variable ${which}=last
Expand Down
10 changes: 10 additions & 0 deletions atest/examples/Hover.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@
"%%javascript\n",
"Math"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import math\n",
"z = math.atan2(0.4, 0.3)\n"
]
}
],
"metadata": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,13 @@ export class EditorAdapter<T extends IVirtualEditor<IEditor>> {
return true;
}

if (!change || !change.text.length || !change.text[0].length) {
// deletion - ignore
if (
!change ||
((!change.text.length || !change.text[0].length) &&
(!change.removed ||
!change.removed.length ||
!change.removed[0].length))
) {
return true;
}

Expand Down

0 comments on commit 7b2f81f

Please sign in to comment.