helix-mods/helix-core/src
Galen Abell 581a1ebf5d
Add glob file type support (#8006)
* Replace FileType::Suffix with FileType::Glob

Suffix is rather limited and cannot be used to match files which have
semantic meaning based on location + file type (for example, Github
Action workflow files). This patch adds support for a Glob FileType to
replace Suffix, which encompasses the existing behavior & adds
additional file matching functionality.

Globs are standard Unix-style path globs, which are matched against the
absolute path of the file. If the configured glob for a language is a
relative glob (that is, it isn't an absolute path or already starts with
a glob pattern), a glob pattern will be prepended to allow matching
relative paths from any directory.

The order of file type matching is also updated to first match on globs
and then on extension. This is necessary as most cases where
glob-matching is useful will have already been matched by an extension
if glob matching is done last.

* Convert file-types suffixes to globs

* Use globs for filename matching

Trying to match the file-type raw strings against both filename and
extension leads to files with the same name as the extension having the
incorrect syntax.

* Match dockerfiles with suffixes

It's common practice to add a suffix to dockerfiles based on their
context, e.g. `Dockerfile.dev`, `Dockerfile.prod`, etc.

* Make env filetype matching more generic

Match on `.env` or any `.env.*` files.

* Update docs

* Use GlobSet to match all file type globs at once

* Update todo.txt glob patterns

* Consolidate language Configuration and Loader creation

This is a refactor that improves the error handling for creating
the `helix_core::syntax::Loader` from the default and user language
configuration.

* Fix integration tests

* Add additional starlark file-type glob

---------

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2024-02-11 18:24:20 +01:00
..
doc_formatter Feat: LSP Type Hints (#5934) 2023-03-11 11:32:14 +09:00
increment Fix new clippy lints (#5892) 2023-02-09 16:27:08 -06:00
auto_pairs.rs Fix erroneous indent between closers of auto-pairs (#5330) 2022-12-29 09:23:40 -06:00
chars.rs Temporarily turn on unicode-lines 2022-03-17 10:53:50 +09:00
comment.rs Prevent a panic when uncommenting a line with only a comment token (#5933) 2023-02-12 13:13:22 -06:00
config.rs Add glob file type support (#8006) 2024-02-11 18:24:20 +01:00
diagnostic.rs make diagnostics stick to word boundaries 2023-12-27 15:28:14 +09:00
diff.rs delete outdated reference to cessen/ropey#25 (#4928) 2022-11-28 19:07:47 -06:00
doc_formatter.rs rework positioning/rendering and enable softwrap/virtual text (#5420) 2023-02-01 02:03:19 +09:00
fuzzy.rs Don't use word splitting during fuzzy matching (#8192) 2023-09-06 23:03:48 +09:00
graphemes.rs Prevent GraphemeStrs created from Strings from leaking (#7920) 2023-08-12 20:13:06 -05:00
history.rs Prefer RopeSlice to &Rope in helix_core::syntax 2023-07-27 11:50:19 +09:00
indent.rs Bump tree-sitter to latest master (#9317) 2024-01-15 15:33:26 +09:00
lib.rs Create helix-stdx crate for stdlib extensions 2024-01-18 10:57:53 +09:00
line_ending.rs Add config for default line ending (#5621) 2023-06-16 12:02:15 -05:00
macros.rs Split parts of helix-term into helix-view. 2020-09-21 18:24:16 +09:00
match_brackets.rs Use injection syntax trees for bracket matching 2024-01-28 18:13:33 +09:00
movement.rs Respect injections in movement::move_parent_node_end 2024-01-28 18:13:33 +09:00
object.rs Fix edge-case in tree-sitter expand_selection selection command (#2877) 2022-06-25 13:12:30 -05:00
position.rs Fix typos (#6643) 2023-04-07 23:10:38 +08:00
rope_reader.rs search buffer contents during global search (#5652) 2023-07-11 21:26:11 +09:00
search.rs Jump to the next number on the line before incrementing (#1778) 2022-04-01 22:14:37 +09:00
selection.rs Add '#' and '.' special registers 2023-07-31 15:05:38 +09:00
shellwords.rs Fix typos (#6643) 2023-04-07 23:10:38 +08:00
surround.rs Fix warnings from clippy (#7013) 2023-05-11 14:44:52 +09:00
syntax.rs Add glob file type support (#8006) 2024-02-11 18:24:20 +01:00
test.rs fix test::plain 2023-03-20 18:34:40 -05:00
text_annotations.rs Fix typos (#6643) 2023-04-07 23:10:38 +08:00
textobject.rs fix test::plain 2023-03-20 18:34:40 -05:00
transaction.rs make diagnostics stick to word boundaries 2023-12-27 15:28:14 +09:00
wrap.rs don't break on hyphen with :reflow (#8569) 2023-10-21 07:58:36 -05:00