ftplugin/hare.vim: undo compiler settings
This commit fixes the 'errorformat' and 'makeprg' options not being
correctly reset when changing filetype.
Signed-off-by: Amelia Clarke <selene@perilune.dev>
compiler/hare.vim: remove :CompilerSet definition
This removes the fallback definition for :CompilerSet, bringing hare.vim
in line with the official Vim repository.
Signed-off-by: Amelia Clarke <selene@perilune.dev>
doc/ft_hare.txt: add additional documentation
Signed-off-by: Amelia Clarke <selene@perilune.dev>
filetype.vim: detect haredoc README files
This commit allows automatic detection and highlighting of README files
inside Hare modules. A recursive directory search for Hare source files
is used as a simple heuristic to determine whether to set the "haredoc"
filetype for a README file (since README is a common filename in other
places).
Because a recursive directory search has the potential to impact
performance, this behavior must be opted into by setting
`g:filetype_haredoc`. The search depth is also configurable using
`g:haredoc_search_depth`, though the default value should work for
situations.
Signed-off-by: Amelia Clarke <selene@perilune.dev>
syntax/hare.vim: clean up detection of `!` and `?`
This commit uses `:syn-nextgroup` and the groundwork laid in the
previous commit to tremendously simplify the detection of the `!`
operator for error assertion. Both it and the `?` operator have been
moved to the same syntax group.
Additionally, the default highlighting for both operators has been
changed to "Special" instead of a pre-defined color. This makes the
highlighting less rigid and avoids making assumptions about which color
is likely to stand out visually. This will generally integrate better
with most colorschemes. To replicate the old behavior, you can add the
following line to your vimrc:
hi! def hareErrorTest guifg=red gui=bold ctermfg=red cterm=bold
Signed-off-by: Amelia Clarke <selene@perilune.dev>
syntax/hare.vim: detect postfix expressions
The use of `:syn-nextgroup` enables reliable detection of field access
expressions, preventing constructions like `foo.0.1` from being
incorrectly highlighted as containing a float. This commit also adds
detection for indexing and slicing operations, nested expressions, and
function calls, which will serve as a foundation for simplifying the
detection of the error assertion operator.
Signed-off-by: Amelia Clarke <selene@perilune.dev>
syntax/hare.vim: simplify matching of `size`
The previous implementation was correct and accounted for all known edge
cases, but to my knowledge the `size` builtin is always immediately
followed by an open paren, except for the purpose of demonstrating
intentionally bad style. The forward lookahead used to search for an
open paren was relatively expensive and added a great deal of complexity
that is never used in practice.
The purpose of this plugin is *not* to highlight all code that would be
accepted by the compiler, but rather to perform highlighting on a
best-effort basis that is adequate for most needs. It is not worth the
added complexity to support overly pathological edge cases.
Signed-off-by: Amelia Clarke <selene@perilune.dev>
syntax/hare.vim: simplify rune and string literals
This commit reverses my previous decisions regarding escape and format
sequences in the interest of simplicity.
Invalid escape sequences no longer receive special highlighting, as it
does not convey any additional information that is not already present,
seeing as only valid escape sequences are matched by hareEscape.
Format sequences have also been simplified to remove the special
handling for raw strings. A `_` followed by an escape sequence is
already quite an uncommon format modifier, and with raw strings being as
infrequent as they are, the situations where these two conditions would
overlap are rare enough that I don't consider them worth the added
complexity.
Signed-off-by: Amelia Clarke <selene@perilune.dev>
syntax/hare.vim: slightly reorganize syntax groups
Signed-off-by: Amelia Clarke <selene@perilune.dev>
syntax/hare.vim: embed haredoc syntax in comments
Signed-off-by: Amelia Clarke <selene@perilune.dev>
ftplugin/hare.vim: search for modules in HAREPATH
Signed-off-by: Amelia Clarke <selene@perilune.dev>
ftplugin/hare.vim: reorganize formatting settings
Signed-off-by: Amelia Clarke <selene@perilune.dev>