aboutsummaryrefslogtreecommitdiff
path: root/crates
Commit message (Collapse)AuthorAgeFilesLines
* Don't re-read open files from disk when reloading a workspaceLaurențiu Nicola2020-09-181-4/+7
|
* Merge #5989bors[bot]2020-09-165-103/+292
|\ | | | | | | | | | | | | | | | | | | 5989: Rewrite import merging r=jonas-schievink a=Veykril Rewrites how import merging is being handled. It is now a recursive function to properly handle merging of intermediate levels in the import trees. With this ordering the imports is also now possible tho it doesn't quite order it the same way as `rustfmt` does yet, namely it orders lowercase identifiers after uppercase identifiers as that is the standard character order that rust uses. This also fixes a few weird behaviors that were visible in some of the `replace_qualified_name_with_use.rs` tests. This really took longer than I was hoping for, fighting with import trees is quite the exhausting task 😅 Co-authored-by: Lukas Wirth <[email protected]>
| * Add make::glob_use_tree function to create star-only UseTreeLukas Wirth2020-09-162-11/+7
| |
| * Fix merge imports failing if the `self` module import is in the wrong treeLukas Wirth2020-09-121-22/+34
| |
| * Tidy up `recursive_merge` implementationLukas Wirth2020-09-121-60/+60
| |
| * Reimplement import merging by making it recursive properly nesting all levelsLukas Wirth2020-09-124-83/+264
| |
* | Merge #6013bors[bot]2020-09-162-7/+19
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6013: Add support for custom flycheck commands with JSON project workspaces r=jonas-schievink a=woody77 Enable flychecks with JSON project workspaces if an override command was provided as part of the client configuration: ``` "rust-analyzer.checkOnSave.enable": true, "rust-analyzer.checkOnSave.overrideCommand": ["custom_tool", "arg1", "arg2"], ``` Co-authored-by: Aaron Wood <[email protected]>
| * | Add support for custom flycheck commands with JSON project workspacesAaron Wood2020-09-162-7/+19
| | | | | | | | | | | | | | | Enable flychecks with JSON project workspaces if an override command was provided as part of the client configuration.
* | | Merge #5993bors[bot]2020-09-1614-36/+158
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5993: Update chalk to 0.27 and add support for extern opaque types. r=crlf0710 a=crlf0710 Co-authored-by: Charles Lew <[email protected]>
| * | | Use Ty::apply instead of simple and fix method resolution.Charles Lew2020-09-163-8/+14
| | | |
| * | | Add a test.Charles Lew2020-09-161-0/+38
| | | |
| * | | Lower extern type alias as foreign opaque type.Charles Lew2020-09-162-2/+8
| | | |
| * | | Update chalk to 0.27 and adapt to chalk changes.Charles Lew2020-09-1510-33/+105
| | | |
* | | | 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
| | | |