Commit graph

12835 commits

Author SHA1 Message Date
bors[bot]
3b52d3181a
Merge #6043
6043: Allow missing trait members assist without needing braces r=matklad a=M-J-Hooper

Assist to complete missing items when implementing a trait does not appear without impl def braces (see #5144 ).

The reason behind this was that this assist is based on `ast::AssocItemList` which only appears in the AST after the braces are added to the impl def.

Instead of relying on and replacing the item list, we now instead replace the entire `ast::Impl` and add the item list if its missing.

Co-authored-by: Matt Hooper <matthewjhooper94@gmail.com>
2020-09-21 09:06:24 +00:00
Matt Hooper
7d90bb1f47 Rename impl edit method to be more explicit 2020-09-21 10:01:50 +01:00
Matt Hooper
532be0e780 Added test for impl member assist when impl def is missing braces 2020-09-21 09:48:51 +01:00
Matt Hooper
9724af038b Replace entire impl def instead of only associated items for missing impl member assist (if braces are missing from an impl def then there is no associated item list in the AST) 2020-09-21 00:42:27 +01:00
Matt Hooper
ae7c982421 Add make utility for empty associated item lists 2020-09-21 00:39:17 +01:00
Matt Hooper
4362297a0b Add edit utility for adding an associated item list to a impl def 2020-09-21 00:38:18 +01:00
bors[bot]
e70cf706bb
Merge #6018
6018: Correct project_root path for ProjectJson. r=jonas-schievink a=woody77

It was already the folder containing the rust-project.json file, not the file itself.  This also removes the Option-ness of it, since it's now an infallible operation to set the member value.

Co-authored-by: Aaron Wood <aaronwood@google.com>
2020-09-20 19:25:09 +00:00
Aaron Wood
38f1ce633d Add rustdoc for ProjectJson methods 2020-09-20 12:06:12 -07:00
bors[bot]
59f9fc4cd1
Merge #6041
6041: Fix typo in syntax.md r=kjeremy a=magurotuna

This might be a typo, so I fixed it.

Co-authored-by: Yusuke Tanaka <yusuktan@maguro.dev>
2020-09-20 18:42:21 +00:00
Yusuke Tanaka
4530b717cb
Fix typo 2020-09-21 01:44:38 +09:00
Yusuke Tanaka
203358a0d5
Fix typo 2020-09-21 00:53:14 +09:00
bors[bot]
fb1b0a4bff
Merge #6036
6036: Don't re-read open files from disk when reloading a workspace r=kjeremy a=lnicola

Fixes #5742
Fixes #4263

or so I hope.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-09-18 21:29:47 +00:00
Laurențiu Nicola
5a0bad7754 Don't re-read open files from disk when reloading a workspace 2020-09-18 22:15:44 +03:00
bors[bot]
e49a0677ad
Merge #6035
6035: Log failure to load crate root file r=jonas-schievink a=jonas-schievink



Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-09-18 17:28:30 +00:00
Jonas Schievink
46c5b557fe Log failure to load crate root file 2020-09-18 19:27:19 +02:00
bors[bot]
bd8ba80b1b
Merge #6034
6034: docs: suggest disabling the official extension r=jonas-schievink a=jonas-schievink



Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-09-18 16:28:03 +00:00
Jonas Schievink
888cb378b9 docs: suggest disabling the official extension 2020-09-18 18:26:58 +02:00
bors[bot]
82dc4af5de
Merge #6032
6032: Support active parameters at the per-signature level r=jonas-schievink a=kjeremy

No functionality change. This also pulls in a few other protocol changes that we don't use and updates crates.

Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-09-18 16:15:37 +00:00
Jonas Schievink
7474a42b00 Remove incorrect docs 2020-09-18 18:09:47 +02:00
Jonas Schievink
baab72e611 Reduce visibility of non-proc-macros
proc-macro crates only export proc-macros, but currently other items
are also considered public (and show up in completion)
2020-09-18 17:50:04 +02:00
kjeremy
c7243e4a59 Support active parameters at the per-signature level
Update crates
2020-09-18 11:39:25 -04:00
Jonas Schievink
069045015c Remove obsolete proc macro collection code
The new attribute-based resolution takes care of this
2020-09-18 16:52:24 +02:00
Jonas Schievink
5486b70bc0 Use hir_def to resolve proc macros 2020-09-18 16:43:50 +02:00
Jonas Schievink
dfa3a3f017 Add test 2020-09-18 16:37:12 +02:00
bors[bot]
5e1500ec74
Merge #6030
6030: Small proc macro cleanup r=jonas-schievink a=jonas-schievink

git got really confused, but all I did in the first commit was unindent a few lines

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-09-18 13:40:45 +00:00
Jonas Schievink
9dc0afe854 Rename CustomDerive to ProcMacro
It handles fn-like macros too, and will handle attribute macros in the
future
2020-09-18 15:37:31 +02:00
Jonas Schievink
700a3d5d75 Invert condition to unindent code 2020-09-18 12:32:07 +02:00
bors[bot]
086f1c4b30
Merge #6025
6025: Use `log::error!` in a few more places r=jonas-schievink a=jonas-schievink



Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-09-17 15:37:37 +00:00
Jonas Schievink
d328ee647f Use log::error! in a few more places 2020-09-17 17:37:52 +02:00
bors[bot]
7af7e1f253
Merge #6024
6024: Give `ExternCrate` a `Name`, not a `ModPath` r=jonas-schievink a=jonas-schievink

Simplifies things

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-09-17 13:27:50 +00:00
Jonas Schievink
6eea06415d Give ExternCrate a Name, not a ModPath 2020-09-17 15:28:23 +02:00
bors[bot]
d84c18d989
Merge #6017
6017: Don't return any TextEdit if formatting is unchanged r=jonas-schievink a=cuviper

I found that `textDocument/formatting` was always returning a full
`TextEdit` replacement, even when there are no changes, which caused Vim
(w/ vim-lsp) to always indicate a modified buffer after formatting. We
can easily compare whether there were changes and return `null` if not,
so the client knows there's nothing to do.

Co-authored-by: Josh Stone <cuviper@gmail.com>
2020-09-17 13:08:09 +00:00
bors[bot]
933fc1eb18
Merge #6016
6016: Emit diagnostics for unresolved imports and extern crates r=jonas-schievink a=jonas-schievink

AFAIK, we don't have any major bugs in name resolution that would cause a lot of false positives here (except procedural attribute macro support and some rare issues around `#[path]` on module files), so these are *not* marked as experimental diagnostics right now.

I noticed that diagnostics in a file sometimes don't get displayed after opening, but require some edit to be performed. This seems like a preexisting issue though.

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-09-17 13:00:25 +00:00
bors[bot]
af92bdb827
Merge #6023
6023: Fix LSP requests with no arguments r=kjeremy a=lnicola

r? @kjeremy 

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-09-17 12:53:43 +00:00
Jonas Schievink
0dca7acf0f Don't diagnose imports whose base crate is missing 2020-09-17 14:48:17 +02:00
Laurențiu Nicola
c217bc561f Fix LSP requests with no arguments 2020-09-17 13:31:42 +03:00
bors[bot]
3877421373
Merge #5989
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 <lukastw97@gmail.com>
2020-09-16 20:03:41 +00:00
Lukas Wirth
f2ae412ccf Remove make::path_from_text 2020-09-16 21:36:10 +02:00
Aaron Wood
2fbb09a73f Correct project_root path for ProjectJson.
It was already the folder containing the rust-project.json file, not the file itself.
2020-09-16 12:09:44 -07:00
Lukas Wirth
45298b5d2a Add make::glob_use_tree function to create star-only UseTree 2020-09-16 20:33:08 +02:00
bors[bot]
4bc8015370
Merge #6013
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 <aaronwood@google.com>
2020-09-16 18:04:29 +00:00
bors[bot]
5df69d9034
Merge #5993
5993: Update chalk to 0.27 and add support for extern opaque types. r=crlf0710 a=crlf0710



Co-authored-by: Charles Lew <crlf0710@gmail.com>
2020-09-16 17:07:05 +00:00
Josh Stone
29c3421391 Don't return any TextEdit if formatting is unchanged
I found that `textDocument/formatting` was always returning a full
`TextEdit` replacement, even when there are no changes, which caused Vim
(w/ vim-lsp) to always indicate a modified buffer after formatting. We
can easily compare whether there were changes and return `null` if not,
so the client knows there's nothing to do.
2020-09-16 10:05:41 -07:00
Charles Lew
3fff5aa4d7 Use Ty::apply instead of simple and fix method resolution. 2020-09-17 00:58:41 +08:00
Charles Lew
eb96964756 Add a test. 2020-09-17 00:21:34 +08:00
Jonas Schievink
f792bc7ddd Add annotation-based nameres diagnostic tests 2020-09-16 17:26:51 +02:00
Jonas Schievink
603613a302 Update tests 2020-09-16 17:26:51 +02:00
Jonas Schievink
4785162b08 Track import sources and emit diagnostics 2020-09-16 17:26:51 +02:00
Jonas Schievink
4ac9a2e5d3 Leave extern crate items unresolved if they are 2020-09-16 17:26:51 +02:00
Jonas Schievink
2a9a66d254 Add diagnostic types for unresolved crates/imports 2020-09-16 17:26:51 +02:00