aboutsummaryrefslogtreecommitdiff
path: root/crates
Commit message (Collapse)AuthorAgeFilesLines
* Add diagnostic types for unresolved crates/importsJonas Schievink2020-09-163-19/+128
|
* Store `Import` indices for later reconstructionJonas Schievink2020-09-163-4/+9
|
* Avoid checking all ancestors and fix mis-completionoxalica2020-09-151-33/+215
|
* inline parameters for a function description #6002Benjamin Coenen2020-09-151-5/+6
| | | | Signed-off-by: Benjamin Coenen <[email protected]>
* inline parameters for a function description #6002Benjamin Coenen2020-09-152-1/+29
| | | | Signed-off-by: Benjamin Coenen <[email protected]>
* Merge #5976bors[bot]2020-09-141-56/+119
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5976: Complete trait impl immediately after type/const/fn r=jonas-schievink a=oxalica Currently, we can complete type/const/fn but only if we typed an identifier. That is, `impl .. { fn f<|> }` has completions with all trait fn including `f`, but `impl .. { fn <|> }` doesn't provide any suggestion (even if explicit trigger it). This PR tweak the logic of completion match to make it possible. However, we still need to explicit trigger suggestions (`Control + Space` by default) in vscode to show. Not sure if we can make it automatically triggered after typing the space after `fn`. Another question is that I cannot figure out why `BLOCK_EXPR` need to be checked. A block expr directly inside a impl block should be invalid, and nested items will failed to locate impl block in specific offset and skip the suggestion. Now I simply removed it and no tests are broken. https://github.com/rust-analyzer/rust-analyzer/blob/4f91478e50dc5c2a87235e9be8bd91e3f62de4b4/crates/ide/src/completion/complete_trait_impl.rs#L109 Co-authored-by: oxalica <[email protected]>
| * Complete trait impl immediately after type/const/fnoxalica2020-09-111-56/+119
| |
* | Merge #5985bors[bot]2020-09-148-17/+50
|\ \ | | | | | | | | | | | | | | | | | | | | | 5985: Make MergeBehaviour configurable r=jonas-schievink a=Veykril This should make the newly implemented `MergeBehaviour` for import insertion configurable as roughly outlined in https://github.com/rust-analyzer/rust-analyzer/pull/5935#issuecomment-685834257. For the config name and the like I just picked what came to mind so that might be up for bikeshedding. Co-authored-by: Lukas Wirth <[email protected]>
| * | Make MergeBehaviour configurableLukas Wirth2020-09-128-17/+50
| | |
* | | Merge #5971bors[bot]2020-09-1312-55/+314
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5971: Implement async blocks r=flodiebold a=oxalica Fix #4018 @flodiebold already gave a generic guide in the issue. Here's some concern about implementation detail: - Chalk doesn't support generator type yet. - Adding generator type as a brand new type (ctor) can be complex and need to *re-introduced* builtin impls. (Like how we implement closures before native closure support of chalk, which is already removed in #5401 ) - The output type of async block should be known after type inference of the whole body. - We cannot directly get the type from source like return-positon-impl-trait. But we still need to provide trait bounds when chalk asking for `opaque_ty_data`. - During the inference, the output type of async block can be temporary unknown and participate the later inference. `let a = async { None }; let _: i32 = a.await.unwrap();` So in this PR, the type of async blocks is inferred as an opaque type parameterized by the `Future::Output` type it should be, like what we do with closure type. And it really works now. Well, I still have some questions: - The bounds `AsyncBlockImplType<T>: Future<Output = T>` is currently generated in `opaque_ty_data`. I'm not sure if we should put this code here. - Type of async block is now rendered as `impl Future<Output = OutputType>`. Do we need to special display to hint that it's a async block? Note that closure type has its special format, instead of `impl Fn(..) -> ..` or function type. Co-authored-by: oxalica <[email protected]>
| * | | Fix type walking about type of async blockoxalica2020-09-113-14/+78
| | | |
| * | | Fix and prettify commentsoxalica2020-09-111-4/+6
| | | |
| * | | Implement async blocksoxalica2020-09-1011-55/+248
| | | |
* | | | Implement box pattern inferenceJonas Schievink2020-09-123-2/+20
| | | |
* | | | Add box pattern testJonas Schievink2020-09-121-0/+25
| |/ / |/| |
* | | Properly preserve macro bracesKirill Bulatov2020-09-111-25/+16
| | |
* | | Merge #5955bors[bot]2020-09-112-82/+114
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5955: Remove merge import code duplication r=jonas-schievink a=Veykril This removes the code duplication caused by #5935, this also allows the assist to merge imports that have equal visibility and prevents merges of unequal visibility. This PR also fixes an iteration mistake in the mentioned PR: Turns out I made a mistake when writing the `segment_iter` function, I was assuming that the `children` of a path will just be the segments, which is obviously not the case. This also brings insertion order of shorter paths in line with how `rustfmt` orders them. Co-authored-by: Lukas Wirth <[email protected]>
| * | | Allow merge_imports assists to merge imports of equal visibilityLukas Wirth2020-09-052-6/+61
| | | |
| * | | Remove duplicated import merge logicLukas Wirth2020-09-052-77/+43
| | | |
| * | | Fix segment_iter not iterating segments properlyLukas Wirth2020-09-051-5/+16
| |/ /
| | |
| \ \
*-. \ \ Merge #5951 #5975bors[bot]2020-09-1114-34/+53
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5951: Rename record_field_pat to record_pat_field r=jonas-schievink a=pksunkara The token was renamed but not this. 5975: Report better errors in project.json/sysroot r=jonas-schievink a=jonas-schievink This does a bunch of light refactoring so that the `Sysroot` is loaded later, which makes sure that any errors are reported to the user. I then added a check that reports an error if libcore is missing in the loaded sysroot. Since a sysroot without libcore is very useless, this indicates a configuration error. Co-authored-by: Pavan Kumar Sunkara <[email protected]> Co-authored-by: Jonas Schievink <[email protected]>
| | * | | Report better errors in project.json/sysrootJonas Schievink2020-09-114-17/+36
| | | |/ | | |/|
| * | | Rename record_field_pat to record_pat_fieldPavan Kumar Sunkara2020-09-1010-17/+17
| | | |
* | | | Merge #5970bors[bot]2020-09-111-37/+118
|\ \ \ \ | |_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | 5970: Use better heuristics for replacement text when removing dbg! r=jonas-schievink a=SomeoneToIgnore Closes https://github.com/rust-analyzer/rust-analyzer/issues/5911 Co-authored-by: Kirill Bulatov <[email protected]>
| * | | One more testKirill Bulatov2020-09-101-0/+2
| | | |
| * | | Use better heuristics for replacement text when removing dbg!Kirill Bulatov2020-09-101-37/+116
| |/ /
* | | Merge #5969bors[bot]2020-09-1110-5/+431
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5969: Propose module name completion options r=jonas-schievink a=SomeoneToIgnore <img width="539" alt="image" src="https://user-images.githubusercontent.com/2690773/92663009-cb0aec00-f308-11ea-9ef5-1faa91518031.png"> Currently traverses the whole file set every time we try to complete the module, as discussed in https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/mod.3C.7C.3E.20completion Co-authored-by: Kirill Bulatov <[email protected]>
| * | | Adjust the test commentKirill Bulatov2020-09-111-9/+16
| | | |
| * | | One more testKirill Bulatov2020-09-091-0/+15
| | | |
| * | | Rename the method to avoid false promisesKirill Bulatov2020-09-092-17/+15
| | | |
| * | | Add VirtualPath testsKirill Bulatov2020-09-091-3/+38
| | | |
| * | | Fix the testsKirill Bulatov2020-09-095-7/+9
| | | |
| * | | Add testsKirill Bulatov2020-09-091-0/+153
| | | |
| * | | Properly handle mod.rs importsKirill Bulatov2020-09-091-47/+40
| | | |
| * | | Complete semicolon when neededKirill Bulatov2020-09-096-26/+30
| | | |
| * | | Properly reacto to keywordsKirill Bulatov2020-09-096-4/+28
| | | |
| * | | Less false positive completion candidatesKirill Bulatov2020-09-091-44/+59
| | | |
| * | | Properly handle nested submodules in the same fileKirill Bulatov2020-09-091-70/+79
| | | |
| * | | Move most of the logic into the completion moduleKirill Bulatov2020-09-098-118/+107
| | | |
| * | | Finally cretae the mod completion moduleKirill Bulatov2020-09-094-18/+43
| | | |
| * | | Move rust-related logic from vfs to base_db levelKirill Bulatov2020-09-092-61/+74
| | | |
| * | | Properly handle special cases (binaries, mod.rs)Kirill Bulatov2020-09-093-52/+60
| | | |
| * | | Exclude special filesKirill Bulatov2020-09-092-3/+5
| | | |
| * | | Implement file name & extension retrieval method for VirtualPathKirill Bulatov2020-09-091-2/+20
| | | |
| * | | Small refactoringKirill Bulatov2020-09-092-32/+26
| | | |
| * | | Happy path implementedKirill Bulatov2020-09-098-26/+38
| | | |
| * | | Properly use FileSet APIKirill Bulatov2020-09-093-38/+49
| | | |
| * | | Better APIKirill Bulatov2020-09-098-24/+64
| | | |
| * | | First steps for mod<|> completionKirill Bulatov2020-09-094-6/+65
| |/ /
* | | Merge #5957bors[bot]2020-09-103-23/+66
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5957: Add consuming modifier to lvalues that are passed by value and not Copy r=jonas-schievink a=Nashenas88 Related to #5856 Co-authored-by: Paul Daniel Faria <[email protected]>