Skip to content

Commit 16515bf

Browse files
committed
Merge remote-tracking branch 'upstream/main' into gh-1038-fix-cov
2 parents 869198f + 5afe3b4 commit 16515bf

File tree

6 files changed

+26
-15
lines changed

6 files changed

+26
-15
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
## Changelog
22

3+
### `@jupyter-lsp/jupyterlab-lsp 5.0.3`
4+
5+
- bug fixes:
6+
- fix nested transclusions in JupyterLab 4.0.7+ (#1045)
7+
- fix completions when `type` is not defined (#1044)
8+
39
### `@jupyter-lsp/jupyterlab-lsp 5.0.2`
410

511
- bug fixes:

packages/jupyterlab-lsp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jupyter-lsp/jupyterlab-lsp",
3-
"version": "5.0.2",
3+
"version": "5.0.3",
44
"description": "Language Server Protocol integration for JupyterLab",
55
"keywords": [
66
"jupyter",

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

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,22 @@ export class LSPCompletionRenderer
4949
);
5050
}
5151

52-
protected getExtraInfo(item: CompletionItem): string {
52+
protected getExtraInfo(
53+
item: CompletionItem | IExtendedCompletionItem
54+
): string | undefined {
5355
const labelExtra = this.options.settings.composite.labelExtra;
56+
const detail = 'detail' in item ? item?.detail ?? '' : '';
5457
switch (labelExtra) {
5558
case 'detail':
56-
return item?.detail || '';
59+
return detail;
5760
case 'type':
5861
return item?.type?.toLowerCase?.();
5962
case 'source':
6063
return item?.source;
6164
case 'auto':
62-
return [
63-
item?.detail || '',
64-
item?.type?.toLowerCase?.(),
65-
item?.source
66-
].filter(x => !!x)[0];
65+
return [detail, item?.type?.toLowerCase?.(), item?.source].filter(
66+
x => !!x
67+
)[0];
6768
default:
6869
this.options.console.warn(
6970
'labelExtra does not match any of the expected values',
@@ -73,7 +74,10 @@ export class LSPCompletionRenderer
7374
}
7475
}
7576

76-
public updateExtraInfo(item: CompletionItem, li: HTMLLIElement) {
77+
public updateExtraInfo(
78+
item: CompletionItem | IExtendedCompletionItem,
79+
li: HTMLLIElement
80+
) {
7781
const extraText = this.getExtraInfo(item);
7882
if (extraText) {
7983
const extraElement = li.getElementsByClassName(this.EXTRA_INFO_CLASS)[0];
@@ -184,10 +188,11 @@ export class LSPCompletionRenderer
184188
}
185189
}
186190

187-
itemWidthHeuristic(item: CompletionItem): number {
191+
itemWidthHeuristic(item: CompletionItem | IExtendedCompletionItem): number {
188192
let labelSize = item.label.replace(/<(\/)?mark>/g, '').length;
189-
const extraTextSize = this.getExtraInfo(item).length;
190-
const type = item.type.toLowerCase();
193+
const extra = this.getExtraInfo(item);
194+
const extraTextSize = extra?.length ?? 0;
195+
const type = item.type?.toLowerCase();
191196
if (type === 'file' || type === 'path') {
192197
// account for elision
193198
const parts = item.label.split(/<\/mark>/g);

packages/jupyterlab-lsp/src/virtual/document.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ export class VirtualDocument extends VirtualDocumentBase {
225225
);
226226
if (extractor.standalone && unusedStandalone.length > 0) {
227227
foreignDocument = unusedStandalone.pop()!;
228-
this.unusedDocuments.delete(foreignDocument);
229228
} else {
230229
// if (previous document does not exists) or (extractor produces standalone documents
231230
// and no old standalone document could be reused): create a new document

packages/metapackage/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jupyter-lsp/jupyterlab-lsp-metapackage",
3-
"version": "5.0.2",
3+
"version": "5.0.3",
44
"description": "JupyterLab LSP - Meta Package. All of the packages used by JupyterLab LSP",
55
"homepage": "https://github.com/jupyter-lsp/jupyterlab-lsp",
66
"bugs": {

setup.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ show_contexts = True
2626
[flake8]
2727
exclude = .git,__pycache__,envs,.ipynb_checkpoints,.mypy_cache
2828
max-line-length = 88
29-
ignore = E203,W503
29+
# E704 conflicts with black (https://github.com/PyCQA/pycodestyle/issues/1036)
30+
ignore = E203,W503,E704
3031

3132
[isort]
3233
profile = black

0 commit comments

Comments
 (0)