Skip to content

Commit 6a2105e

Browse files
committed
Implement details-below layout
1 parent bcf7820 commit 6a2105e

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

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;

packages/theme-material/style/completer.css

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,52 @@
99
.lsp-completer-theme-material .jp-Completer-item.jp-mod-active svg path {
1010
fill: white;
1111
}
12+
13+
body[data-lsp-completer-layout='detail-below'] .jp-Completer-item {
14+
--lsp-completer-label-height: 24px;
15+
--lsp-completer-detail-height: 20px;
16+
--lsp-completer-icon-width: 16px;
17+
height: var(--lsp-completer-label-height);
18+
display: grid;
19+
grid-template-areas:
20+
'icon label'
21+
'detail detail';
22+
grid-template-columns: min-content 1fr;
23+
}
24+
25+
body[data-lsp-completer-layout='detail-below']
26+
.jp-Completer-item.jp-mod-active {
27+
height: calc(
28+
var(--lsp-completer-detail-height) + var(--lsp-completer-label-height)
29+
);
30+
}
31+
32+
body[data-lsp-completer-layout='detail-below'] .jp-Completer-icon {
33+
grid-area: icon;
34+
width: var(--lsp-completer-icon-width);
35+
}
36+
37+
body[data-lsp-completer-layout='detail-below'] .jp-Completer-match {
38+
grid-area: label;
39+
overflow: hidden;
40+
height: var(--lsp-completer-label-height);
41+
}
42+
43+
body[data-lsp-completer-layout='detail-below'] .jp-Completer-typeExtended {
44+
grid-area: detail;
45+
text-align: left;
46+
padding-left: calc(var(--lsp-completer-icon-width) + 8px);
47+
height: var(--lsp-completer-detail-height);
48+
line-height: var(--lsp-completer-detail-height);
49+
display: none;
50+
position: relative;
51+
top: -2px;
52+
overflow: hidden;
53+
max-width: 500px;
54+
}
55+
56+
body[data-lsp-completer-layout='detail-below']
57+
.jp-Completer-item.jp-mod-active
58+
.jp-Completer-typeExtended {
59+
display: block;
60+
}

0 commit comments

Comments
 (0)