Skip to content

Commit 97621e9

Browse files
committed
Address test failures
1 parent d9e9fb0 commit 97621e9

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

atest/05_Features/Completion.robot

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ Filters Completions In Case Sensitive Mode
3838

3939

4040
Can Prioritize Kernel Completions
41-
Configure JupyterLab Plugin {"kernelCompletionsFirst": true, "kernelResponseTimeout": -1} plugin id=${COMPLETION PLUGIN ID}
41+
# note: disabling pre-filtering to get ranking without match scoring
42+
Configure JupyterLab Plugin {"kernelCompletionsFirst": true, "kernelResponseTimeout": -1, "preFilterMatches": false} plugin id=${COMPLETION PLUGIN ID}
4243
Enter Cell Editor 1 line=2
4344
Trigger Completer
4445
Completer Should Suggest %%timeit
@@ -47,7 +48,8 @@ Can Prioritize Kernel Completions
4748
Should Be True ${kernel_position} < ${lsp_position}
4849

4950
Can Prioritize LSP Completions
50-
Configure JupyterLab Plugin {"kernelCompletionsFirst": false, "kernelResponseTimeout": -1} plugin id=${COMPLETION PLUGIN ID}
51+
# note: disabling pre-filtering to get ranking without match scoring
52+
Configure JupyterLab Plugin {"kernelCompletionsFirst": false, "kernelResponseTimeout": -1, "preFilterMatches": false} plugin id=${COMPLETION PLUGIN ID}
5153
Enter Cell Editor 1 line=2
5254
Trigger Completer
5355
Completer Should Suggest %%timeit

packages/jupyterlab-lsp/src/features/completion/model.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,15 @@ export class GenericCompleterModel<
5454
// set initial query to pre-filter items; in future we should use:
5555
// https://github.com/jupyterlab/jupyterlab/issues/9763#issuecomment-1001603348
5656
const { start, end } = this.cursor;
57-
this.query = this.current.text.substring(start, end);
57+
let query = this.current.text.substring(start, end).trim();
58+
// special case for "Completes Paths In Strings" test case
59+
if (query.startsWith('"') || query.startsWith("'")) {
60+
query = query.substring(1);
61+
}
62+
if (query.endsWith('"') || query.endsWith("'")) {
63+
query = query.substring(0, -1);
64+
}
65+
this.query = query;
5866
}
5967
}
6068

0 commit comments

Comments
 (0)