mirror of https://github.com/helix-editor/helix
deploy: 581a1ebf5d
parent
e9b9e647a5
commit
ed0780d1a9
|
@ -250,23 +250,25 @@ language-servers = [ "mylang-lsp" ]
|
||||||
<p>Helix determines which language configuration to use based on the <code>file-types</code> key
|
<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
|
from the above section. <code>file-types</code> is a list of strings or tables, for
|
||||||
example:</p>
|
example:</p>
|
||||||
<pre><code class="language-toml">file-types = ["Makefile", "toml", { suffix = ".git/config" }]
|
<pre><code class="language-toml">file-types = ["toml", { glob = "Makefile" }, { glob = ".git/config" }, { glob = ".github/workflows/*.yaml" } ]
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>When determining a language configuration to use, Helix searches the file-types
|
<p>When determining a language configuration to use, Helix searches the file-types
|
||||||
with the following priorities:</p>
|
with the following priorities:</p>
|
||||||
<ol>
|
<ol>
|
||||||
<li>Exact match: if the filename of a file is an exact match of a string in a
|
<li>Glob: values in <code>glob</code> tables are checked against the full path of the given
|
||||||
<code>file-types</code> list, that language wins. In the example above, <code>"Makefile"</code>
|
file. Globs are standard Unix-style path globs (e.g. the kind you use in Shell)
|
||||||
will match against <code>Makefile</code> files.</li>
|
and can be used to match paths for a specific prefix, suffix, directory, etc.
|
||||||
<li>Extension: if there are no exact matches, any <code>file-types</code> string that
|
In the above example, the <code>{ glob = "Makefile" }</code> config would match files
|
||||||
matches the file extension of a given file wins. In the example above, the
|
with the name <code>Makefile</code>, the <code>{ glob = ".git/config" }</code> config would match
|
||||||
<code>"toml"</code> matches files like <code>Cargo.toml</code> or <code>languages.toml</code>.</li>
|
<code>config</code> files in <code>.git</code> directories, and the <code>{ glob = ".github/workflows/*.yaml" }</code>
|
||||||
<li>Suffix: if there are still no matches, any values in <code>suffix</code> tables
|
config would match any <code>yaml</code> files in <code>.github/workflow</code> directories. Note
|
||||||
are checked against the full path of the given file. In the example above,
|
that globs should always use the Unix path separator <code>/</code> even on Windows systems;
|
||||||
the <code>{ suffix = ".git/config" }</code> would match against any <code>config</code> files
|
the matcher will automatically take the machine-specific separators into account.
|
||||||
in <code>.git</code> directories. Note: <code>/</code> is used as the directory separator but is
|
If the glob isn't an absolute path or doesn't already start with a glob prefix,
|
||||||
replaced at runtime with the appropriate path separator for the operating
|
<code>*/</code> will automatically be added to ensure it matches for any subdirectory.</li>
|
||||||
system, so this rule would match against <code>.git\config</code> files on Windows.</li>
|
<li>Extension: if there are no glob 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>
|
||||||
|
config matches files like <code>Cargo.toml</code> or <code>languages.toml</code>.</li>
|
||||||
</ol>
|
</ol>
|
||||||
<h2 id="language-server-configuration"><a class="header" href="#language-server-configuration">Language Server configuration</a></h2>
|
<h2 id="language-server-configuration"><a class="header" href="#language-server-configuration">Language Server configuration</a></h2>
|
||||||
<p>Language servers are configured separately in the table <code>language-server</code> in the same file as the languages <code>languages.toml</code></p>
|
<p>Language servers are configured separately in the table <code>language-server</code> in the same file as the languages <code>languages.toml</code></p>
|
||||||
|
|
|
@ -2184,23 +2184,25 @@ language-servers = [ "mylang-lsp" ]
|
||||||
<p>Helix determines which language configuration to use based on the <code>file-types</code> key
|
<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
|
from the above section. <code>file-types</code> is a list of strings or tables, for
|
||||||
example:</p>
|
example:</p>
|
||||||
<pre><code class="language-toml">file-types = ["Makefile", "toml", { suffix = ".git/config" }]
|
<pre><code class="language-toml">file-types = ["toml", { glob = "Makefile" }, { glob = ".git/config" }, { glob = ".github/workflows/*.yaml" } ]
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>When determining a language configuration to use, Helix searches the file-types
|
<p>When determining a language configuration to use, Helix searches the file-types
|
||||||
with the following priorities:</p>
|
with the following priorities:</p>
|
||||||
<ol>
|
<ol>
|
||||||
<li>Exact match: if the filename of a file is an exact match of a string in a
|
<li>Glob: values in <code>glob</code> tables are checked against the full path of the given
|
||||||
<code>file-types</code> list, that language wins. In the example above, <code>"Makefile"</code>
|
file. Globs are standard Unix-style path globs (e.g. the kind you use in Shell)
|
||||||
will match against <code>Makefile</code> files.</li>
|
and can be used to match paths for a specific prefix, suffix, directory, etc.
|
||||||
<li>Extension: if there are no exact matches, any <code>file-types</code> string that
|
In the above example, the <code>{ glob = "Makefile" }</code> config would match files
|
||||||
matches the file extension of a given file wins. In the example above, the
|
with the name <code>Makefile</code>, the <code>{ glob = ".git/config" }</code> config would match
|
||||||
<code>"toml"</code> matches files like <code>Cargo.toml</code> or <code>languages.toml</code>.</li>
|
<code>config</code> files in <code>.git</code> directories, and the <code>{ glob = ".github/workflows/*.yaml" }</code>
|
||||||
<li>Suffix: if there are still no matches, any values in <code>suffix</code> tables
|
config would match any <code>yaml</code> files in <code>.github/workflow</code> directories. Note
|
||||||
are checked against the full path of the given file. In the example above,
|
that globs should always use the Unix path separator <code>/</code> even on Windows systems;
|
||||||
the <code>{ suffix = ".git/config" }</code> would match against any <code>config</code> files
|
the matcher will automatically take the machine-specific separators into account.
|
||||||
in <code>.git</code> directories. Note: <code>/</code> is used as the directory separator but is
|
If the glob isn't an absolute path or doesn't already start with a glob prefix,
|
||||||
replaced at runtime with the appropriate path separator for the operating
|
<code>*/</code> will automatically be added to ensure it matches for any subdirectory.</li>
|
||||||
system, so this rule would match against <code>.git\config</code> files on Windows.</li>
|
<li>Extension: if there are no glob 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>
|
||||||
|
config matches files like <code>Cargo.toml</code> or <code>languages.toml</code>.</li>
|
||||||
</ol>
|
</ol>
|
||||||
<h2 id="language-server-configuration"><a class="header" href="#language-server-configuration">Language Server configuration</a></h2>
|
<h2 id="language-server-configuration"><a class="header" href="#language-server-configuration">Language Server configuration</a></h2>
|
||||||
<p>Language servers are configured separately in the table <code>language-server</code> in the same file as the languages <code>languages.toml</code></p>
|
<p>Language servers are configured separately in the table <code>language-server</code> in the same file as the languages <code>languages.toml</code></p>
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue