Skip to content

Commit 7b2f81f

Browse files
authored
Merge pull request #867 from yamaton/fix-uncleared-hover-cache
Fix hover tooltip not updated after character deletions
2 parents e9eae5d + b623a0e commit 7b2f81f

File tree

5 files changed

+33
-3
lines changed

5 files changed

+33
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Requires JupyterLab `>=3.6.0,<4.0.0a0` and Python 3.8 or newer.
1515
- fix `undefined` being inserted for path-like completion items with no `insertText` ([#833])
1616
- reduce signature flickering when typing and hover flicker when moving mouse ([#836])
1717
- fix sporadic misplacement of hover tooltips ([#860], thanks @yamaton)
18+
- fix hover tooltip not updated after character deletions ([#867], thanks @yamaton)
1819
- handle potential race condition in feature settings loading ([#882])
1920
- refactoring:
2021
- changed NPM packages namespace from `@krassowski` to `@jupyter-lsp` ([#862])
@@ -63,6 +64,7 @@ Requires JupyterLab `>=3.6.0,<4.0.0a0` and Python 3.8 or newer.
6364
[#852]: https://github.com/jupyter-lsp/jupyterlab-lsp/pull/852
6465
[#860]: https://github.com/jupyter-lsp/jupyterlab-lsp/pull/860
6566
[#864]: https://github.com/jupyter-lsp/jupyterlab-lsp/pull/864
67+
[#867]: https://github.com/jupyter-lsp/jupyterlab-lsp/pull/867
6668
[#882]: https://github.com/jupyter-lsp/jupyterlab-lsp/pull/882
6769
[#893]: https://github.com/jupyter-lsp/jupyterlab-lsp/pull/893
6870

atest/05_Features/Hover.robot

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,19 @@ Hover works in foreign code (javascript)
6666
Trigger Tooltip Math
6767
Element Should Contain ${HOVER_BOX} Math: Math
6868

69+
Update hover after character deletion
70+
Enter Cell Editor 4
71+
Trigger Tooltip atan2
72+
Element Text Should Be ${HOVER_SIGNAL} atan2
73+
Capture Page Screenshot 01-hover-before-delection.png
74+
Element Should Contain ${HOVER_BOX} atan2(y: SupportsFloat, x: SupportsFloat, /)
75+
Place Cursor In Cell Editor At 4 line=2 character=13
76+
Press Keys None DELETE
77+
Trigger Tooltip atan
78+
Element Text Should Be ${HOVER_SIGNAL} atan
79+
Capture Page Screenshot 02-hover-after-delection.png
80+
Element Should Contain ${HOVER_BOX} atan(x: SupportsFloat, /)
81+
6982

7083
*** Keywords ***
7184
Last Occurrence

atest/05_Features/Jump.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Clean Up Folder With Spaces
8989
FOR ${file} IN @{files}
9090
Remove File ${NOTEBOOK DIR}${/}${FOLDER WITH SPACE}${/}${file}
9191
END
92-
Remove Directory ${NOTEBOOK DIR}${/}${FOLDER WITH SPACE} recursive=True
92+
Remove Directory ${NOTEBOOK DIR}${/}${FOLDER WITH SPACE} recursive=True
9393

9494
Select Token Occurrence
9595
[Arguments] ${token} ${type}=variable ${which}=last

atest/examples/Hover.ipynb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@
3737
"%%javascript\n",
3838
"Math"
3939
]
40+
},
41+
{
42+
"cell_type": "code",
43+
"execution_count": null,
44+
"metadata": {},
45+
"outputs": [],
46+
"source": [
47+
"import math\n",
48+
"z = math.atan2(0.4, 0.3)\n"
49+
]
4050
}
4151
],
4252
"metadata": {

packages/jupyterlab-lsp/src/editor_integration/editor_adapter.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,13 @@ export class EditorAdapter<T extends IVirtualEditor<IEditor>> {
6868
return true;
6969
}
7070

71-
if (!change || !change.text.length || !change.text[0].length) {
72-
// deletion - ignore
71+
if (
72+
!change ||
73+
((!change.text.length || !change.text[0].length) &&
74+
(!change.removed ||
75+
!change.removed.length ||
76+
!change.removed[0].length))
77+
) {
7378
return true;
7479
}
7580

0 commit comments

Comments
 (0)