Skip to content

Commit cd0e362

Browse files
committed
some tweaks to css, diagnostic icon
1 parent 02f9f69 commit cd0e362

File tree

5 files changed

+51
-28
lines changed

5 files changed

+51
-28
lines changed

packages/jupyterlab-lsp/src/adapters/codemirror/features/diagnostics.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import {
1111
DIAGNOSTICS_LISTING_CLASS,
1212
DiagnosticsDatabase,
1313
DiagnosticsListing,
14-
IEditorDiagnostic
14+
IEditorDiagnostic,
15+
diagnosticsIcon
1516
} from './diagnostics_listing';
1617
import { VirtualDocument } from '../../../virtual/document';
1718
import { VirtualEditor } from '../../../virtual/editor';
@@ -46,6 +47,7 @@ class DiagnosticsPanel {
4647
widget.id = 'lsp-diagnostics-panel';
4748
widget.title.label = 'Diagnostics Panel';
4849
widget.title.closable = true;
50+
widget.title.icon = diagnosticsIcon;
4951
return widget;
5052
}
5153

packages/jupyterlab-lsp/src/adapters/codemirror/features/diagnostics_listing.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { ReactElement } from 'react';
22
import { VDomModel, VDomRenderer } from '@jupyterlab/apputils';
3-
import { caretDownIcon, caretUpIcon } from '@jupyterlab/ui-components';
3+
import { caretDownIcon, caretUpIcon, LabIcon } from '@jupyterlab/ui-components';
44
import * as lsProtocol from 'vscode-languageserver-protocol';
55
import * as CodeMirror from 'codemirror';
66
import { IEditorPosition } from '../../../positioning';
@@ -13,6 +13,13 @@ import { Cell } from '@jupyterlab/cells';
1313
import { diagnosticSeverityNames } from '../../../lsp';
1414
import { message_without_code } from './diagnostics';
1515

16+
import diagnosticsSvg from '../../../../style/icons/diagnostics.svg';
17+
18+
export const diagnosticsIcon = new LabIcon({
19+
name: 'lsp:diagnostics',
20+
svgstr: diagnosticsSvg
21+
});
22+
1623
/**
1724
* Diagnostic which is localized at a specific editor (cell) within a notebook
1825
* (if used in the context of a FileEditor, then there is just a single editor)
@@ -163,17 +170,19 @@ class Column {
163170
function SortableTH(props: { name: string; listing: DiagnosticsListing }): any {
164171
const is_sort_key = props.name === props.listing.sort_key;
165172
const sortIcon =
166-
props.listing.sort_direction === 1 ? caretUpIcon : caretDownIcon;
173+
!is_sort_key || props.listing.sort_direction === 1
174+
? caretUpIcon
175+
: caretDownIcon;
167176
return (
168177
<th
169178
key={props.name}
170179
onClick={() => props.listing.sort(props.name)}
171180
className={is_sort_key ? 'lsp-sorted-header' : null}
172181
>
173-
{props.name}
174-
{is_sort_key ? (
182+
<div>
183+
<label>{props.name}</label>
175184
<sortIcon.react tag="span" className="lsp-sort-icon" />
176-
) : null}
185+
</div>
177186
</th>
178187
);
179188
}

packages/jupyterlab-lsp/src/typings.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@
22
// Distributed under the terms of the Modified BSD License.
33

44
/// <reference path="../typings/codemirror/codemirror.d.ts"/>
5+
6+
declare module '*.svg' {
7+
const script: string;
8+
export default script;
9+
}

packages/jupyterlab-lsp/style/diagnostics_listing.css

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@
1919
overflow-x: hidden;
2020
}
2121

22+
.lsp-diagnostics-listing th,
23+
.lsp-diagnostics-listing td {
24+
padding: 4px 12px 2px 12px;
25+
height: 18px;
26+
}
27+
2228
.lsp-diagnostics-listing th {
23-
padding: 4px 12px;
2429
font-weight: 500;
2530
text-align: left;
2631
border-bottom: var(--jp-border-width) solid var(--jp-border-color1);
@@ -44,38 +49,35 @@
4449
content: ' > ';
4550
}
4651

47-
.lsp-diagnostics-listing td:first-child,
48-
.lsp-diagnostics-listing td:last-child {
49-
padding: 4px 12px;
50-
}
51-
52-
.lsp-diagnostics-listing tbody td:not(:first-child):not(:last-child) {
53-
padding: 4px 2px;
54-
}
55-
5652
.lsp-diagnostics-listing tbody tr:hover {
5753
background: var(--jp-layout-color2);
5854
}
5955

60-
.lsp-sorted-header {
61-
flex: 0 0 auto;
62-
display: flex;
56+
.lsp-diagnostics-listing thead th > div {
6357
flex-direction: row;
64-
overflow: hidden;
58+
display: flex;
59+
}
60+
61+
.lsp-diagnostics-listing thead th > div > label {
62+
flex: 1;
63+
text-overflow: ellipsis;
6564
}
6665

6766
.lsp-sort-icon {
68-
top: -3px;
69-
left: 3px;
70-
position: relative;
71-
height: 16px;
72-
width: 16px;
73-
display: block;
74-
margin-left: auto;
67+
flex: 0;
68+
height: var(--jp-ui-font-size1);
69+
width: var(--jp-ui-font-size1);
7570
}
7671

7772
.lsp-sort-icon svg {
78-
width: 20px;
7973
display: inline;
8074
height: auto;
8175
}
76+
77+
.lsp-diagnostics-listing thead th:not(.lsp-sorted-header) .lsp-sort-icon {
78+
opacity: 0;
79+
}
80+
81+
.lsp-diagnostics-listing thead th:not(.lsp-sorted-header):hover .lsp-sort-icon {
82+
opacity: 0.5;
83+
}
Lines changed: 5 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)