`TinyBoxedStr` is a small-string optimized replacement for `Box<str>`
styled after <https://cedardb.com/blog/german_strings/>. A nearly
identical type is used in helix-editor/spellbook for space savings.
This type is specialized for its use-case:
* strings are immutable after creation
* strings are very very small (less than 256 bytes long)
Because of these attributes we can use nearly the full size of the type
for the inline representation and also keep a small total size. Many
other small string crates in the wild are 3 `usize`s long (same as a
regular `String`) to support mutability. This type is more like a
`Box<str>` (2 `usize`s long).
Mostly I like this small string type though because it's very
straightforward to implement. Other than a few functions that reach into
`std::alloc` or `std::ptr`, the code is short and boring.
This type also exists on `Editor`. This change brings it to the
`Document` as well because the replacement for `Syntax` in the child
commits will eliminate `Syntax`'s copy of `syn_loader`. `Syntax` will
also be responsible for returning the highlighter and query iterators
(which will borrow the loader), so the loader must be separated from
that type.
In the long run, when we make a larger refactor to have
`Document::apply` be a function of the `Editor` instead of the
`Document`, we will be able to drop this field on `Document` - it is
currently only necessary for `Document::apply`. Once we make that
refactor, we will be able to eliminate the surrounding `Arc` in
`Arc<ArcSwap<syntax::Loader>>` and use the `ArcSwap` directly instead.
This is for convenience when testing a few languages or themes, for
example while updating a language's parser and queries. query-check in
particular can take a while since parser initialization and query
analysis can each take some time and there are now many many languages.
Specifying the exact language makes the feedback loop much faster.
* Other languages use `comment.unused` instead of `comment.discard`.
* Fix the precedence of discarded variables - previously the parameter
highlight was higher precedence so discarded variables in the
parameter list were highlighted as parameters instead of
`comment.unused`.
The old check would allow sending textDocument/documentColor requests
when the server declared `{"colorProvider": false}` in its capabilities
as this was `Some`:
Some(ColorProviderCapability::Simple(false))
The Julia language server sets this explicitly to `false` in the wild.