Commit Graph

13374 Commits

Author SHA1 Message Date
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
Charles Lew
389d9a6c2d Lower extern type alias as foreign opaque type. 2020-09-16 20:57:14 +08:00
Jonas Schievink
44f4510caa Store Import indices for later reconstruction 2020-09-16 12:35:09 +02:00
bors[bot]
b14bf68ce6
Merge #6011
6011: Document "consuming" semantic tokens modifier r=jonas-schievink a=Veetaha

cc https://github.com/rust-analyzer/rust-analyzer/pull/5957/files

Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-09-16 09:20:36 +00:00
Aaron Wood
74c26a785a Add support for custom flycheck commands with JSON project workspaces
Enable flychecks with JSON project workspaces if an override command was provided as part
of the client configuration.
2020-09-15 18:51:57 -07:00
Veetaha
af8663f2e6 Document "consuming" semantic tokens modifier 2020-09-16 00:53:37 +03:00
bors[bot]
748a8ced60
Merge #6010
6010: Avoid checking all ancestors and fix mis-completion r=jonas-schievink a=oxalica

Refactor the logic of `completion_match` to check deterministic number of ancestors instead of `token.ancestors().find_map()`.
This should fix wrong completions (https://github.com/rust-analyzer/rust-analyzer/pull/5976#issuecomment-692332191) and hopefully make completion to be faster (#6004).

More play and test? @jonas-schievink @hammypants 

If this patch works, we can avoid the revert #6005 . 😞

Co-authored-by: oxalica <oxalicc@pm.me>
2020-09-15 20:15:04 +00:00
oxalica
d2fced1c26
Avoid checking all ancestors and fix mis-completion 2020-09-16 01:16:06 +08:00
bors[bot]
37f3b9ca2a
Merge #6008
6008: inline parameters for a function description r=jonas-schievink a=bnjjj

close #6002 

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-09-15 16:18:30 +00:00
Benjamin Coenen
e0f0d93eda inline parameters for a function description #6002
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-09-15 18:04:34 +02:00
Benjamin Coenen
2e91159ced inline parameters for a function description #6002
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2020-09-15 17:15:33 +02:00
Charles Lew
b302f69b7c Update chalk to 0.27 and adapt to chalk changes. 2020-09-15 22:37:05 +08:00