Commit Graph

821 Commits

Author SHA1 Message Date
Aleksey Kladov
6e24321e45 Introduce anchored_path
They allow to represent paths like `#[path = "C:\path.rs"] mod foo;`
in a lossless cross-platform & network-transparent way.
2020-12-09 19:07:05 +03:00
Aleksey Kladov
0890512e1c Include config into the manual 2020-12-09 15:31:10 +03:00
bors[bot]
b3ceee2a27
Merge #6761
6761: Make config.rs a single source of truth for configuration. r=matklad a=matklad

Configuration is editor-independent. For this reason, we pick
JSON-schema as the repr of the source of truth. We do specify it using
rust-macros and some quick&dirty hackery though.

The idea for syncing truth with package.json is to just do that
manually, but there's a test to check that they are actually synced.

I'll add something like `rust-analyzer --config-schema` in a follow-up
commit.


Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-12-08 18:21:28 +00:00
Jonas Schievink
4943ef085d Make original_range a method on InFile<&SyntaxNode> 2020-12-08 19:01:27 +01:00
Aleksey Kladov
2544abbf86 Make config.rs a single source of truth for configuration.
Configuration is editor-independent. For this reason, we pick
JSON-schema as the repr of the source of truth. We do specify it using
rust-macros and some quick&dirty hackery though.

The idea for syncing truth with package.json is to just do that
manually, but there's a test to check that they are actually synced.

There's CLI to print config's json schema:

    $ rust-analyzer --print-config-schema

We go with a CLI rather than LSP request/response to make it easier to
incorporate the thing into extension's static config. This is roughtly
how we put the thing in package.json.
2020-12-08 19:25:41 +03:00
bors[bot]
e2e6b709e6
Merge #6760
6760: Open Cargo.toml opens more specific manifest r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-12-08 13:30:16 +00:00
Aleksey Kladov
944f30bd69 Open Cargo.toml opens more specific manifest 2020-12-08 16:28:21 +03:00
Aleksey Kladov
ecd1c11f9e cleanup: match over unwrap 2020-12-08 16:17:46 +03:00
Kirill Bulatov
cbd3717f2c Better config name 2020-12-08 14:27:18 +02:00
Kirill Bulatov
3183ff3a7b Disable the completion for no corresponding client resolve capabilities 2020-12-08 01:07:20 +02:00
Kirill Bulatov
19cfa5802e Simplify 2020-12-07 23:41:08 +02:00
Kirill Bulatov
6badf705b3 Check lsp completions' edits for disjointness 2020-12-07 23:41:08 +02:00
Kirill Bulatov
077c1c3c1f Less panic, more tests 2020-12-07 23:41:08 +02:00
Kirill Bulatov
deda74edd8 Use stateless completion resolve 2020-12-07 23:41:08 +02:00
Kirill Bulatov
93bc009a59 Remove the state 2020-12-07 23:41:08 +02:00
Kirill Bulatov
74c3bbacc9 Make completion resolve async 2020-12-07 23:41:08 +02:00
Kirill Bulatov
f6d2540df0 Simplify import edit calculation 2020-12-07 23:41:08 +02:00
Kirill Bulatov
68a747efe0 Remove redundant code 2020-12-07 23:41:08 +02:00
Kirill Bulatov
50e06ee95a Refactor the code 2020-12-07 23:41:08 +02:00
Kirill Bulatov
d9bd1f171d Add eager resolve capability 2020-12-07 23:41:08 +02:00
Kirill Bulatov
2a7be4afb0 Better support client completion resolve caps 2020-12-07 23:41:08 +02:00
Kirill Bulatov
47464e556c Properly fill client completion resolve capabilities data 2020-12-07 23:41:08 +02:00
Kirill Bulatov
9a4daffe16 Resolve import inserts better 2020-12-07 23:41:08 +02:00
Kirill Bulatov
a539267c3b Remove unnecessary leftovers 2020-12-07 23:41:08 +02:00
Kirill Bulatov
6d2d279389 Working resolve completion imports prototype 2020-12-07 23:41:08 +02:00
Kirill Bulatov
48acd7d455 Draft the new lsp handler 2020-12-07 23:41:08 +02:00
Jonas Schievink
2b2318e695 Remove dummy ProcMacroClient in favor of Option 2020-12-07 17:16:50 +01:00
Jonas Schievink
45b8b3d57f
Apply suggestions from code review
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-12-06 14:23:55 +01:00
Jonas Schievink
2a6c246184 Update expect tests 2020-12-06 01:39:52 +01:00
Jonas Schievink
9d96a6d7af Emit additional diagnostics for hints/help/etc 2020-12-06 01:24:37 +01:00
bors[bot]
2756abb167
Merge #6721
6721: Use METHOD semantic token type r=kjeremy a=lnicola

Closes #6685

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-12-04 18:46:44 +00:00
Jonas Schievink
e45ab7e0ec Fix diagnostics subcommand, look at all modules 2020-12-04 19:37:37 +01:00
Laurențiu Nicola
72f013b3b9 Use METHOD semantic token type 2020-12-04 18:27:10 +02:00
Jonas Schievink
6da651f5da Don't prime caches when just opening a file 2020-12-02 20:18:28 +01:00
kjeremy
e4ffd70c91 Fix OptionalVersionedTextDocumentIdentifier type
Fixes #6654
2020-12-01 08:33:21 -05:00
Florian Diebold
21d256de72 Align default importMergeBehaviour with VSCode 2020-11-29 16:43:46 +01:00
bors[bot]
b7ece77af4
Merge #6650
6650: Make completion and assists module independent r=matklad a=SomeoneToIgnore

A follow-up of https://github.com/rust-analyzer/rust-analyzer/pull/6553#discussion_r524402907

Move the common code for both assists and completion modules into a separate crate.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-11-28 14:33:57 +00:00
Kirill Bulatov
3f612d37c6 Move the helpers into ide_db 2020-11-28 16:30:39 +02:00
Jonas Schievink
f52abbe62d Coalesce flycheck events 2020-11-27 22:52:22 +01:00
Jonas Schievink
e49ba0d1df Downgrade "failed to load" error to warning 2020-11-27 18:35:22 +01:00
Kirill Bulatov
f4ae3650d8 Extract the import code into the shared module 2020-11-27 18:28:41 +02:00
Laurențiu Nicola
a5477d7f29 Remove unused import 2020-11-26 19:25:59 +02:00
Jonas Schievink
9ed883f373 Publish diagnostics on file open
Diagnostics are sometimes only showing up when typing.
This should fix that.
2020-11-26 13:33:47 +01:00
Kirill Bulatov
4c95c6e25d Gate autoimports begind experimental completions flag 2020-11-25 00:30:28 +02:00
kjeremy
e981485b76 New lsp-types to fix versioning
Fixes #6603
2020-11-24 08:52:24 -05:00
Matt Jibson
117c793e80 Don't assume DidChangeTextDocument paths exist
Fixes #5933
2020-11-23 16:35:34 -07:00
Lukas Wirth
91a1a83601 Fill code_description for rust_analyzer diagnostics 2020-11-18 08:54:52 +01:00
Lukas Wirth
56a0021e61 update diagnostics test_data with code_description changes 2020-11-18 08:50:27 +01:00
Lukas Wirth
863fdcfa24 Link clippy lint codes in diagnostics 2020-11-18 08:50:27 +01:00
Lukas Wirth
132063ad96 Link rustc error codes in diagnostics 2020-11-18 08:50:27 +01:00