aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src
Commit message (Collapse)AuthorAgeFilesLines
*-. Merge #3998 #4006bors[bot]2020-04-244-56/+324
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 3998: Make add_function generate functions in other modules via qualified path r=matklad a=TimoFreiberg Additional feature for #3639 - [x] Add tests for paths with more segments - [x] Make generating the function in another file work - [x] Add `pub` or `pub(crate)` to the generated function if it's generated in a different module - [x] Make the assist jump to the edited file - [x] Enable file support in the `check_assist` helper 4006: Syntax highlighting for format strings r=matklad a=ltentrup I have an implementation for syntax highlighting for format string modifiers `{}`. The first commit refactors the changes in #3826 into a separate struct. The second commit implements the highlighting: first we check in a macro call whether the macro is a format macro from `std`. In this case, we remember the format string node. If we encounter this node during syntax highlighting, we check for the format modifiers `{}` using regular expressions. There are a few places which I am not quite sure: - Is the way I extract the macro names correct? - Is the `HighlightTag::Attribute` suitable for highlighting the `{}`? Let me know what you think, any feedback is welcome! Co-authored-by: Timo Freiberg <[email protected]> Co-authored-by: Leander Tentrup <[email protected]> Co-authored-by: Leander Tentrup <[email protected]>
| | * Adapt format specifier highlighting to support escaped squences and unicode ↵Leander Tentrup2020-04-223-22/+51
| | | | | | | | | | | | identifiers
| | * Apply suggestions from code reviewLeander Tentrup2020-04-221-4/+3
| | | | | | | | | | | | Co-Authored-By: bjorn3 <[email protected]>
| | * Implement syntax highlighting for format stringsLeander Tentrup2020-04-203-3/+208
| | | | | | | | | | | | | | | | | | | | | Detailed changes: 1) Implement a lexer for string literals that divides the string in format specifier `{}` including the format specifier modifier. 2) Adapt syntax highlighting to add ranges for the detected sequences. 3) Add a test case for the format string syntax highlighting.
| | * Refactor flattening logic for highlighted syntax rangesLeander Tentrup2020-04-181-54/+85
| | |
| * | Add target file information to AssistActionTimo Freiberg2020-04-211-0/+4
| | |
* | | Don't omit methods with self from path completionJonas Schievink2020-04-241-6/+38
| | |
* | | Adds attribute completions (#3941)Roberto Vidal2020-04-244-0/+594
| | |
* | | Better label for macros completionAleksey Kladov2020-04-245-48/+59
| | |
* | | Honor snippet capabilityAleksey Kladov2020-04-241-0/+6
| | | | | | | | | | | | closes #2518
* | | Make sure that adding a snippet requires corresponding capabilityAleksey Kladov2020-04-246-44/+107
| | |
* | | Introduce internal snippet capAleksey Kladov2020-04-241-0/+13
| | |
* | | Move CompletionConfig to a separate moduleAleksey Kladov2020-04-242-19/+20
| | |
* | | Add test marksAleksey Kladov2020-04-242-0/+6
| | |
* | | Introduce ActiveParameterAleksey Kladov2020-04-245-30/+35
| | |
* | | Move tests to where they belongAleksey Kladov2020-04-242-231/+231
| | |
* | | RefactorAleksey Kladov2020-04-241-24/+18
| | |
* | | Restore CompletionItem immutabilityAleksey Kladov2020-04-242-31/+23
| | |
* | | More functionalAleksey Kladov2020-04-242-11/+18
| | |
* | | MoveAleksey Kladov2020-04-231-9/+9
| | |
* | | Merge #3954bors[bot]2020-04-237-28/+388
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 3954: Improve autocompletion by looking on the type and name r=matklad a=bnjjj This tweet (https://twitter.com/tjholowaychuk/status/1248918374731714560) gaves me the idea to implement that in rust-analyzer. Basically for this first example I made some examples when we are in a function call definition. I look on the parameter list to prioritize autocompletions for the same types and if it's the same type + the same name then it's displayed first in the completion list. So here is a draft, first step to open a discussion and know what you think about the implementation. It works (cf tests) but maybe I can make a better implementation at some places. Be careful the code needs some refactoring to be better and concise. PS: It was lot of fun writing this haha Co-authored-by: Benjamin Coenen <[email protected]>
| * | | Improve autocompletion by looking on the type and nameBenjamin Coenen2020-04-211-3/+1
| | | | | | | | | | | | | | | | Signed-off-by: Benjamin Coenen <[email protected]>
| * | | Merge branch 'master' of github.com:rust-analyzer/rust-analyzerBenjamin Coenen2020-04-217-27/+52
| |\| |
| * | | Improve autocompletion by looking on the type and nameBenjamin Coenen2020-04-214-48/+47
| | | | | | | | | | | | | | | | Signed-off-by: Benjamin Coenen <[email protected]>
| * | | Merge branch 'master' of github.com:rust-analyzer/rust-analyzerBenjamin Coenen2020-04-187-18/+140
| |\ \ \ | | | |/ | | |/|
| * | | feat: improve dot completions with scoringBenjamin Coenen2020-04-171-5/+1
| | | | | | | | | | | | | | | | Signed-off-by: Benjamin Coenen <[email protected]>
| * | | Merge branch 'master' of github.com:rust-analyzer/rust-analyzerBenjamin Coenen2020-04-171-1/+1
| |\ \ \
| * | | | feat: improve dot completions with scoringBenjamin Coenen2020-04-174-77/+52
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Benjamin Coenen <[email protected]>
| * | | | feat: improve dot completions with scoringBenjamin Coenen2020-04-166-108/+91
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Benjamin Coenen <[email protected]>
| * | | | feat: improve dot completions in a struct literal expressionBenjamin Coenen2020-04-154-31/+196
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Benjamin Coenen <[email protected]>
| * | | | Merge branch 'master' of github.com:rust-analyzer/rust-analyzerBenjamin Coenen2020-04-145-11/+37
| |\ \ \ \
| * | | | | Improve autocompletion by looking on the type and name, change ↵Benjamin Coenen2020-04-123-26/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | implementation, include sort in Completions struct Signed-off-by: Benjamin Coenen <[email protected]>
| * | | | | Improve autocompletion by looking on the type and nameBenjamin Coenen2020-04-1110-41/+103
| |\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Benjamin Coenen <[email protected]>
| * | | | | | Improve autocompletion by looking on the type and nameBenjamin Coenen2020-04-116-30/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Benjamin Coenen <[email protected]>
* | | | | | | Merge #4065bors[bot]2020-04-232-7/+217
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4065: Complete unqualified enum names in patterns and expressions r=matklad a=nathanwhit This PR implements the completion described in #4014. The result looks like so for patterns: <img width="542" alt="Screen Shot 2020-04-20 at 3 53 55 PM" src="https://user-images.githubusercontent.com/17734409/79794010-8f529400-831f-11ea-9673-f838aa9bc962.png"> and for `expr`s: <img width="620" alt="Screen Shot 2020-04-21 at 3 51 24 PM" src="https://user-images.githubusercontent.com/17734409/79908784-d73ded80-83e9-11ea-991d-921f0cb27e6f.png"> I'm not confident that the completion text itself is very robust, as it will unconditionally add completions for enum variants with the form `Enum::Variant`. This means (I believe) it would still suggest `Enum::Variant` even if the local name is changed i.e. `use Enum as Foo` or the variants are brought into scope such as through `use Enum::*`. Co-authored-by: nathanwhit <[email protected]>
| * | | | | | | Update tests to reflect new completionsnathanwhit2020-04-221-1/+1
| | | | | | | |
| * | | | | | | Add tests for enum completionnathanwhit2020-04-221-0/+178
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds tests for completion of enum variants in match arms, if-let statements, and basic expressions.
| * | | | | | | Complete unqualified enum variants when possiblenathanwhit2020-04-221-5/+26
| | | | | | | |
| * | | | | | | Add utility fn for expected type of a nodenathanwhit2020-04-221-1/+12
| | |_|_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | Adds `expected_type_of` to `CompletionContext` to return the expected type of a node, if it is known.
* | | | | | | Remove SyntaxPtr::range from more placesAleksey Kladov2020-04-231-1/+1
| | | | | | |
* | | | | | | feat: run ignored testsHannes De Valkeneer2020-04-221-2/+33
| |_|_|_|_|/ |/| | | | |
* | | | | | Some clippy fixesJeremy Kolb2020-04-191-1/+1
| | | | | |
* | | | | | Fix goto definition for record patternsAleksey Kladov2020-04-181-6/+22
| | | | | |
* | | | | | Add semantic tag for unresolved referencesAleksey Kladov2020-04-184-20/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a quick way to implement unresolved reference diagnostics. For example, adding to VS Code config "editor.tokenColorCustomizationsExperimental": { "unresolvedReference": "#FF0000" }, will highlight all unresolved refs in red.
* | | | | | Merge #4029bors[bot]2020-04-181-0/+6
|\ \ \ \ \ \ | |/ / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4029: Fix various proc-macro bugs r=matklad a=edwin0cheng This PRs does the following things: 1. Fixed #4001 by splitting `LIFETIME` lexer token to two mbe tokens. It is because rustc token stream expects `LIFETIME` as a combination of punct and ident, but RA `tt:TokenTree` treats it as a single `Ident` previously. 2. Fixed #4003, by skipping `proc-macro` for completion. It is because currently we don't have `AstNode` for `proc-macro`. We would need to redesign how to implement `HasSource` for `proc-macro`. 3. Fixed a bug how empty `TokenStream` merging in `proc-macro-srv` such that no L_DOLLAR and R_DOLLAR will be emitted accidentally. Co-authored-by: Edwin Cheng <[email protected]>
| * | | | | Ignore proc-macro in completionEdwin Cheng2020-04-181-0/+6
| | | | | |
* | | | | | Merge #4026bors[bot]2020-04-181-1/+10
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4026: Omit more parameter hints in the presence of underscores r=matklad a=lnicola Fixes #4017. Co-authored-by: Laurențiu Nicola <[email protected]>
| * | | | | | Omit more parameter hints in the presence of underscoresLaurențiu Nicola2020-04-181-1/+10
| |/ / / / /
* / / / / / Fix incorrect order of syntax highlight rangesLeander Tentrup2020-04-172-1/+14
|/ / / / /
* | | | | Don\t suggest import itself as a completion for importAleksey Kladov2020-04-172-1/+40
| | | | |