Skip to content

Commit 0064113

Browse files
committed
Add documentation on adding completer icon themes
1 parent 12c1cd6 commit 0064113

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

docs/Extending.ipynb

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,45 @@
112112
"a work-in-progress."
113113
]
114114
},
115+
{
116+
"cell_type": "markdown",
117+
"metadata": {},
118+
"source": [
119+
"### How to add custom icons for the completer?\n",
120+
"\n",
121+
"1. Prepare the icons in the SVG format (we use 16 x 16 pixels, but you should be\n",
122+
" fine with up to 24 x 24). You can load them for webpack in typescript using\n",
123+
" imports if you include a `typings.d.ts` file with the following content:\n",
124+
"\n",
125+
" ```typescript\n",
126+
" declare module '*.svg' {\n",
127+
" const script: string;\n",
128+
" export default script;\n",
129+
" }\n",
130+
" ```\n",
131+
"\n",
132+
" in your `src/`. You should probably keep the icons in your `style/`\n",
133+
" directory.\n",
134+
"\n",
135+
"2. Prepare `CompletionKind` → `IconSvgString` mapping for the light (and\n",
136+
" optionally dark) theme, implementing the `ICompletionIconSet` interface. We\n",
137+
" have an additional `Kernel` completion kind that is used for completions\n",
138+
" provided by kernel that had no recognisable type provided.\n",
139+
"\n",
140+
"3. Provide all other metadata required by the `ICompletionTheme` interface and\n",
141+
" register it on `ILSPCompletionThemeManager` instance using `register_theme()`\n",
142+
" method.\n",
143+
"\n",
144+
"4. Provide any additional CSS styling targeting the JupyterLab completer\n",
145+
" elements inside of `.lsp-completer-theme-{id}`, e.g.\n",
146+
" `.lsp-completer-theme-material .jp-Completer-icon svg` for the material\n",
147+
" theme. Rememmber to include the styles by importing the in one of the source\n",
148+
" files.\n",
149+
"\n",
150+
"For an example of a complete theme see\n",
151+
"[theme-vscode](https://github.com/krassowski/jupyterlab-lsp/tree/master/packages/theme-vscode)."
152+
]
153+
},
115154
{
116155
"cell_type": "markdown",
117156
"metadata": {},

0 commit comments

Comments
 (0)