Skip to content

Commit caab501

Browse files
authored
Merge branch 'master' into fix/tidyverse
2 parents 6bd4e0c + ec31280 commit caab501

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646
- completion now work properly when the kernel is shut down (
4747
[#146](https://github.com/krassowski/jupyterlab-lsp/pull/146)
4848
)
49+
- a lowercase completion option selected from an uppercase token
50+
will now correctly substitute the incomplete token (
51+
[#143](https://github.com/krassowski/jupyterlab-lsp/pull/143)
52+
)
4953
- `didSave()` is emitted on file save, enabling the workaround
5054
used by R language server to lazily load `library(tidyverse)` (
5155
[#95](https://github.com/krassowski/jupyterlab-lsp/pull/95),

atest/05_Features/Completion.robot

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ Autocompletes If Only One Option
5050
Wait Until Keyword Succeeds 20x 0.5s Cell Editor Should Equal 3 list.clear
5151
[Teardown] Clean Up After Working With File Completion.ipynb
5252

53+
User Can Select Lowercase After Starting Uppercase
54+
Setup Notebook Python Completion.ipynb
55+
Enter Cell Editor 4 line=1
56+
Trigger Completer
57+
Completer Should Suggest time
58+
Press Keys None ENTER
59+
Wait Until Keyword Succeeds 20x 0.5s Cell Editor Should Equal 4 from time import time
60+
[Teardown] Clean Up After Working With File Completion.ipynb
61+
5362
*** Keywords ***
5463
Enter Cell Editor
5564
[Arguments] ${cell_nr} ${line}=1

atest/examples/Completion.ipynb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@
2727
"source": [
2828
"list."
2929
]
30+
},
31+
{
32+
"cell_type": "code",
33+
"execution_count": null,
34+
"metadata": {},
35+
"outputs": [],
36+
"source": [
37+
"from time import Tim"
38+
]
3039
}
3140
],
3241
"metadata": {

packages/jupyterlab-lsp/src/adapters/jupyterlab/components/completion.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ export class LSPConnector extends DataConnector<
221221
// sortText: "amean"
222222
let text = match.insertText ? match.insertText : match.label;
223223

224-
if (text.startsWith(token.value)) {
224+
if (text.toLowerCase().startsWith(token.value.toLowerCase())) {
225225
all_non_prefixed = false;
226226
}
227227

@@ -285,7 +285,7 @@ export class LSPConnector extends DataConnector<
285285
if (lsp.start > kernel.start) {
286286
const cursor = editor.getCursorPosition();
287287
const line = editor.getLine(cursor.line);
288-
prefix = line.substring(kernel.start, kernel.end);
288+
prefix = line.substring(cursor.column - 1, cursor.column);
289289
console.log('will remove prefix from kernel response:', prefix);
290290
}
291291

0 commit comments

Comments
 (0)