Skip to content

Commit ec31280

Browse files
authored
Merge pull request #143 from yunair/fix_completion_case_sensitive
completion case sensitive will keep a no need token value
2 parents bdcf503 + 1804aab commit ec31280

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
@@ -40,6 +40,10 @@
4040
- completion now work properly when the kernel is shut down (
4141
[#146](https://github.com/krassowski/jupyterlab-lsp/pull/146)
4242
)
43+
- a lowercase completion option selected from an uppercase token
44+
will now correctly substitute the incomplete token (
45+
[#143](https://github.com/krassowski/jupyterlab-lsp/pull/143)
46+
)
4347

4448
## `lsp-ws-connection 0.3.0`
4549

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
@@ -218,7 +218,7 @@ export class LSPConnector extends DataConnector<
218218
// sortText: "amean"
219219
let text = match.insertText ? match.insertText : match.label;
220220

221-
if (text.startsWith(token.value)) {
221+
if (text.toLowerCase().startsWith(token.value.toLowerCase())) {
222222
all_non_prefixed = false;
223223
}
224224

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

0 commit comments

Comments
 (0)