aboutsummaryrefslogtreecommitdiff
path: root/crates
Commit message (Collapse)AuthorAgeFilesLines
* Remove some stale deprecationsAleksey Kladov2021-01-075-12/+5
|
* Align config's API with usageAleksey Kladov2021-01-0622-162/+164
| | | | The config now is mostly immutable, optimize for that.
* Merge #7183bors[bot]2021-01-067-78/+32
|\ | | | | | | | | | | | | | | | | 7183: YAGNI active_resolve_capabilities r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * YAGNI active_resolve_capabilitiesAleksey Kladov2021-01-067-78/+32
| | | | | | | | | | | | | | | | | | This leaks a lot of LSP details into ide layer, which we want to avoid: https://github.com/rust-analyzer/rust-analyzer/tree/c9cec381bcfd97e5f3536e31a9c546ab5c0665e6/docs/dev#lsp-independence Additionally, all what this infra does is providing a toggle for auto-import completion, but we already have one!
* | Replace last usages of difference with dissimilarJesse Bakker2021-01-063-5/+17
| |
* | Merge #7181bors[bot]2021-01-062-2/+27
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | 7181: Document project_model::PackageData and project_model::TargetData r=arnaudgolfouse a=arnaudgolfouse This PR adds some documentation for the `project_model` crate. Some of the field descriptions were taken directly from their `cargo_metadata` counterpart : - `PackageData` -> `cargo_metadata::Package` - `TargetData` -> `cargo_metadata::Target` Co-authored-by: Arnaud <[email protected]>
| * Document `project_model::TargetData`Arnaud2021-01-061-0/+6
| | | | | | | | This adds a description for `TargetData` and all its fields.
| * Document `project_model::PackageData`Arnaud2021-01-061-0/+16
| | | | | | | | This adds a description for `PackageData` and all its fields.
| * Make `PackageData`, `TargetData` and `PackageDependency` publicArnaud2021-01-061-2/+5
| | | | | | | | | | This makes them discoverable through documentation. They were already publicly accessible through `Package` and `Target`.
* | More readable testAleksey Kladov2021-01-061-2/+12
| |
* | Less confusing instr statAleksey Kladov2021-01-061-1/+5
|/
* Better target for move moduleAleksey Kladov2021-01-063-35/+47
|
* Merge #7177bors[bot]2021-01-063-6/+6
|\ | | | | | | | | | | | | | | | | 7177: Speed up snapshoting r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * Speed up snapshotingAleksey Kladov2021-01-063-6/+6
| | | | | | | | Config can be fairly big, no need to deep clone it frequently
* | Merge #7172bors[bot]2021-01-0614-442/+412
|\| | | | | | | | | | | | | | | 7172: refactor config to be lossless & precise r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
| * More maintainable configAleksey Kladov2021-01-0614-442/+412
| | | | | | | | | | | | | | Rather than eagerly converting JSON, we losslessly keep it as is, and change the shape of user-submitted data at the last moment. This also allows us to remove a bunch of wrong Defaults
* | Merge #7176bors[bot]2021-01-061-13/+9
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | 7176: Attribute completion r=matklad a=FlowerBOII Solve #7167. I removed the optional args for the attributes ```deprecated```, ```must_use``` and ```should_panic```. I also updated their respective tests. Please let me know if I missed something. Co-authored-by: FlowerBOII <[email protected]>
| * Change the should_panic completion and his related attribute testFlowerBOII2021-01-061-7/+3
| |
| * Remove the args for the must_use attibute and change the related testsFlowerBOII2021-01-061-3/+3
| |
| * Update deprecated testFlowerBOII2021-01-061-3/+3
| |
| * Remove a part of the deprecated autocompletionFlowerBOII2021-01-061-1/+1
| |
* | Merge #7174bors[bot]2021-01-061-3/+15
|\ \ | |/ |/| | | | | | | | | | | | | 7174: Normalize line endings when formatting r=matklad a=Jesse-Bakker Fixes #7166 Co-authored-by: Jesse Bakker <[email protected]>
| * Normalize line endings when formattingJesse Bakker2021-01-051-3/+15
| |
* | Merge #7170bors[bot]2021-01-056-83/+124
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | 7170: More maintainable caps config r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * | More maintainable caps configAleksey Kladov2021-01-056-83/+124
| | | | | | | | | | | | | | | The idea here is that we preserve client's config as is, without changes. This gets rid of state!
* | | Emit diagnostics for unresolved item-level macrosJonas Schievink2021-01-051-1/+32
|/ /
* | Merge #7168bors[bot]2021-01-0516-26/+31
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | 7168: Rename expr -> tail_expr r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * | Rename expr -> tail_exprAleksey Kladov2021-01-0516-26/+31
| | |
* | | Merge #7140bors[bot]2021-01-054-117/+197
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7140: Store trait associated items in fst r=matklad a=SomeoneToIgnore Store imported traits' associated function/methods and constants into `ImportMap.fst` and pefrorm the imports search on them. This is a first step towards trait autoimport during completion functionality, the way I see it, after this PR, only a few major things are left to be done: * store all traits' assoc items into fst, not only the ones in scope, as we do now. Any code pointers on how to do this are welcome 😄 * adjust a few modules in completions crate (`dot.rs`, `qualified_path.rs` at least) to query the import map, reusing the `import_assets` logic heavily == With the current import and autoimport implementations, it looks like for a single query, we're either interested in either associated items lookup or in all other `fst` contents lookup, but never both simultaneously. I would rather not split `fst` in two but add another `Query` parameter to separate those, but let me know if you have any ideas. Co-authored-by: Kirill Bulatov <[email protected]>
| * | Move the test markKirill Bulatov2021-01-051-2/+4
| | |
| * | Small helpersKirill Bulatov2021-01-042-1/+5
| | |
| * | Code review fixesKirill Bulatov2021-01-043-42/+50
| | |
| * | Do not collect trait type aliasesKirill Bulatov2021-01-041-5/+6
| | |
| * | Ignore associated items during unqialified path fuzzy completionsKirill Bulatov2021-01-041-1/+9
| | |
| * | SimplifyKirill Bulatov2021-01-042-27/+37
| | |
| * | Properly check assoc items lookupKirill Bulatov2021-01-042-46/+73
| | |
| * | Add associated data into fstKirill Bulatov2021-01-041-49/+45
| | |
| * | Add a basic test for the trait fuzzy importKirill Bulatov2021-01-041-0/+24
| | |
* | | Merge #7131bors[bot]2021-01-053-0/+227
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7131: Created an assist for inlining a function's body into its caller r=matklad a=Michael-F-Bryan This introduces an `inline_function` assist which will convert code like this: ```rust fn add(a: u32, b: u32) -> u32 { a + b } fn main() { let x = add<|>(1, 2); } ``` Into something like this: ```rust fn add(a: u32, b: u32) -> u32 { a + b } fn main() { let x = { let a = 1; let b = 2; a + b }; } ``` Fixes #6863. Co-authored-by: Michael-F-Bryan <[email protected]>
| * | | Created an inline-function assist (fixes #6863)Michael-F-Bryan2021-01-043-0/+227
| | | |
* | | | Merge #7162bors[bot]2021-01-052-12/+55
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7162: Introduce queries to avoid problems when performing completion for enums with many variants r=matklad a=danielframpton This change introduces two new queries to compute: 1) attributes for all variants of an enum, and 2) attributes for all fields of a variant. The purpose of this change is to avoid the current n^2 behavior when rendering completion for variants (which prevents completion for enums with large numbers of variants). Co-authored-by: Daniel Frampton <[email protected]>
| * | | | Introduce new queries to computeDaniel Frampton2021-01-052-12/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1) the set of attributes for all variants of an enum, and 2) the set of attributes for all fields of a variant. This avoids the current n^2 behavior when rendering completion for variants, which prevents completion for enums with large numbers of variants.
* | | | | Merge #7164bors[bot]2021-01-051-3/+2
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7164: Allow `#anchor` linking of config options r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
| * | | | | Allow `#anchor` linking of config optionsAleksey Kladov2021-01-051-3/+2
| | |/ / / | |/| | |
* | | | | Merge #7160bors[bot]2021-01-041-0/+12
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7160: Get `hir::Function` return type r=flodiebold a=arnaudgolfouse Hello ! As said in #7158, I noticed that `hir::Function` has no direct way of getting the return type, so this PR adds this functionality. Co-authored-by: Arnaud <[email protected]>
| * | | | | Remove `RetType`Arnaud2021-01-041-18/+3
| | | | | |
| * | | | | Document `hir::Function::ret_type`Arnaud2021-01-041-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds documentation for the newly added function. It might be a bit too detailed, but I like it that way :)
| * | | | | Make it possible to retrieve `hir::Function`'s return typeArnaud2021-01-041-0/+23
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | This is done by adding a `ret_type` method to `hir::Function`. I followed `assoc_fn_params` convention by creating a new `RetType` type, that contains the actual return type accessible via a `ty` method.
* | | | | Merge #7147bors[bot]2021-01-042-3/+60
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7147: ssr: Allow replacing expressions with statements r=davidlattimore a=MarijnS95 Depends on #6587 Until that is merged, the diff is https://github.com/MarijnS95/rust-analyzer/compare/stmt..replace-expr-with-stmt --- Now that statements can be matched and replaced (#6587) some usecases require expressions to be replaced with statements as well. This happens when something that can ambiguously be an expression or statement like `if` and loop blocks appear in the last position of a block, as trailing expression. In this case a replacement pattern of the form `if foo(){$a();}==>>$a();` will only substitute `if` blocks in the list of statements but not if they (implicitly) end up in the trailing expression, where they are not wrapped by an EXPR_STMT (but the pattern and template are, as parsing only succeeds for the `stmt ==>> stmt` case). Instead of adding two rules that match an expression - and emit duplicate matching errors - allow the template for expressions to be a statement if it fails to parse as an expression. --- Another gross change that does not seem to break any tests currently, but perhaps a safeguard should be added to only allow this kind of replacement in blocks by "pushing" the replacement template to the statement list and clearing the trailing expression? CC @davidlattimore Co-authored-by: Marijn Suijten <[email protected]>
| * | | | ssr: Allow replacing expressions with statementsMarijn Suijten2021-01-042-3/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that statements can be matched and replaced (#6587) some usecases require expressions to be replaced with statements as well. This happens when something that can ambiguously be an expression or statement like `if` and loop blocks appear in the last position of a block, as trailing expression. In this case a replacement pattern of the form `if foo(){$a();}==>>$a();` will only substitute `if` blocks in the list of statements but not if they (implicitly) end up in the trailing expression, where they are not wrapped by an EXPR_STMT (but the pattern and template are, as parsing only succeeds for the `stmt ==>> stmt` case). Instead of adding two rules that match an expression - and emit duplicate matching errors - allow the template for expressions to be a statement if it fails to parse as an expression.