Symbol resolution for `clojure.core.match/match`
Problem
The lack of macro support for clojure.core.match means, that
- the symbols defined in matching patterns are marked as unresolved, preventing eg. rename-refactoring
- indentation is not as expected
The only related issue - as of 2022-05-03 - is this: https://github.com/cursive-ide/cursive/issues/1832
Solution
Symbol resolution
Most of the features mentioned on the https://github.com/clojure/core.match/wiki/Basic-usage page would involve symbols, but they are quirky.
- for vectors any element can be a symbol and there is support for rest arguments
- in maps, the value part can introduce bindings for sure (but maybe the key part too?)
- if there are local bindings with the same name as a symbol, symbols act as a reference to the corresponding local binding
- within parens, bindings can be introduced after an
:orkeyword, but should be ignored after:only,:<<(function application) and:guard - probably all of these rules apply recursively for nested vectors, lists and maps
Indentation
Some examples in the core.match README an wiki suggest that clojure.core.match/match should be indented the same way as clojure.core/case.
Until support arrives, I set the symbol resolution of clojure.core.match/match to None, to avoid underlining of bindings and indentation to Indent, so the value to be matched can be on the same line as (match ..., while the pattern-value pairs are only indented with 2 space.
This however, doesn't let me expand selection to pattern-value pairs, only to either the pattern or value, then the whole match-expression.