# How can I configure the filename → language association?

**URL:** <https://discourse.jupyter.org/t/how-can-i-configure-the-filename-language-association/19738>\
**Category:** extensions\
**Tags:** help-wanted\
**Created:** [June 6, 2023, 5:19pm UTC](https://discourse.jupyter.org/t/how-can-i-configure-the-filename-language-association/19738 "2023-06-06T17:19:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![parmentelat](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/parmentelat/32/813_2.png) [@parmentelat](https://discourse.jupyter.org/u/parmentelat)\
**Post date:** [June 6, 2023, 5:19pm UTC](https://discourse.jupyter.org/t/how-can-i-configure-the-filename-language-association/19738/1 "2023-06-06T17:19:35Z")

</div>

remotely related to this thread:

> [@Defining jupytext as the default viewer for text notebooks under jlab4](https://discourse.jupyter.org/t/defining-jupytext-as-the-default-viewer-for-text-notebooks-under-jlab4/19730):
>
> I’d like to revisit [a discussion that we’ve had a while back already](https://discourse.jupyter.org/t/opening-a-jupytext-powered-notebook-under-jlab/9545/5), but today in the context of jlab4 I’m trying to help @mwouts with the jupytext extension for jlab4, and it seems like an alpha version is in sight - [https://github.com/mwouts/jupytext/issues/1054](https://github.com/mwouts/jupytext/issues/1054) - but at this point there is still the same issue addressed in the post above, namely that double clicking in a jupytext notebook in the file browser opens it in the editor and not as a notebook, and this despite the configuration t…

but going a little further, would there be a way to say something like

- all the files ending in `*-nb.md` should be opened by jupytext-notebook, while
- all the other files ending in `*.md` should be opened my markdown-preview

which is what I’d really like to be able to do in the end…

given that the `defaultViewers` setting maps tools to languages, I guess what I’m looking after is a way to map file naming schemes to languages ?  
or is that smarter than that, is there some shallow inspection of the file to kind-of guess the language ?

sorry for asking that many dumb questions…

---

<div class="post-metadata">

**Author:** ![parmentelat](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/parmentelat/32/813_2.png) [@parmentelat](https://discourse.jupyter.org/u/parmentelat)\
**Post date:** [June 7, 2023, 3:13pm UTC](https://discourse.jupyter.org/t/how-can-i-configure-the-filename-language-association/19738/2 "2023-06-07T15:13:30Z")

</div>

following-up on my own question:

I can see in  
`jupyterlab/packages/docregistry/src/registry.ts`  
that a DocRegistry instance has a `_fileTypes` field populated in my case with 27 entries for text, markdown, notebook, etc…

can I easily control that from some configuration file ?
