Skip to content

Commit f0cfeca

Browse files
committed
Merge branch 'auto-clear-highlights' of github.com:krassowski/jupyterlab-lsp into auto-clear-highlights
2 parents 04ad1ac + dd3a3c7 commit f0cfeca

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## CHANGELOG
22

3-
### `@krassowski/jupyterlab-lsp 2.1.2` (2020-12-XX)
3+
### `@krassowski/jupyterlab-lsp 2.1.2` (2021-01-XX)
44

55
- features
66

@@ -9,8 +9,10 @@
99
- bug fixes
1010
- improved performance of completion and highlights by minimising the number of highlight requests and GUI redraws (token checking, debouncing, acting on a single response only) ([#433])
1111
- highlights now update after cell focus/blur events even if those do not trigger cursor movement ([#433])
12+
- trigger characters auto-invoke now works in continuous hinting mode again ([#434])
1213

1314
[#433]: https://github.com/krassowski/jupyterlab-lsp/issues/433
15+
[#434]: https://github.com/krassowski/jupyterlab-lsp/issues/434
1416
[#446]: https://github.com/krassowski/jupyterlab-lsp/issues/446
1517

1618
### `@krassowski/jupyterlab-lsp 2.1.1` (2020-12-15)

atest/05_Features/Completion.robot

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ Continious Hinting Works
5454
Capture Page Screenshot 01-editor-ready.png
5555
Press Keys None d
5656
Completer Should Suggest addition
57+
# gh430 - auto invoke after dot should work too
58+
Press Keys None .
59+
Completer Should Suggest __doc__
5760

5861
Autocompletes If Only One Option
5962
Enter Cell Editor 3 line=1

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

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,10 @@ export class CompletionCM extends CodeMirrorIntegration {
4444
afterChange(change: CodeMirror.EditorChange): void {
4545
// TODO: maybe the completer could be kicked off in the handleChange() method directly; signature help still
4646
// requires an up-to-date virtual document on the LSP side, so we need to wait for sync.
47-
if (
48-
change.text &&
49-
change.text[0].length == 1 &&
50-
this.settings.composite.continuousHinting
51-
) {
52-
(this.feature.labIntegration as CompletionLabIntegration)
53-
.invoke_completer(AdditionalCompletionTriggerKinds.AutoInvoked)
54-
.catch(console.warn);
55-
return;
56-
}
5747

48+
// note: trigger character completion need to be have a higher priority than auto-invoked completion
49+
// because the latter does not work for on-dot completion due to suppression of trivial suggestions
50+
// see gh430
5851
let last_character = this.extract_last_character(change);
5952
if (this.completionCharacters.indexOf(last_character) > -1) {
6053
this.virtual_editor.console.log(
@@ -64,6 +57,17 @@ export class CompletionCM extends CodeMirrorIntegration {
6457
(this.feature.labIntegration as CompletionLabIntegration)
6558
.invoke_completer(CompletionTriggerKind.TriggerCharacter)
6659
.catch(console.warn);
60+
return;
61+
}
62+
63+
if (
64+
change.text &&
65+
change.text[0].length == 1 &&
66+
this.settings.composite.continuousHinting
67+
) {
68+
(this.feature.labIntegration as CompletionLabIntegration)
69+
.invoke_completer(AdditionalCompletionTriggerKinds.AutoInvoked)
70+
.catch(console.warn);
6771
}
6872
}
6973
}

0 commit comments

Comments
 (0)