aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Return original text range in PrepareRename responses when inside macroLukas Wirth2021-03-101-7/+47
| |/ |/|
* | Merge #7958bors[bot]2021-03-101-0/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | 7958: Avoid double text edits when renaming mod declaration r=matklad a=Veykril Closes https://github.com/rust-analyzer/rust-analyzer/issues/7916 See https://github.com/microsoft/vscode-languageserver-node/issues/752 for context Co-authored-by: Lukas Wirth <[email protected]>
| * | Avoid double text edits when renaming mod declarationLukas Wirth2021-03-101-0/+1
| | |
* | | add apply ssr assistJosh Mcguigan2021-03-102-1/+266
|/ /
* | Show whether a binding is mutable or not on hoverLukas Wirth2021-03-092-21/+46
| |
* | Don't show const items initializer expressions on hoverLukas Wirth2021-03-091-5/+1
| |
* | Work towards better import labelsKirill Bulatov2021-03-081-2/+0
| |
* | Use upstream cov-markLaurențiu Nicola2021-03-087-52/+50
| |
* | Fix some warningsLaurențiu Nicola2021-03-051-1/+1
| |
* | Prevent renaming SelfType and BuiltinTypeLukas Wirth2021-03-031-0/+2
| |
* | Reorder functions in rename.rsLukas Wirth2021-03-031-189/+187
| |
* | Merge #7850bors[bot]2021-03-021-12/+62
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | 7850: Don't add space when joining line to opening quote r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * | Don't add space when joining line to opening quoteAleksey Kladov2021-03-021-12/+62
| | |
* | | Merge #7795bors[bot]2021-03-021-13/+122
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7795: Show docs on hover for keywords and primitives r=matklad a=Veykril ![lAWFadkziX](https://user-images.githubusercontent.com/3757771/109369534-eeb4f500-789c-11eb-8f2b-2f9c4e129de3.gif) It's a bit annoying that this requires the `SyntaxNode` and `Semantics` to be pulled through `hover_for_definition` just so we can get the `std` crate but I couldn't think of a better way. Co-authored-by: Lukas Wirth <[email protected]>
| * | | Show docs on hover for keywords and primitivesLukas Wirth2021-03-021-13/+122
| |/ /
* | | Merge #7335 #7691bors[bot]2021-03-021-8/+47
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7335: added region folding r=matklad a=LucianoBestia Regions of code that you'd like to be folded can be wrapped with `// #region` and `// #endregion` line comments. This is called "Region Folding". It is originally available for many languages in VSCode. But Rust-analyzer has its own folding function and this is missing. With this Pull Request I am suggesting a simple solution. The regions are a special kind of comments, so I added a bit of code in the comment folding function. The regex to match are: `^\s*//\s*#?region\b` and `^\s*//\s*#?endregion\b`. The number of space characters is not important. There is an optional # character. The line can end with a name of the region. Example: ```rust // 1. some normal comment // region: test // 2. some normal comment calling_function(x,y); // endregion: test ``` I added a test for this new functionality in `folding_ranges.rs`. Please, take a look and comment. I found that these exact regexes are already present in the file `language-configuration.json`, but I don't find a way to read this configuration. So my regex is hardcoded in the code. 7691: Suggest name in extract variable r=matklad a=cpud36 Generate better default name in extract variable assist as was mentioned in issue #1587 # Currently supported (in order of declining precedence) 1. Expr is argument to a function; use corresponding parameter name 2. Expr is result of a function or method call; use this function/method's name 3. Use expr type name (if possible) 4. Fallback to `var_name` otherwise # Showcase ![generate_derive_variable_name_from_method](https://user-images.githubusercontent.com/4218373/108013304-72105400-701c-11eb-9f13-eec52e74d0cc.gif) ![generate_derive_variable_name_from_param](https://user-images.githubusercontent.com/4218373/108013305-72a8ea80-701c-11eb-957e-2214f7f005de.gif) # Questions * Should we more aggressively strip known types? E.g. we already strip `&T -> T`; should we strip `Option<T> -> T`, `Result<T, E> -> T`, and others? * Integers and floats use `var_name` by default. Should we introduce a name, like `i`, `f` etc? * Can we return a list and suggest a name when renaming(like IntelliJ does)? * Should we add counters to remove duplicate variables? E.g. `type`, `type1`, type2`, etc. Co-authored-by: Luciano Bestia <[email protected]> Co-authored-by: Luciano <[email protected]> Co-authored-by: Vladyslav Katasonov <[email protected]>
| * | removed logging stuffLuciano Bestia2021-02-131-7/+0
| | |
| * | Update crates/ide/src/folding_ranges.rsLuciano2021-02-131-2/+2
| | | | | | | | | Co-authored-by: Lukas Wirth <[email protected]>
| * | simple comparison instead of regexLuciano Bestia2021-02-051-21/+7
| | |
| * | added region foldingLuciano Bestia2021-01-181-8/+68
| | |
* | | Merge #7778bors[bot]2021-03-011-0/+29
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7778: Fix lowering trailing self paths in UseTrees r=Veykril a=Veykril Noticed that hovering over `self` in a use tree like `use foo::bar::{self}` showing documentation and such for the current module instead of `bar`. Co-authored-by: Lukas Wirth <[email protected]>
| * | | Fix lowering trailing self paths in UseTreesLukas Wirth2021-02-281-0/+29
| | |/ | |/|
* | | Update vscode README with a small features listLukas Wirth2021-03-012-0/+18
| | |
* | | For unresolved macros, hightlight only the last segmentAleksey Kladov2021-02-281-11/+56
|/ /
* | Pickup ConstReference patterns in FindUsagesLukas Wirth2021-02-231-0/+25
| |
* | 7526: Renamed create ssr to ide_ssr.Chetan Khilosiya2021-02-221-3/+4
| |
* | 7526: Rename crate assists to ide_assists.Chetan Khilosiya2021-02-224-4/+4
| |
* | Merge #7732bors[bot]2021-02-201-2/+2
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7732: Don't lower TypeBound::Lifetime as GenericPredicate::Error r=flodiebold a=Veykril Basically we just discard the typebound for now instead when lowering to `GenericPredicate`. I think this shouldn't have any other side effects? Fixes #7683(hopefully for real this time) I also played around with introducing `GenericPredicate::LifetimeOutlives` and `GenericPredicate::TypeOutlives`(see https://github.com/Veykril/rust-analyzer/commit/b9d69048451a5f2e9c5a72c800369bbeef36fdcf) but that won't fix this issue(at least not for now) due to lifetime predicate mismatches when resolving methods so I figure this is a good way to fix it for now. Co-authored-by: Lukas Wirth <[email protected]>
| * | Don't lower TypeBound::Lifetime as GenericPredicate::ErrorLukas Wirth2021-02-201-2/+2
| | |
* | | Remove documentation of obsolete extend selection commandLaurențiu Nicola2021-02-201-3/+5
|/ /
* | rename completion -> ide_completionAleksey Kladov2021-02-171-4/+4
| | | | | | | | We don't have completion-related PRs in flight, so lets do it
* | Merge #7699bors[bot]2021-02-172-58/+31
|\ \ | | | | | | | | | | | | | | | | | | | | | 7699: Implement ast::AstNode for NameLike and move it to node_ext r=matklad a=Veykril With this `search`(and 2 other modules) don't necessarily go through 3 calls of `find_node_at_offset_with_descend` to find the correct node. Also makes the code that searches for NameLikes a bit easier on the eyes imo, though that can be fixed with just a helper function as well so its not that relevant. Co-authored-by: Lukas Wirth <[email protected]>
| * | Implement ast::AstNode for NameLike and move it to node_extLukas Wirth2021-02-162-58/+31
| | |
* | | Merge #7705bors[bot]2021-02-171-2/+38
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7705: Show hover info of the definition of ConstReference patterns instead of its type r=Veykril a=Veykril Closes #7671 bors r+ Co-authored-by: Lukas Wirth <[email protected]>
| * | | Show hover info of the definition of ConstReference patterns instead of its typeLukas Wirth2021-02-171-2/+38
| |/ /
* / / Allow comments between newlines in chaining hintsPaco Soberón2021-02-161-16/+22
|/ /
* | Merge #7657bors[bot]2021-02-161-1/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7657: utf8 r=matklad a=matklad - Prepare for utf-8 offsets - reduce code duplication in tests - Make utf8 default, implement utf16 in terms of it - Make it easy to add additional context for offset conversion - Implement utf8 offsets closes #7453 Co-authored-by: Aleksey Kladov <[email protected]>
| * | Make utf8 default, implement utf16 in terms of itAleksey Kladov2021-02-161-1/+1
| | |
| * | Prepare for utf-8 offsetsAleksey Kladov2021-02-161-1/+1
| | |
* | | Fix a few clippy::perf warningskjeremy2021-02-164-5/+7
|/ /
* | Actually fix runnable orderivan7702021-02-151-20/+20
| |
* | Merge #7656bors[bot]2021-02-141-100/+170
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7656: Implement constructor usage search for almost all items r=matklad a=Veykril This PR moves the filering for enum constructors to the HIR, with this unprefixed variants as well as when the enum has been renamed via use will then still show up properly. We now walk the ast of the `NameRef` up until we find a `PathExpr`(which also handles `CallExpr` for tuple-type structs and variants already) or a `RecordExpr`. For enum search we then take the `path` out of that expression and do a resolution on it to compare it with the definition enum. With this PR we now support searching for all constructor literals, Unit-, Tuple- and Record-Structs, Unit-, Tuple- and Record-Variants as well as Unions. There is one shortcoming due to how the search is triggered. Unit Variants constructors can't be searched as we have no position for it to kick off the search(since a comma doesn't have to exist for the last variant). Closes #2549 though it doesn't implement it as outlined in the issue since the reference kind was removed recently, though I believe the approach taken here is better personally. Co-authored-by: Lukas Wirth <[email protected]>
| * | Only use HIR when searching for enum constructors, otherwise fall back to ASTLukas Wirth2021-02-131-48/+34
| | |
| * | Implement constructor usage search for almost all itemsLukas Wirth2021-02-121-105/+189
| | | | | | | | | | | | | | | | | | | | | For all struct kinds, unions and enums, as well as for record- and tuple-variants but not for unit-variants, as these have no trailing character we can anchor the search to. Functionality wise it is implemented though.
* | | Merge #7668bors[bot]2021-02-141-48/+131
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7668: Finalize rename infra rewrite r=matklad a=Veykril This should be the final PR in regards to rewriting rename stuff, #4290. It addresses 3 things: - Currently renaming import aliases causes some undesired behavior(see #5198) which is why this PR causes us to just return an error if an attempt at renaming an alias is made for the time being. Though this only prevents it from happening when the alias import is renamed, so its not too helpful. - Fixes #6898 - If we are inside a macro file simply rename the input name node as there isn't really a way to do any of the fancy shorthand renames and similar things as for that we would have to exactly know what the macro generates and what not. Co-authored-by: Lukas Wirth <[email protected]>
| * | | Don't rename field record patterns directlyLukas Wirth2021-02-131-36/+71
| | | |
| * | | Fallback to renaming input NameRef node for macros when inside macroLukas Wirth2021-02-131-16/+53
| | | |
| * | | Prevent aliases from being renamed for nowLukas Wirth2021-02-131-13/+24
| | | |
* | | | Don't classify attribute macros as their path unless it's a function with ↵Lukas Wirth2021-02-131-0/+35
|/ / / | | | | | | | | | the proc_macro_attribute attribute
* | | Make annotations tests similar to those in runnablesivan7702021-02-131-188/+707
| | |