<p>Next, you need to add the language to the <ahref="https://github.com/helix-editor/helix/blob/master/languages.toml"><code>languages.toml</code></a> found in the root of
the repository; this <code>languages.toml</code> file is included at compilation time, and
is distinct from the <code>language.toml</code> file in the user's <ahref="../configuration.html">configuration
<tr><td>name</td><td>The name of the language</td></tr>
<tr><td>scope</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.<name></code> or <code>text.<name></code> in case of markup languages</td></tr>
<tr><td>injection-regex</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 <ahref="https://tree-sitter.github.io/tree-sitter/syntax-highlighting#language-injection">language injection</a> site.</td></tr>
<tr><td>file-types</td><td>The filetypes of the language, for example <code>["yml", "yaml"]</code></td></tr>
<tr><td>shebangs</td><td>The interpreters from the shebang line, for example <code>["sh", "bash"]</code></td></tr>
<tr><td>roots</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>auto-format</td><td>Whether to autoformat this language when saving</td></tr>
<tr><td>diagnostic-severity</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>comment-token</td><td>The token to use as a comment-token</td></tr>
<tr><td>indent</td><td>The indent to use. Has sub keys <code>tab-width</code> and <code>unit</code></td></tr>
<tr><td>config</td><td>Language server configuration</td></tr>
<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.<name></code> or <code>text.<name></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 <ahref="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>. Extensions and full file names are supported.</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>tab-width</code> and <code>unit</code></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>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>
<p>Or a <code>path</code> key with an absolute path to a locally available grammar directory.</p>
<p>If you get errors when building after switching branches, you may have to remove or update tree-sitter submodules. You can update submodules by running</p>
<p>Make sure to not use the <code>--remote</code> flag. To remove submodules look inside the <code>.gitmodules</code> and remove directories that are not present inside of it.</p>
<p>If you get errors when running after switching branches, you may have to update the tree-sitter grammars. Run <code>hx --grammar fetch</code> to fetch the grammars and <code>hx --grammar build</code> to build any out-of-date grammars.</p>
</li>
<li>
<p>If a parser is segfaulting or you want to remove the parser, make sure to remove the submodule <em>and</em> the compiled parser in <code>runtime/grammar/<name>.so</code></p>
<p>If a parser is segfaulting or you want to remove the parser, make sure to remove the compiled parser in <code>runtime/grammar/<name>.so</code></p>
</li>
<li>
<p>The indents query is <code>indents.toml</code>, <em>not</em><code>indents.scm</code>. See <ahref="https://github.com/helix-editor/helix/issues/114">this</a> issue for more information.</p>
<p>Language-specific settings and settings for particular language servers can be configured in a <code>languages.toml</code> file placed in your <ahref="./configuration.html">configuration directory</a>. Helix actually uses two <code>languages.toml</code> files, the <ahref="https://github.com/helix-editor/helix/blob/master/languages.toml">first one</a> is in the main helix repository; it contains the default settings for each language and is included in the helix binary at compile time. Users who want to see the available settings and options can either reference the helix repo's <code>languages.toml</code> file, or consult the table in the <ahref="./guides/adding_languages.html">adding languages</a> section.</p>
<p>Changes made to the <code>languages.toml</code> file in a user's <ahref="./configuration.html">configuration directory</a> are merged with helix's defaults on start-up, such that a user's settings will take precedence over defaults in the event of a collision. For example, the default <code>languages.toml</code> sets rust's <code>auto-format</code> to <code>true</code>. If a user wants to disable auto-format, they can change the <code>languages.toml</code> in their <ahref="./configuration.html">configuration directory</a> to make the rust entry read like the example below; the new key/value pair <code>auto-format = false</code> will override the default when the two sets of settings are merged on start-up:</p>
<pre><code># in <config_dir>/helix/languages.toml
<pre><codeclass="language-toml"># in <config_dir>/helix/languages.toml
<p>(Currently not fully documented, see the <ahref="./keymap.html">keymappings</a> list for more.)</p>
<p>See <ahref="https://github.com/helix-editor/helix/blob/master/runtime/tutor.txt">tutor.txt</a> (accessible via <code>hx --tutor</code> or <code>:tutor</code>) for a vimtutor-like introduction.</p>
@ -1148,47 +1152,84 @@ j = { k = "normal_mode" } # Maps `jk` to exit insert mode
<p>Language-specific settings and settings for particular language servers can be configured in a <code>languages.toml</code> file placed in your <ahref="./configuration.html">configuration directory</a>. Helix actually uses two <code>languages.toml</code> files, the <ahref="https://github.com/helix-editor/helix/blob/master/languages.toml">first one</a> is in the main helix repository; it contains the default settings for each language and is included in the helix binary at compile time. Users who want to see the available settings and options can either reference the helix repo's <code>languages.toml</code> file, or consult the table in the <ahref="./guides/adding_languages.html">adding languages</a> section.</p>
<p>Changes made to the <code>languages.toml</code> file in a user's <ahref="./configuration.html">configuration directory</a> are merged with helix's defaults on start-up, such that a user's settings will take precedence over defaults in the event of a collision. For example, the default <code>languages.toml</code> sets rust's <code>auto-format</code> to <code>true</code>. If a user wants to disable auto-format, they can change the <code>languages.toml</code> in their <ahref="./configuration.html">configuration directory</a> to make the rust entry read like the example below; the new key/value pair <code>auto-format = false</code> will override the default when the two sets of settings are merged on start-up:</p>
<pre><code># in <config_dir>/helix/languages.toml
<pre><codeclass="language-toml"># in <config_dir>/helix/languages.toml
<p>Next, you need to add the language to the <ahref="https://github.com/helix-editor/helix/blob/master/languages.toml"><code>languages.toml</code></a> found in the root of
the repository; this <code>languages.toml</code> file is included at compilation time, and
is distinct from the <code>language.toml</code> file in the user's <ahref="guides/../configuration.html">configuration
<tr><td>name</td><td>The name of the language</td></tr>
<tr><td>scope</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.<name></code> or <code>text.<name></code> in case of markup languages</td></tr>
<tr><td>injection-regex</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 <ahref="https://tree-sitter.github.io/tree-sitter/syntax-highlighting#language-injection">language injection</a> site.</td></tr>
<tr><td>file-types</td><td>The filetypes of the language, for example <code>["yml", "yaml"]</code></td></tr>
<tr><td>shebangs</td><td>The interpreters from the shebang line, for example <code>["sh", "bash"]</code></td></tr>
<tr><td>roots</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>auto-format</td><td>Whether to autoformat this language when saving</td></tr>
<tr><td>diagnostic-severity</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>comment-token</td><td>The token to use as a comment-token</td></tr>
<tr><td>indent</td><td>The indent to use. Has sub keys <code>tab-width</code> and <code>unit</code></td></tr>
<tr><td>config</td><td>Language server configuration</td></tr>
<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.<name></code> or <code>text.<name></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 <ahref="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>. Extensions and full file names are supported.</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>tab-width</code> and <code>unit</code></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>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>
<p>Or a <code>path</code> key with an absolute path to a locally available grammar directory.</p>
<p>If you get errors when building after switching branches, you may have to remove or update tree-sitter submodules. You can update submodules by running</p>
<p>Make sure to not use the <code>--remote</code> flag. To remove submodules look inside the <code>.gitmodules</code> and remove directories that are not present inside of it.</p>
<p>If you get errors when running after switching branches, you may have to update the tree-sitter grammars. Run <code>hx --grammar fetch</code> to fetch the grammars and <code>hx --grammar build</code> to build any out-of-date grammars.</p>
</li>
<li>
<p>If a parser is segfaulting or you want to remove the parser, make sure to remove the submodule <em>and</em> the compiled parser in <code>runtime/grammar/<name>.so</code></p>
<p>If a parser is segfaulting or you want to remove the parser, make sure to remove the compiled parser in <code>runtime/grammar/<name>.so</code></p>
</li>
<li>
<p>The indents query is <code>indents.toml</code>, <em>not</em><code>indents.scm</code>. See <ahref="https://github.com/helix-editor/helix/issues/114">this</a> issue for more information.</p>