<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>book/src/languages.md - fork/helix @ 23.05</title>
<meta name="description" content="book/src/languages.md in fork/helix at 23.05.">
<meta property="og:title" content="book/src/languages.md - fork/helix @ 23.05">
<meta property="og:description" content="book/src/languages.md in fork/helix at 23.05.">
<meta property="og:type" content="website">
<meta property="og:site_name" content="git.julia.blue">
<link rel="stylesheet" href="/css/style.css?v=62">
<script type="module" src="/js/main.js?v=62"></script>
</head>
<body>
<main data-ref="23.05" data-tip="7f5940be80eaa3aec7903903072b7108f41dd97b">
<noscript>
  <div class="callout">
    <p>
      hey! this is a static git repo viewer. commit diffs, file history,
      older commits and other revisions won't load without javascript.
    </p>
    <p>
      you are still able to view source files on branch/tag tips,
      but the experience is degraded.
    </p>
  </div>
</noscript>
<header class="repo"><div>
<h1>fork/helix</h1>
</div>
<pre class="clone">git clone https://git.julia.blue/fork/helix</pre>
</header>
<p class="snapshot-commit"><span class="commit-author">Michael T. Mordowanec</span><span class="commit-message" data-commit="a1044a6c68bc822021da204f81e1d7c0ba13df31">Change soft-wrap.wrap_at_text_width to kebab case in documentation (#6842)</span><span class="snapshot-sha sha" data-commit="a1044a6c68bc822021da204f81e1d7c0ba13df31">a1044a6c</span><time datetime="2023-04-21T23:45:50+02:00" title="2023-04-21 23:45:50 +0200">2023-04-21</time></p>
<header class="topbar"><details class="switcher"><summary>23.05</summary><div class="menu"><strong>branches</strong><a href="/fork/helix/ref/master/">master</a><strong>tags</strong><a class="current" href="/fork/helix/ref/23.05/">23.05</a><a href="/fork/helix/ref/23.10/">23.10</a><a href="/fork/helix/ref/24.03/">24.03</a><a href="/fork/helix/ref/24.07/">24.07</a><a href="/fork/helix/ref/25.01/">25.01</a><a href="/fork/helix/ref/25.01.1/">25.01.1</a><a href="/fork/helix/ref/25.07/">25.07</a><a href="/fork/helix/ref/25.07.1/">25.07.1</a><a class="all" href="/fork/helix/refs">all refs →</a></div></details><nav class="crumbs"><a href="/fork/helix/">helix</a> / <a href="/fork/helix/ref/23.05/tree/book/">book</a> / <a href="/fork/helix/ref/23.05/tree/book/src/">src</a> / <span class="cur">languages.md</span></nav>
<span class="view-stats"><span>8.8 KiB</span><span>161 lines</span></span><span class="actions"><a class="raw" href="/fork/helix/raw/fe4db141309d71083a842b600a31e876550f3e28/book/src/languages.md">raw</a></span></header>
<div class="markdown-view"><input type="radio" name="markdown-view" id="markdown-rendered" checked><label for="markdown-rendered">rendered</label><input type="radio" name="markdown-view" id="markdown-code"><label for="markdown-code">code</label><section class="readme rendered"><h1>Languages</h1>
<p>Language-specific settings and settings for language servers are configured
in <code>languages.toml</code> files.</p>
<h2><code>languages.toml</code> files</h2>
<p>There are three possible locations for a <code>languages.toml</code> file:</p>
<ol>
<li>
<p>In the Helix source code, this lives in the
<a href="https://github.com/helix-editor/helix/blob/master/languages.toml">Helix repository</a>.
It provides the default configurations for languages and language servers.</p>
</li>
<li>
<p>In your <a href="/fork/helix/ref/23.05/blob/book/src/configuration.md">configuration directory</a>. This overrides values
from the built-in language configuration. For example to disable
auto-LSP-formatting in Rust:</p>
</li>
</ol>
<pre class="language-toml"><a-c># in &lt;config_dir&gt;/helix/languages.toml</a-c>

<a-p>[[</a-p><a-pr>language</a-pr><a-p>]]</a-p>
<a-pr>name</a-pr> <a-o>=</a-o> <a-s>&quot;rust&quot;</a-s>
<a-pr>auto-format</a-pr> <a-o>=</a-o> <a-co>false</a-co></pre>
<ol start="3">
<li>In a <code>.helix</code> folder in your project. Language configuration may also be
overridden local to a project by creating a <code>languages.toml</code> file in a
<code>.helix</code> folder. Its settings will be merged with the language configuration
in the configuration directory and the built-in configuration.</li>
</ol>
<h2>Language configuration</h2>
<p>Each language is configured by adding a <code>[[language]]</code> section to a
<code>languages.toml</code> file. For example:</p>
<pre class="language-toml"><a-p>[[</a-p><a-pr>language</a-pr><a-p>]]</a-p>
<a-pr>name</a-pr> <a-o>=</a-o> <a-s>&quot;mylang&quot;</a-s>
<a-pr>scope</a-pr> <a-o>=</a-o> <a-s>&quot;source.mylang&quot;</a-s>
<a-pr>injection-regex</a-pr> <a-o>=</a-o> <a-s>&quot;mylang&quot;</a-s>
<a-pr>file-types</a-pr> <a-o>=</a-o> <a-p>[</a-p><a-s>&quot;mylang&quot;</a-s><a-p>,</a-p> <a-s>&quot;myl&quot;</a-s><a-p>]</a-p>
<a-pr>comment-token</a-pr> <a-o>=</a-o> <a-s>&quot;#&quot;</a-s>
<a-pr>indent</a-pr> <a-o>=</a-o> <a-p>{</a-p> <a-pr>tab-width</a-pr> <a-o>=</a-o> <a-n>2</a-n><a-p>,</a-p> <a-pr>unit</a-pr> <a-o>=</a-o> <a-s>&quot;  &quot;</a-s> <a-p>}</a-p>
<a-pr>language-server</a-pr> <a-o>=</a-o> <a-p>{</a-p> <a-pr>command</a-pr> <a-o>=</a-o> <a-s>&quot;mylang-lsp&quot;</a-s><a-p>,</a-p> <a-pr>args</a-pr> <a-o>=</a-o> <a-p>[</a-p><a-s>&quot;--stdio&quot;</a-s><a-p>],</a-p> <a-pr>environment</a-pr> <a-o>=</a-o> <a-p>{</a-p> <a-s>&quot;ENV1&quot;</a-s> <a-o>=</a-o> <a-s>&quot;value1&quot;</a-s><a-p>,</a-p> <a-s>&quot;ENV2&quot;</a-s> <a-o>=</a-o> <a-s>&quot;value2&quot;</a-s> <a-p>}</a-p> <a-p>}</a-p>
<a-pr>formatter</a-pr> <a-o>=</a-o> <a-p>{</a-p> <a-pr>command</a-pr> <a-o>=</a-o> <a-s>&quot;mylang-formatter&quot;</a-s> <a-p>,</a-p> <a-pr>args</a-pr> <a-o>=</a-o> <a-p>[</a-p><a-s>&quot;--stdin&quot;</a-s><a-p>]</a-p> <a-p>}</a-p></pre>
<p>These configuration keys are available:</p>
<table><thead><tr><th>Key</th><th>Description</th></tr></thead><tbody>
<tr><td><code>name</code></td><td>The name of the language</td></tr>
<tr><td><code>scope</code></td><td>A string like <code>source.js</code> that identifies the language. Currently, we strive to match the scope names used by popular TextMate grammars and by the Linguist library. Usually <code>source.&lt;name&gt;</code> or <code>text.&lt;name&gt;</code> in case of markup languages</td></tr>
<tr><td><code>injection-regex</code></td><td>regex pattern that will be tested against a language name in order to determine whether this language should be used for a potential <a href="https://tree-sitter.github.io/tree-sitter/syntax-highlighting#language-injection">language injection</a> site.</td></tr>
<tr><td><code>file-types</code></td><td>The filetypes of the language, for example <code>["yml", "yaml"]</code>. See the file-type detection section below.</td></tr>
<tr><td><code>shebangs</code></td><td>The interpreters from the shebang line, for example <code>["sh", "bash"]</code></td></tr>
<tr><td><code>roots</code></td><td>A set of marker files to look for when trying to find the workspace root. For example <code>Cargo.lock</code>, <code>yarn.lock</code></td></tr>
<tr><td><code>auto-format</code></td><td>Whether to autoformat this language when saving</td></tr>
<tr><td><code>diagnostic-severity</code></td><td>Minimal severity of diagnostic for it to be displayed. (Allowed values: <code>Error</code>, <code>Warning</code>, <code>Info</code>, <code>Hint</code>)</td></tr>
<tr><td><code>comment-token</code></td><td>The token to use as a comment-token</td></tr>
<tr><td><code>indent</code></td><td>The indent to use. Has sub keys <code>unit</code> (the text inserted into the document when indenting; usually set to N spaces or <code>"\t"</code> for tabs) and <code>tab-width</code> (the number of spaces rendered for a tab)</td></tr>
<tr><td><code>language-server</code></td><td>The Language Server to run. See the Language Server configuration section below.</td></tr>
<tr><td><code>config</code></td><td>Language Server configuration</td></tr>
<tr><td><code>grammar</code></td><td>The tree-sitter grammar to use (defaults to the value of <code>name</code>)</td></tr>
<tr><td><code>formatter</code></td><td>The formatter for the language, it will take precedence over the lsp when defined. The formatter must be able to take the original file as input from stdin and write the formatted file to stdout</td></tr>
<tr><td><code>text-width</code></td><td>Maximum line length. Used for the <code>:reflow</code> command and soft-wrapping if <code>soft-wrap.wrap-at-text-width</code> is set, defaults to <code>editor.text-width</code></td></tr>
<tr><td><code>workspace-lsp-roots</code></td><td>Directories relative to the workspace root that are treated as LSP roots. Should only be set in <code>.helix/config.toml</code>. Overwrites the setting of the same name in <code>config.toml</code> if set.</td></tr>
</tbody></table>
<h3>File-type detection and the <code>file-types</code> key</h3>
<p>Helix determines which language configuration to use based on the <code>file-types</code> key
from the above section. <code>file-types</code> is a list of strings or tables, for
example:</p>
<pre class="language-toml"><a-pr>file-types</a-pr> <a-o>=</a-o> <a-p>[</a-p><a-s>&quot;Makefile&quot;</a-s><a-p>,</a-p> <a-s>&quot;toml&quot;</a-s><a-p>,</a-p> <a-p>{</a-p> <a-pr>suffix</a-pr> <a-o>=</a-o> <a-s>&quot;.git/config&quot;</a-s> <a-p>}]</a-p></pre>
<p>When determining a language configuration to use, Helix searches the file-types
with the following priorities:</p>
<ol>
<li>Exact match: if the filename of a file is an exact match of a string in a
<code>file-types</code> list, that language wins. In the example above, <code>"Makefile"</code>
will match against <code>Makefile</code> files.</li>
<li>Extension: if there are no exact matches, any <code>file-types</code> string that
matches the file extension of a given file wins. In the example above, the
<code>"toml"</code> matches files like <code>Cargo.toml</code> or <code>languages.toml</code>.</li>
<li>Suffix: if there are still no matches, any values in <code>suffix</code> tables
are checked against the full path of the given file. In the example above,
the <code>{ suffix = ".git/config" }</code> would match against any <code>config</code> files
in <code>.git</code> directories. Note: <code>/</code> is used as the directory separator but is
replaced at runtime with the appropriate path separator for the operating
system, so this rule would match against <code>.git\config</code> files on Windows.</li>
</ol>
<h3>Language Server configuration</h3>
<p>The <code>language-server</code> field takes the following keys:</p>
<table><thead><tr><th>Key</th><th>Description</th></tr></thead><tbody>
<tr><td><code>command</code></td><td>The name of the language server binary to execute. Binaries must be in <code>$PATH</code></td></tr>
<tr><td><code>args</code></td><td>A list of arguments to pass to the language server binary</td></tr>
<tr><td><code>timeout</code></td><td>The maximum time a request to the language server may take, in seconds. Defaults to <code>20</code></td></tr>
<tr><td><code>language-id</code></td><td>The language name to pass to the language server. Some language servers support multiple languages and use this field to determine which one is being served in a buffer</td></tr>
<tr><td><code>environment</code></td><td>Any environment variables that will be used when starting the language server <code>{ "KEY1" = "Value1", "KEY2" = "Value2" }</code></td></tr>
</tbody></table>
<p>The top-level <code>config</code> field is used to configure the LSP initialization options. A <code>format</code>
sub-table within <code>config</code> can be used to pass extra formatting options to
<a href="https://github.com/microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-16.md#document-formatting-request--leftwards_arrow_with_hook">Document Formatting Requests</a>.
For example with typescript:</p>
<pre class="language-toml"><a-p>[[</a-p><a-pr>language</a-pr><a-p>]]</a-p>
<a-pr>name</a-pr> <a-o>=</a-o> <a-s>&quot;typescript&quot;</a-s>
<a-pr>auto-format</a-pr> <a-o>=</a-o> <a-co>true</a-co>
<a-c># pass format options according to https://github.com/typescript-language-server/typescript-language-server#workspacedidchangeconfiguration omitting the &quot;[language].format.&quot; prefix.</a-c>
<a-pr>config</a-pr> <a-o>=</a-o> <a-p>{</a-p> <a-pr>format</a-pr> <a-o>=</a-o> <a-p>{</a-p> <a-s>&quot;semicolons&quot;</a-s> <a-o>=</a-o> <a-s>&quot;insert&quot;</a-s><a-p>,</a-p> <a-s>&quot;insertSpaceBeforeFunctionParenthesis&quot;</a-s> <a-o>=</a-o> <a-co>true</a-co> <a-p>}</a-p> <a-p>}</a-p></pre>
<h2>Tree-sitter grammar configuration</h2>
<p>The source for a language's tree-sitter grammar is specified in a <code>[[grammar]]</code>
section in <code>languages.toml</code>. For example:</p>
<pre class="language-toml"><a-p>[[</a-p><a-pr>grammar</a-pr><a-p>]]</a-p>
<a-pr>name</a-pr> <a-o>=</a-o> <a-s>&quot;mylang&quot;</a-s>
<a-pr>source</a-pr> <a-o>=</a-o> <a-p>{</a-p> <a-pr>git</a-pr> <a-o>=</a-o> <a-s>&quot;https://github.com/example/mylang&quot;</a-s><a-p>,</a-p> <a-pr>rev</a-pr> <a-o>=</a-o> <a-s>&quot;a250c4582510ff34767ec3b7dcdd3c24e8c8aa68&quot;</a-s> <a-p>}</a-p></pre>
<p>Grammar configuration takes these keys:</p>
<table><thead><tr><th>Key</th><th>Description</th></tr></thead><tbody>
<tr><td><code>name</code></td><td>The name of the tree-sitter grammar</td></tr>
<tr><td><code>source</code></td><td>The method of fetching the grammar - a table with a schema defined below</td></tr>
</tbody></table>
<p>Where <code>source</code> is a table with either these keys when using a grammar from a
git repository:</p>
<table><thead><tr><th>Key</th><th>Description</th></tr></thead><tbody>
<tr><td><code>git</code></td><td>A git remote URL from which the grammar should be cloned</td></tr>
<tr><td><code>rev</code></td><td>The revision (commit hash or tag) which should be fetched</td></tr>
<tr><td><code>subpath</code></td><td>A path within the grammar directory which should be built. Some grammar repositories host multiple grammars (for example <code>tree-sitter-typescript</code> and <code>tree-sitter-ocaml</code>) in subdirectories. This key is used to point <code>hx --grammar build</code> to the correct path for compilation. When omitted, the root of repository is used</td></tr>
</tbody></table>
<h3>Choosing grammars</h3>
<p>You may use a top-level <code>use-grammars</code> key to control which grammars are
fetched and built when using <code>hx --grammar fetch</code> and <code>hx --grammar build</code>.</p>
<pre class="language-toml"><a-c># Note: this key must come **before** the [[language]] and [[grammar]] sections</a-c>
<a-pr>use-grammars</a-pr> <a-o>=</a-o> <a-p>{</a-p> <a-pr>only</a-pr> <a-o>=</a-o> <a-p>[</a-p> <a-s>&quot;rust&quot;</a-s><a-p>,</a-p> <a-s>&quot;c&quot;</a-s><a-p>,</a-p> <a-s>&quot;cpp&quot;</a-s> <a-p>]</a-p> <a-p>}</a-p>
<a-c># or</a-c>
<a-pr>use-grammars</a-pr> <a-o>=</a-o> <a-p>{</a-p> <a-pr>except</a-pr> <a-o>=</a-o> <a-p>[</a-p> <a-s>&quot;yaml&quot;</a-s><a-p>,</a-p> <a-s>&quot;json&quot;</a-s> <a-p>]</a-p> <a-p>}</a-p></pre>
<p>When omitted, all grammars are fetched and built.</p>
</section><div class="code-panel"><pre class="code src language-markdown"><span class="code-line"><a class="ln" id="L1" href="#L1">1</a><span class="code-text"><a-p>#</a-p> <a-tt>Languages</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L2" href="#L2">2</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L3" href="#L3">3</a><span class="code-text">Language-specific settings and settings for language servers are configured</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L4" href="#L4">4</a><span class="code-text">in `languages.toml` files.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L5" href="#L5">5</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L6" href="#L6">6</a><span class="code-text"><a-p>##</a-p> <a-tt>`languages.toml` files</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L7" href="#L7">7</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L8" href="#L8">8</a><span class="code-text">There are three possible locations for a `languages.toml` file:</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L9" href="#L9">9</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L10" href="#L10">10</a><span class="code-text"><a-p>1. </a-p>In the Helix source code, this lives in the</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L11" href="#L11">11</a><span class="code-text"><a-p>   </a-p>[Helix repository](https://github.com/helix-editor/helix/blob/master/languages.toml).</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L12" href="#L12">12</a><span class="code-text"><a-p>   </a-p>It provides the default configurations for languages and language servers.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L13" href="#L13">13</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L14" href="#L14">14</a><span class="code-text"><a-p>2. In your [configuration directory](./configuration.md). This overrides values</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L15" href="#L15">15</a><span class="code-text"><a-p>   from the built-in language configuration. For example to disable</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L16" href="#L16">16</a><span class="code-text"><a-p>   auto-LSP-formatting in Rust:</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L17" href="#L17">17</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L18" href="#L18">18</a><span class="code-text"><a-p>```</a-p><a-tl>toml</a-tl></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L19" href="#L19">19</a><span class="code-text"><a-p># in &lt;config_dir&gt;/helix/languages.toml</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L20" href="#L20">20</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L21" href="#L21">21</a><span class="code-text"><a-p>[[</a-p><a-pr>language</a-pr><a-p>]]</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L22" href="#L22">22</a><span class="code-text"><a-p>name </a-p><a-o>=</a-o><a-p> </a-p><a-s>&quot;rust&quot;</a-s></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L23" href="#L23">23</a><span class="code-text"><a-p>auto-format </a-p><a-o>=</a-o><a-p> </a-p><a-co>false</a-co></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L24" href="#L24">24</a><span class="code-text"><a-p>```</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L25" href="#L25">25</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L26" href="#L26">26</a><span class="code-text"><a-p>3. In a `.helix` folder in your project. Language configuration may also be</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L27" href="#L27">27</a><span class="code-text"><a-p>   overridden local to a project by creating a `languages.toml` file in a</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L28" href="#L28">28</a><span class="code-text"><a-p>   `.helix` folder. Its settings will be merged with the language configuration</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L29" href="#L29">29</a><span class="code-text"><a-p>   in the configuration directory and the built-in configuration.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L30" href="#L30">30</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L31" href="#L31">31</a><span class="code-text"><a-p>## </a-p><a-tt>Language configuration</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L32" href="#L32">32</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L33" href="#L33">33</a><span class="code-text"><a-p>Each language is configured by adding a `[[language]]` section to a</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L34" href="#L34">34</a><span class="code-text"><a-p>`languages.toml` file. For example:</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L35" href="#L35">35</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L36" href="#L36">36</a><span class="code-text"><a-p>```</a-p><a-tl>toml</a-tl></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L37" href="#L37">37</a><span class="code-text"><a-p>[[</a-p><a-pr>language</a-pr><a-p>]]</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L38" href="#L38">38</a><span class="code-text"><a-p>name </a-p><a-o>=</a-o><a-p> </a-p><a-s>&quot;mylang&quot;</a-s></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L39" href="#L39">39</a><span class="code-text"><a-p>scope </a-p><a-o>=</a-o><a-p> </a-p><a-s>&quot;source.mylang&quot;</a-s></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L40" href="#L40">40</a><span class="code-text"><a-p>injection-regex </a-p><a-o>=</a-o><a-p> </a-p><a-s>&quot;mylang&quot;</a-s></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L41" href="#L41">41</a><span class="code-text"><a-p>file-types </a-p><a-o>=</a-o><a-p> [</a-p><a-s>&quot;mylang&quot;</a-s><a-p>, </a-p><a-s>&quot;myl&quot;</a-s><a-p>]</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L42" href="#L42">42</a><span class="code-text"><a-p>comment-token </a-p><a-o>=</a-o><a-p> </a-p><a-s>&quot;#&quot;</a-s></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L43" href="#L43">43</a><span class="code-text"><a-p>indent </a-p><a-o>=</a-o><a-p> { </a-p><a-pr>tab-width</a-pr><a-p> </a-p><a-o>=</a-o><a-p> </a-p><a-n>2</a-n><a-p>, </a-p><a-pr>unit</a-pr><a-p> </a-p><a-o>=</a-o><a-p> </a-p><a-s>&quot;  &quot;</a-s><a-p> }</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L44" href="#L44">44</a><span class="code-text"><a-p>language-server </a-p><a-o>=</a-o><a-p> { </a-p><a-pr>command</a-pr><a-p> </a-p><a-o>=</a-o><a-p> </a-p><a-s>&quot;mylang-lsp&quot;</a-s><a-p>, </a-p><a-pr>args</a-pr><a-p> </a-p><a-o>=</a-o><a-p> [</a-p><a-s>&quot;--stdio&quot;</a-s><a-p>], </a-p><a-pr>environment</a-pr><a-p> </a-p><a-o>=</a-o><a-p> { </a-p><a-s>&quot;ENV1&quot;</a-s><a-p> </a-p><a-o>=</a-o><a-p> </a-p><a-s>&quot;value1&quot;</a-s><a-p>, </a-p><a-s>&quot;ENV2&quot;</a-s><a-p> </a-p><a-o>=</a-o><a-p> </a-p><a-s>&quot;value2&quot;</a-s><a-p> } }</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L45" href="#L45">45</a><span class="code-text"><a-p>formatter </a-p><a-o>=</a-o><a-p> { </a-p><a-pr>command</a-pr><a-p> </a-p><a-o>=</a-o><a-p> </a-p><a-s>&quot;mylang-formatter&quot;</a-s><a-p> , </a-p><a-pr>args</a-pr><a-p> </a-p><a-o>=</a-o><a-p> [</a-p><a-s>&quot;--stdin&quot;</a-s><a-p>] }</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L46" href="#L46">46</a><span class="code-text"><a-p>```</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L47" href="#L47">47</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L48" href="#L48">48</a><span class="code-text"><a-p>These configuration keys are available:</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L49" href="#L49">49</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L50" href="#L50">50</a><span class="code-text"><a-p>| Key                   | Description                                                   |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L51" href="#L51">51</a><span class="code-text"><a-p>| ----                  | -----------                                                   |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L52" href="#L52">52</a><span class="code-text"><a-p>| `name`                | The name of the language                                      |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L53" href="#L53">53</a><span class="code-text"><a-p>| `scope`               | A string like `source.js` that identifies the language. Currently, we strive to match the scope names used by popular TextMate grammars and by the Linguist library. Usually `source.&lt;name&gt;` or `text.&lt;name&gt;` in case of markup languages |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L54" href="#L54">54</a><span class="code-text"><a-p>| `injection-regex`     | regex pattern that will be tested against a language name in order to determine whether this language should be used for a potential [language injection][treesitter-language-injection] site. |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L55" href="#L55">55</a><span class="code-text"><a-p>| `file-types`          | The filetypes of the language, for example `[&quot;yml&quot;, &quot;yaml&quot;]`. See the file-type detection section below. |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L56" href="#L56">56</a><span class="code-text"><a-p>| `shebangs`            | The interpreters from the shebang line, for example `[&quot;sh&quot;, &quot;bash&quot;]` |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L57" href="#L57">57</a><span class="code-text"><a-p>| `roots`               | A set of marker files to look for when trying to find the workspace root. For example `Cargo.lock`, `yarn.lock` |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L58" href="#L58">58</a><span class="code-text"><a-p>| `auto-format`         | Whether to autoformat this language when saving               |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L59" href="#L59">59</a><span class="code-text"><a-p>| `diagnostic-severity` | Minimal severity of diagnostic for it to be displayed. (Allowed values: `Error`, `Warning`, `Info`, `Hint`) |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L60" href="#L60">60</a><span class="code-text"><a-p>| `comment-token`       | The token to use as a comment-token                           |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L61" href="#L61">61</a><span class="code-text"><a-p>| `indent`              | The indent to use. Has sub keys `unit` (the text inserted into the document when indenting; usually set to N spaces or `&quot;\t&quot;` for tabs) and `tab-width` (the number of spaces rendered for a tab) |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L62" href="#L62">62</a><span class="code-text"><a-p>| `language-server`     | The Language Server to run. See the Language Server configuration section below. |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L63" href="#L63">63</a><span class="code-text"><a-p>| `config`              | Language Server configuration                                 |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L64" href="#L64">64</a><span class="code-text"><a-p>| `grammar`             | The tree-sitter grammar to use (defaults to the value of `name`) |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L65" href="#L65">65</a><span class="code-text"><a-p>| `formatter`           | The formatter for the language, it will take precedence over the lsp when defined. The formatter must be able to take the original file as input from stdin and write the formatted file to stdout |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L66" href="#L66">66</a><span class="code-text"><a-p>| `text-width`          |  Maximum line length. Used for the `:reflow` command and soft-wrapping if `soft-wrap.wrap-at-text-width` is set, defaults to `editor.text-width`   |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L67" href="#L67">67</a><span class="code-text"><a-p>| `workspace-lsp-roots`     | Directories relative to the workspace root that are treated as LSP roots. Should only be set in `.helix/config.toml`. Overwrites the setting of the same name in `config.toml` if set. |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L68" href="#L68">68</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L69" href="#L69">69</a><span class="code-text"><a-p>### </a-p><a-tt>File-type detection and the `file-types` key</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L70" href="#L70">70</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L71" href="#L71">71</a><span class="code-text"><a-p>Helix determines which language configuration to use based on the `file-types` key</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L72" href="#L72">72</a><span class="code-text"><a-p>from the above section. `file-types` is a list of strings or tables, for</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L73" href="#L73">73</a><span class="code-text"><a-p>example:</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L74" href="#L74">74</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L75" href="#L75">75</a><span class="code-text"><a-p>```</a-p><a-tl>toml</a-tl></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L76" href="#L76">76</a><span class="code-text"><a-p>file-types </a-p><a-o>=</a-o><a-p> [</a-p><a-s>&quot;Makefile&quot;</a-s><a-p>, </a-p><a-s>&quot;toml&quot;</a-s><a-p>, { </a-p><a-pr>suffix</a-pr><a-p> </a-p><a-o>=</a-o><a-p> </a-p><a-s>&quot;.git/config&quot;</a-s><a-p> }]</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L77" href="#L77">77</a><span class="code-text"><a-p>```</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L78" href="#L78">78</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L79" href="#L79">79</a><span class="code-text"><a-p>When determining a language configuration to use, Helix searches the file-types</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L80" href="#L80">80</a><span class="code-text"><a-p>with the following priorities:</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L81" href="#L81">81</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L82" href="#L82">82</a><span class="code-text"><a-p>1. Exact match: if the filename of a file is an exact match of a string in a</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L83" href="#L83">83</a><span class="code-text"><a-p>   `file-types` list, that language wins. In the example above, `&quot;Makefile&quot;`</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L84" href="#L84">84</a><span class="code-text"><a-p>   will match against `Makefile` files.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L85" href="#L85">85</a><span class="code-text"><a-p>2. Extension: if there are no exact matches, any `file-types` string that</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L86" href="#L86">86</a><span class="code-text"><a-p>   matches the file extension of a given file wins. In the example above, the</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L87" href="#L87">87</a><span class="code-text"><a-p>   `&quot;toml&quot;` matches files like `Cargo.toml` or `languages.toml`.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L88" href="#L88">88</a><span class="code-text"><a-p>3. Suffix: if there are still no matches, any values in `suffix` tables</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L89" href="#L89">89</a><span class="code-text"><a-p>   are checked against the full path of the given file. In the example above,</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L90" href="#L90">90</a><span class="code-text"><a-p>   the `{ suffix = &quot;.git/config&quot; }` would match against any `config` files</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L91" href="#L91">91</a><span class="code-text"><a-p>   in `.git` directories. Note: `/` is used as the directory separator but is</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L92" href="#L92">92</a><span class="code-text"><a-p>   replaced at runtime with the appropriate path separator for the operating</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L93" href="#L93">93</a><span class="code-text"><a-p>   system, so this rule would match against `.git\config` files on Windows.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L94" href="#L94">94</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L95" href="#L95">95</a><span class="code-text"><a-p>### </a-p><a-tt>Language Server configuration</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L96" href="#L96">96</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L97" href="#L97">97</a><span class="code-text"><a-p>The `language-server` field takes the following keys:</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L98" href="#L98">98</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L99" href="#L99">99</a><span class="code-text"><a-p>| Key           | Description                                                           |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L100" href="#L100">100</a><span class="code-text"><a-p>| ---           | -----------                                                           |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L101" href="#L101">101</a><span class="code-text"><a-p>| `command`     | The name of the language server binary to execute. Binaries must be in `$PATH` |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L102" href="#L102">102</a><span class="code-text"><a-p>| `args`        | A list of arguments to pass to the language server binary             |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L103" href="#L103">103</a><span class="code-text"><a-p>| `timeout`     | The maximum time a request to the language server may take, in seconds. Defaults to `20` |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L104" href="#L104">104</a><span class="code-text"><a-p>| `language-id` | The language name to pass to the language server. Some language servers support multiple languages and use this field to determine which one is being served in a buffer |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L105" href="#L105">105</a><span class="code-text"><a-p>| `environment` | Any environment variables that will be used when starting the language server `{ &quot;KEY1&quot; = &quot;Value1&quot;, &quot;KEY2&quot; = &quot;Value2&quot; }` |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L106" href="#L106">106</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L107" href="#L107">107</a><span class="code-text"><a-p>The top-level `config` field is used to configure the LSP initialization options. A `format`</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L108" href="#L108">108</a><span class="code-text"><a-p>sub-table within `config` can be used to pass extra formatting options to</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L109" href="#L109">109</a><span class="code-text"><a-p>[Document Formatting Requests](https://github.com/microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-16.md#document-formatting-request--leftwards_arrow_with_hook).</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L110" href="#L110">110</a><span class="code-text"><a-p>For example with typescript:</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L111" href="#L111">111</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L112" href="#L112">112</a><span class="code-text"><a-p>```</a-p><a-tl>toml</a-tl></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L113" href="#L113">113</a><span class="code-text"><a-p>[[</a-p><a-pr>language</a-pr><a-p>]]</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L114" href="#L114">114</a><span class="code-text"><a-p>name </a-p><a-o>=</a-o><a-p> </a-p><a-s>&quot;typescript&quot;</a-s></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L115" href="#L115">115</a><span class="code-text"><a-p>auto-format </a-p><a-o>=</a-o><a-p> </a-p><a-co>true</a-co></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L116" href="#L116">116</a><span class="code-text"><a-p># pass format options according to https://github.com/typescript-language-server/typescript-language-server#workspacedidchangeconfiguration omitting the &quot;[language].format.&quot; prefix.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L117" href="#L117">117</a><span class="code-text"><a-p>config </a-p><a-o>=</a-o><a-p> { </a-p><a-pr>format</a-pr><a-p> </a-p><a-o>=</a-o><a-p> { </a-p><a-s>&quot;semicolons&quot;</a-s><a-p> </a-p><a-o>=</a-o><a-p> </a-p><a-s>&quot;insert&quot;</a-s><a-p>, </a-p><a-s>&quot;insertSpaceBeforeFunctionParenthesis&quot;</a-s><a-p> </a-p><a-o>=</a-o><a-p> </a-p><a-co>true</a-co><a-p> } }</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L118" href="#L118">118</a><span class="code-text"><a-p>```</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L119" href="#L119">119</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L120" href="#L120">120</a><span class="code-text"><a-p>## </a-p><a-tt>Tree-sitter grammar configuration</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L121" href="#L121">121</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L122" href="#L122">122</a><span class="code-text"><a-p>The source for a language&#39;s tree-sitter grammar is specified in a `[[grammar]]`</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L123" href="#L123">123</a><span class="code-text"><a-p>section in `languages.toml`. For example:</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L124" href="#L124">124</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L125" href="#L125">125</a><span class="code-text"><a-p>```</a-p><a-tl>toml</a-tl></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L126" href="#L126">126</a><span class="code-text"><a-p>[[</a-p><a-pr>grammar</a-pr><a-p>]]</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L127" href="#L127">127</a><span class="code-text"><a-p>name </a-p><a-o>=</a-o><a-p> </a-p><a-s>&quot;mylang&quot;</a-s></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L128" href="#L128">128</a><span class="code-text"><a-p>source </a-p><a-o>=</a-o><a-p> { </a-p><a-pr>git</a-pr><a-p> </a-p><a-o>=</a-o><a-p> </a-p><a-s>&quot;https://github.com/example/mylang&quot;</a-s><a-p>, </a-p><a-pr>rev</a-pr><a-p> </a-p><a-o>=</a-o><a-p> </a-p><a-s>&quot;a250c4582510ff34767ec3b7dcdd3c24e8c8aa68&quot;</a-s><a-p> }</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L129" href="#L129">129</a><span class="code-text"><a-p>```</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L130" href="#L130">130</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L131" href="#L131">131</a><span class="code-text"><a-p>Grammar configuration takes these keys:</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L132" href="#L132">132</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L133" href="#L133">133</a><span class="code-text"><a-p>| Key      | Description                                                              |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L134" href="#L134">134</a><span class="code-text"><a-p>| ---      | -----------                                                              |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L135" href="#L135">135</a><span class="code-text"><a-p>| `name`   | The name of the tree-sitter grammar                                      |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L136" href="#L136">136</a><span class="code-text"><a-p>| `source` | The method of fetching the grammar - a table with a schema defined below |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L137" href="#L137">137</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L138" href="#L138">138</a><span class="code-text"><a-p>Where `source` is a table with either these keys when using a grammar from a</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L139" href="#L139">139</a><span class="code-text"><a-p>git repository:</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L140" href="#L140">140</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L141" href="#L141">141</a><span class="code-text"><a-p>| Key    | Description                                               |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L142" href="#L142">142</a><span class="code-text"><a-p>| ---    | -----------                                               |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L143" href="#L143">143</a><span class="code-text"><a-p>| `git`  | A git remote URL from which the grammar should be cloned  |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L144" href="#L144">144</a><span class="code-text"><a-p>| `rev`  | The revision (commit hash or tag) which should be fetched |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L145" href="#L145">145</a><span class="code-text"><a-p>| `subpath` | A path within the grammar directory which should be built. Some grammar repositories host multiple grammars (for example `tree-sitter-typescript` and `tree-sitter-ocaml`) in subdirectories. This key is used to point `hx --grammar build` to the correct path for compilation. When omitted, the root of repository is used |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L146" href="#L146">146</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L147" href="#L147">147</a><span class="code-text"><a-p>### </a-p><a-tt>Choosing grammars</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L148" href="#L148">148</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L149" href="#L149">149</a><span class="code-text"><a-p>You may use a top-level `use-grammars` key to control which grammars are</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L150" href="#L150">150</a><span class="code-text"><a-p>fetched and built when using `hx --grammar fetch` and `hx --grammar build`.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L151" href="#L151">151</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L152" href="#L152">152</a><span class="code-text"><a-p>```</a-p><a-tl>toml</a-tl></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L153" href="#L153">153</a><span class="code-text"><a-p># Note: this key must come **before** the [[language]] and [[grammar]] sections</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L154" href="#L154">154</a><span class="code-text"><a-p>use-grammars </a-p><a-o>=</a-o><a-p> { </a-p><a-pr>only</a-pr><a-p> </a-p><a-o>=</a-o><a-p> [ </a-p><a-s>&quot;rust&quot;</a-s><a-p>, </a-p><a-s>&quot;c&quot;</a-s><a-p>, </a-p><a-s>&quot;cpp&quot;</a-s><a-p> ] }</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L155" href="#L155">155</a><span class="code-text"><a-p># or</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L156" href="#L156">156</a><span class="code-text"><a-p>use-grammars </a-p><a-o>=</a-o><a-p> { </a-p><a-pr>except</a-pr><a-p> </a-p><a-o>=</a-o><a-p> [ </a-p><a-s>&quot;yaml&quot;</a-s><a-p>, </a-p><a-s>&quot;json&quot;</a-s><a-p> ] }</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L157" href="#L157">157</a><span class="code-text"><a-p>```</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L158" href="#L158">158</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L159" href="#L159">159</a><span class="code-text"><a-p>When omitted, all grammars are fetched and built.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L160" href="#L160">160</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L161" href="#L161">161</a><span class="code-text"><a-tu>[treesitter-language-injection]</a-tu><a-p>: </a-p><a-tu>https://tree-sitter.github.io/tree-sitter/syntax-highlighting#language-injection</a-tu></span></span></pre></div></div>
</main>
</body>
</html>
