Skip to content

Commit 562148a

Browse files
committed
Merge branch 'master' into tcp_mode
2 parents d41ce9a + 9e61c2f commit 562148a

File tree

5 files changed

+96
-9
lines changed

5 files changed

+96
-9
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
[![tests](https://github.com/jupyter-lsp/jupyterlab-lsp/workflows/CI/badge.svg)](https://github.com/jupyter-lsp/jupyterlab-lsp/actions?query=workflow%3ACI+branch%3Amaster)
44
[![Documentation Status](https://readthedocs.org/projects/jupyterlab-lsp/badge/?version=latest)](https://jupyterlab-lsp.readthedocs.io/en/latest/?badge=latest)
5-
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/krassowski/jupyterlab-lsp/master?urlpath=lab%2Ftree%2Fexamples%2FPython.ipynb)
5+
[![Python Demo](https://img.shields.io/badge/demo-Python-blue)](https://mybinder.org/v2/gh/jupyter-lsp/demo-python/main?urlpath=lab)
6+
[![R Demo](https://img.shields.io/badge/demo-R-blue)](https://mybinder.org/v2/gh/jupyter-lsp/demo-r/main?urlpath=lab)
7+
[![Julia Demo](https://img.shields.io/badge/demo-Julia-blue)](https://mybinder.org/v2/gh/jupyter-lsp/demo-julia/main?urlpath=lab)
8+
[![Binder](https://img.shields.io/badge/launch-dev_version-blue)](https://mybinder.org/v2/gh/jupyter-lsp/jupyterlab-lsp/master?urlpath=lab%2Ftree%2Fexamples%2FPython.ipynb)
69

7-
> _This project is still maturing, but you are welcome to check it out, leave feedback and/or a PR_
8-
9-
Quick Links: **[Installation](#installation) | [Configuring](./docs/Configuring.ipynb) | [Changelog](./CHANGELOG.md) | [Roadmap](./docs/Roadmap.ipynb) | [Contributing](./CONTRIBUTING.md) | [Extending](./docs/Extending.ipynb)**
10+
**[Installation](#installation) | [Configuring](./docs/Configuring.ipynb) | [Changelog](./CHANGELOG.md) | [Roadmap](./docs/Roadmap.ipynb) | [Contributing](./CONTRIBUTING.md) | [Extending](./docs/Extending.ipynb)**
1011

1112
## Features
1213

packages/code-jumpers/src/jumpers/jumper.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ export abstract class CodeJumper {
9191

9292
private protectFromAccidentalEditing(document_widget: IDocumentWidget) {
9393
let editor_widget = document_widget as IDocumentWidget<FileEditor>;
94-
editor_widget.title.label = editor_widget.title.label + ' (external)';
94+
// We used to adjust `editor_widget.title.label` here but an upstream
95+
// bug (https://github.com/jupyterlab/jupyterlab/issues/10856) prevents
96+
// us from doing so anymore.
9597
let editor = editor_widget.content.editor;
9698
let disposable = editor.addKeydownHandler(
9799
(editor: IEditor, event: KeyboardEvent) => {

packages/completion-theme/style/index.css

Lines changed: 77 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,21 @@
2424
overflow: auto;
2525
}
2626

27+
.jp-Completer {
28+
--lsp-completer-max-label-width: 300px;
29+
--lsp-completer-max-detail-width: 200px;
30+
}
31+
2732
.jp-Completer-match {
28-
max-width: 400px;
33+
max-width: var(--lsp-completer-max-label-width);
2934
overflow-x: hidden;
3035
white-space: nowrap;
3136
display: block;
3237
text-overflow: ellipsis;
3338
}
3439

3540
.jp-mod-active .jp-Completer-match {
36-
max-width: 600px;
37-
white-space: break-spaces;
38-
height: auto;
41+
text-overflow: clip;
3942
}
4043

4144
.lsp-completer-placeholder:after {
@@ -47,3 +50,73 @@
4750
.jp-Completer-docpanel pre code {
4851
font-size: 90%;
4952
}
53+
54+
body[data-lsp-completer-layout='detail-below'] .jp-Completer-item {
55+
--lsp-completer-label-height: 24px;
56+
--lsp-completer-detail-height: 20px;
57+
--lsp-completer-icon-width: 16px;
58+
height: var(--lsp-completer-label-height);
59+
display: grid;
60+
grid-template-areas:
61+
'icon label'
62+
'detail detail';
63+
grid-template-columns: min-content 1fr;
64+
}
65+
66+
body[data-lsp-completer-layout='detail-below']
67+
.jp-Completer-item.jp-mod-active {
68+
height: calc(
69+
var(--lsp-completer-detail-height) + var(--lsp-completer-label-height)
70+
);
71+
}
72+
73+
body[data-lsp-completer-layout='detail-below'] .jp-Completer-icon {
74+
grid-area: icon;
75+
width: var(--lsp-completer-icon-width);
76+
}
77+
78+
body[data-lsp-completer-layout='detail-below'] .jp-Completer-match {
79+
grid-area: label;
80+
overflow: hidden;
81+
height: var(--lsp-completer-label-height);
82+
}
83+
84+
.jp-Completer-item .jp-Completer-typeExtended {
85+
max-width: var(--lsp-completer-max-detail-width);
86+
min-height: 50px;
87+
overflow-x: hidden;
88+
text-overflow: ellipsis;
89+
white-space: nowrap;
90+
}
91+
92+
.jp-mod-active .jp-Completer-typeExtended {
93+
text-overflow: clip;
94+
}
95+
96+
body[data-lsp-completer-layout='detail-below'] .jp-Completer-typeExtended {
97+
grid-area: detail;
98+
text-align: left;
99+
padding-left: calc(var(--lsp-completer-icon-width) + 8px);
100+
height: var(--lsp-completer-detail-height);
101+
line-height: var(--lsp-completer-detail-height);
102+
display: none;
103+
position: relative;
104+
top: -2px;
105+
overflow: hidden;
106+
max-width: calc(
107+
var(--lsp-completer-max-label-width) + var(--lsp-completer-max-detail-width)
108+
);
109+
}
110+
111+
body[data-lsp-completer-layout='detail-below'] .jp-Completer-match {
112+
overflow: hidden;
113+
max-width: calc(
114+
var(--lsp-completer-max-label-width) + var(--lsp-completer-max-detail-width)
115+
);
116+
}
117+
118+
body[data-lsp-completer-layout='detail-below']
119+
.jp-Completer-item.jp-mod-active
120+
.jp-Completer-typeExtended {
121+
display: block;
122+
}

packages/jupyterlab-lsp/schema/completion.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@
8383
"enum": ["detail", "type", "source", "auto"],
8484
"description": "What to display next to the completion label, one of: 'detail', 'type', 'source', 'auto'. The default 'auto' will display whichever information is available."
8585
},
86+
"layout": {
87+
"title": "Completer layout",
88+
"default": "side-by-side",
89+
"type": "string",
90+
"enum": ["detail-below", "side-by-side"],
91+
"description": "Layout of the completer, one of: 'detail-below', 'side-by-side'"
92+
},
8693
"typesMap": {
8794
"title": "Mapping of custom kernel types to valid completion kind names",
8895
"description": "Mapping used for icon selection. The kernel types (keys) are case-insensitive. Accepted values are the names of CompletionItemKind and 'Kernel' literal. The defaults aim to provide good initial experience for Julia, Python and R kernels.",

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ export class CompletionLabIntegration implements IFeatureLabIntegration {
121121
completionThemeManager.set_icons_overrides(
122122
this.settings.composite.typesMap
123123
);
124+
if (!settings.composite.disable) {
125+
document.body.dataset.lspCompleterLayout =
126+
this.settings.composite.layout;
127+
}
124128
if (this.current_completion_handler) {
125129
this.model.settings.caseSensitive =
126130
this.settings.composite.caseSensitive;

0 commit comments

Comments
 (0)