Skip to content

Commit 6ba7689

Browse files
committed
Document MIME types in specs/cofiguration
1 parent 7b80eb8 commit 6ba7689

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,8 @@ A spec is a Python callable (a function, or a class with `__call__` method) that
343343
"python-language-server": { # the name of the implementation
344344
"version": SPEC_VERSION, # the version of the spec schema (an integer)
345345
"argv": ["python", "-m", "pyls"], # a list of command line arguments
346-
"languages": ["python"] # a list of languages it supports
346+
"languages": ["python"], # a list of languages it supports
347+
"mime_types": ["text/python", "text/x-ipython"]
347348
}
348349
}
349350
```

docs/Configuring.ipynb

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,15 @@
6666
" `mkdir \"new directory\"` should be split into `[\"mkdir\", \"new directory\"]`;\n",
6767
" If you have Python installed, you can use `shlex.split(\"your command\")` to\n",
6868
" get such an array.\n",
69-
"- the `languages` which the server will respond to, and\n",
69+
"- the `languages` which the language server will respond to, and\n",
7070
"- the schema `version` of the spec (currently `2`)\n",
71+
"- `mime_types` by which the notebooks and files will be matched to the langauge\n",
72+
" server:\n",
73+
" - for notebooks the MIME type is derived from `language_info`/`mimetype`\n",
74+
" element of [`kernel_info`][] response (with fallback on to cell metadata if\n",
75+
" missing from kernel response)\n",
76+
" - for files the implemntation is frontend-specific; in JupyterLab the MIME\n",
77+
" type is obtained from the MIME type registry.\n",
7178
"\n",
7279
"```python\n",
7380
"# ./jupyter_server_config.json ---------- unique! -----------\n",
@@ -80,12 +87,16 @@
8087
" \"a-language-server-implementation\": {\n",
8188
" \"version\": 2,\n",
8289
" \"argv\": [\"/absolute/path/to/a-language-server\", \"--stdio\"],\n",
83-
" \"languages\": [\"a-language\"]\n",
90+
" \"languages\": [\"a-language\"],\n",
91+
" \"mime_types\": [\"text/language\", \"text/x-language\"]\n",
8492
" }\n",
8593
" }\n",
8694
" }\n",
8795
"}\n",
88-
"```"
96+
"```\n",
97+
"\n",
98+
"[`kernel_info`]:\n",
99+
" https://jupyter-client.readthedocs.io/en/stable/messaging.html#kernel-info"
89100
]
90101
},
91102
{

0 commit comments

Comments
 (0)