6521: Switch to upstream protocol for resolving code action r=matklad a=matklad
Note that we have to maintain custom implementation on the client
side: I don't see how to marry bulitin resolve support with groups and
snippets.
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
6472: Add `static` modifier for associated functions r=matklad a=p3achyjr
Adds static semantic token modifier to associated functions, resolves#6194
## Info
- Associated functions are more-or-less equivalent to static methods in other languages. This PR checks, for each function, whether that function has a self_param, and whether it's enclosed in a trait/impl.
## Changes
- Added method ```is_associated``` to code_model::Function. This basically gets the source from the ast, and checks whether the enclosing scope is an impl or trait.
- Added `static` to HighlightModifiers
- Added unit test
## Tests
- Ran ```cargo test```
Co-authored-by: Anatol Liu <axlui@anatols-mbp.lan>
6501: Remove text_edit_builder api from AssistBuilder r=matklad a=Veykril
Also fixes a small bug in `expand_glob_import` in regards to the very nice looking `something::{*}` import when only one item was used. Before it would duplicate the path and just append it, causing the following wrong import `something::something::UsedItem`.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
6500: Add some postfix snippet r=matklad a=pksunkara
Nothing much to explain. Just a simple addition. I was recently doing some refactoring and this would have made it a bit more faster.
Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
6491: Textmate grammar: allow variables to terminate ranges r=dustypomerleau a=dustypomerleau
Variables were originally designed not to match after a dot, in order to avoid matching struct field access, however this resulted in variables that end ranges not being highlighted. In order to fix this we match a preceding dot, only if it's preceded by at least one other dot. Attempting to match on `(\.{2,})?` won't work, because the optional group allows struct field access to match even when one dot is present.
Co-authored-by: Dusty Pomerleau <dustypomerleau@users.noreply.github.com>
6490: Minimize convert_integer_literal tests r=matklad a=m-ysk
Closes#6455
This PR removes some redundant tests around convert_integer_literal.
First, it removes test cases about converting integer with underscores except for just one case. This is because the process of removing of underscores in given integer literals is independent from radix.
Second, as well as underscore cases, it removes test cases about converting integer with suffix except for just one case. This is because the process of handling suffix is independent from radix.
Finally, it removes small decimal integer cases. This is because "special case where they return early" has been removed by the PR #6482, so we have no need to retain this cases.
Co-authored-by: m-ysk <myskjp@gmail.com>
6489: Textmate grammar: Precedence fixes r=dustypomerleau a=dustypomerleau
- prevent `pat` from matching before `path` in metavariable types
- reduce the precedence of math operators so that assignment operators match correctly
Co-authored-by: Dusty Pomerleau <dustypomerleau@users.noreply.github.com>
- prevent `pat` from matching before `path` in metavariable types
- reduce the precedence of math operators so that assignment operators match correctly
6477: Add infer_function_return_type assist r=matklad a=Veykril
This adds an assist to insert a functions return type if it hasn't been specified yet by inferring it from the functions tail expression. This assist only becomes active if the cursor is on the tail expression. See https://github.com/rust-analyzer/rust-analyzer/issues/6303#issuecomment-714657326
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>