aboutsummaryrefslogtreecommitdiff
path: root/crates/ide
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | move Semantics::visit_file_defs to ide_db::helpersLukas Wirth2021-03-152-2/+4
| | | |
| * | | Introduce Semantics::visit_file_defsLukas Wirth2021-03-152-67/+78
| | | |
* | | | Goto definition works for `S { a: }` caseAleksey Kladov2021-03-151-0/+11
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | What happens here is that we lower `: ` to a missing expression, and then correctly record that the corresponding field expression resolves to a specific field. Where we fail is in the mapping of syntax to this missing expression. Doing it via `ast_field.expr()` fails, as that expression is `None`. Instead, we go in the opposite direcition and ask each lowered field about its source. This works, but has wrong complexity `O(N)` and, really, the implementation is just too complex. We need some better management of data here.
| | |
| \ \
*-. \ \ Merge #8021 #8022bors[bot]2021-03-154-12/+24
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 8021: Enable searching for builtin types r=matklad a=Veykril Not too sure how useful this is for reference search overall, but for completeness sake it should be there ![image](https://user-images.githubusercontent.com/3757771/111132711-f69db600-8579-11eb-8c90-22fd6862d11f.png) Also enables document highlighting for them. 8022: some clippy::performance fixes r=matklad a=matthiaskrgr use vec![] instead of Vec::new() + push() avoid redundant clones use chars instead of &str for single char patterns in ends_with() and starts_with() allocate some Vecs with capacity to avoid unnecessary resizing Co-authored-by: Lukas Wirth <[email protected]> Co-authored-by: Matthias Krüger <[email protected]>
| | * | | some clippy::performance fixesMatthias Krüger2021-03-152-4/+3
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | use vec![] instead of Vec::new() + push() avoid redundant clones use chars instead of &str for single char patterns in ends_with() and starts_with() allocate some Vecs with capacity to avoid unneccessary resizing
| * | / Enable searching for builtin typesLukas Wirth2021-03-152-8/+21
| | |/ | |/|
* | | Move code to the appropriate layerAleksey Kladov2021-03-153-5/+11
| | | | | | | | | | | | | | | | | | StructureNodeKind is a type which is specific to a particular feature, file_structure. It shouldn't be in the "code shared by all ide features" part.
* | | Merge #7975bors[bot]2021-03-152-48/+192
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7975: Provide regions in file structure r=ivan770 a=ivan770 Closes #7913 https://user-images.githubusercontent.com/14003886/110819163-96b3c080-8296-11eb-993e-a7cdb574a12d.mp4 Co-authored-by: ivan770 <[email protected]>
| * | Introduce StructureNodeKindivan7702021-03-143-49/+94
| | |
| * | Added region intersection testivan7702021-03-141-0/+53
| | |
| * | Shorten trim callivan7702021-03-141-1/+1
| | |
| * | Provide regions in file structureivan7702021-03-142-4/+50
| | |
* | | Merge #7966bors[bot]2021-03-153-3/+317
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7966: Diagnose files that aren't in the module tree r=jonas-schievink a=jonas-schievink Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6377 I'm not sure if this is the best way to do this. It will cause false positives for all `include!`d files (though I'm not sure how much IDE functionality we have for these). Co-authored-by: Jonas Schievink <[email protected]>
| * | | Add module commentJonas Schievink2021-03-151-0/+2
| | | |
| * | | Use pub(crate)Jonas Schievink2021-03-151-3/+3
| | | |
| * | | Redo it properly and add a quickfixJonas Schievink2021-03-153-7/+309
| | | |
| * | | Diagnose files that aren't in the module treeJonas Schievink2021-03-101-3/+13
| | | |
* | | | Don't drop type params in doc-test pathsLukas Wirth2021-03-141-4/+51
| |/ / |/| |
* | | Merge #7799bors[bot]2021-03-132-6/+347
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7799: Related tests r=matklad a=vsrs ![tests](https://user-images.githubusercontent.com/62505555/109397453-a9013680-7947-11eb-8b11-ac03079f7645.gif) This adds an ability to look for tests for the item under the cursor: function, constant, data type, etc The LSP part is bound to change. But the feature itself already works and I'm looking for a feedback :) Co-authored-by: vsrs <[email protected]>
| * | Add `Feature: Related Tests` commentvsrs2021-03-111-0/+13
| | |
| * | Apply review suggestionsvsrs2021-03-111-2/+5
| | |
| * | Remove erroneous commentvsrs2021-02-271-10/+0
| | |
| * | Add runnables::related_testsvsrs2021-02-272-6/+341
| | |
* | | remove unused CompletionScore enumJosh Mcguigan2021-03-121-2/+2
| | |
* | | add completion relevance scoreJosh Mcguigan2021-03-121-2/+2
| | |
* | | 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
|/ /
* | Compilation speedAleksey Kladov2021-03-091-1/+1
| |
* | 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-088-52/+51
| |
* | 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]>
| * | corrected no newline at end of fileLuciano Bestia2021-02-131-1/+1
| | |
| * | removed logging stuffLuciano Bestia2021-02-132-9/+1
| | |
| * | 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-052-25/+8
| | |
| * | added region foldingLuciano Bestia2021-01-182-8/+72
| | |
* | | 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
| | |