Aleksey Kladov
f3d56b89c5
Enable offset-encoding capability
2021-02-16 19:17:32 +03:00
kjeremy
f9bb398cc5
Fix a few clippy::perf warnings
2021-02-16 10:55:34 -05:00
Benjamin Bouvier
4a6e602c94
Allow automatically detect the rustc-src directory ( fixes #3517 ).
...
If the configured rustcSource is set to "discover", try to automatically
detect a source from the sysroot rustc directory.
2021-02-13 18:20:46 +01:00
Edwin Cheng
9358eecc04
Async Loading outdir and proc-macro
2021-01-29 01:04:14 +08:00
Aleksey Kladov
2870e70163
Add config option to ignore directories
2021-01-26 16:45:54 +03:00
Aleksey Kladov
a733f65126
Allow non-absolute paths to rust source
2021-01-26 16:40:08 +03:00
Aleksey Kladov
c04b561e7e
Remove the need to manually sync config in package.json
2021-01-26 16:22:24 +03:00
vsrs
3618c4e0d3
Add References code lens.
...
For Struct, Enum, Union and Trait symbols.
2021-01-23 16:56:20 +03:00
Kirill Bulatov
db335a1bbf
Add flyimport completion for trait assoc items
2021-01-16 20:44:12 +02:00
Kirill Bulatov
6742f38e49
Share import_assets and related entities
2021-01-16 19:33:36 +02:00
Aleksey Kladov
bb453edebe
Honor client's dynamic registration caps
...
cc https://github.com/rust-analyzer/rust-analyzer/pull/5516#issuecomment-757520828
2021-01-10 22:38:35 +03:00
Aleksey Kladov
037caec62c
Use american spelling for config
...
As per
171c3c08fe/docs/dev/style.md (variable-naming)
Also implement config aliasing, for pain-free settings migrations in the future
2021-01-07 15:07:19 +03:00
Aleksey Kladov
f8a0561178
Align config's API with usage
...
The config now is mostly immutable, optimize for that.
2021-01-06 21:22:24 +03:00
Aleksey Kladov
6e87828756
YAGNI active_resolve_capabilities
...
This leaks a lot of LSP details into ide layer, which we want to avoid:
c9cec381bc/docs/dev (lsp-independence)
Additionally, all what this infra does is providing a toggle for
auto-import completion, but we already have one!
2021-01-06 20:23:53 +03:00
Aleksey Kladov
f7a15b5cd1
More maintainable config
...
Rather than eagerly converting JSON, we losslessly keep it as is, and
change the shape of user-submitted data at the last moment.
This also allows us to remove a bunch of wrong Defaults
2021-01-06 15:39:28 +03:00
Aleksey Kladov
624eb1ee54
More maintainable caps config
...
The idea here is that we preserve client's config as is, without
changes. This gets rid of state!
2021-01-05 17:46:57 +03:00
Aleksey Kladov
d7741d1610
Allow #anchor
linking of config options
2021-01-05 13:09:06 +03:00
cynecx
59fe884ef5
Fix warnings on rust-nightly
2021-01-02 20:48:39 +01:00
Aleksey Kladov
7c07bb6381
Document, how to view config in effect
2020-12-23 10:47:05 +03:00
Rüdiger Herrmann
9f070531a6
Clean up descriptions for settings
...
Use two consecutive newlines (`\n\n`) to actually continue text on a
new line.
Use proper markup to reference related settings.
Consistently format references to files, editor commands, command line
arguments, files, etc. as `code`.
Fix typos, add missing full-stops, add missing default values.
2020-12-22 14:51:17 +01:00
Aleksey Kladov
17f236c2b0
Normalize spelling to American English
2020-12-10 17:51:56 +03:00
kjeremy
78dd2ba196
Send a CodeLensRefresh when we reload
2020-12-09 14:36:47 -05:00
Aleksey Kladov
0890512e1c
Include config into the manual
2020-12-09 15:31:10 +03: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
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
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
47464e556c
Properly fill client completion resolve capabilities data
2020-12-07 23:41:08 +02:00
Florian Diebold
21d256de72
Align default importMergeBehaviour with VSCode
2020-11-29 16:43:46 +01:00
Kirill Bulatov
3f612d37c6
Move the helpers into ide_db
2020-11-28 16:30:39 +02:00
Kirill Bulatov
f4ae3650d8
Extract the import code into the shared module
2020-11-27 18:28:41 +02:00
Kirill Bulatov
4c95c6e25d
Gate autoimports begind experimental completions flag
2020-11-25 00:30:28 +02:00
Kirill Bulatov
d776c67226
Properly fill the completion settings
2020-11-16 21:19:06 +02:00
Aleksey Kladov
4dfda64b39
Cleanup workspace loading a tiny bit
2020-11-13 17:38:26 +01:00
bors[bot]
b0ad492e3d
Merge #6519
...
6519: Add "Open Cargo.toml" action r=matklad a=p3achyjr
## What is it?
This adds an "open cargo.toml" action from the vscode shell, resolves #6462
## Test
Ran ```cargo xtask install --server``` and ```cargo xtask install --client```, then ```Developer: Reload Window```.
![image](https://user-images.githubusercontent.com/8763808/98614382-2a578f00-22ad-11eb-9811-4a72a54ff6fb.png )
When clicked:
![image](https://user-images.githubusercontent.com/8763808/98618176-77d7fa00-22b5-11eb-8788-35256542f3a6.png )
Co-authored-by: Anatol Liu <axlui@anatols-mbp.lan>
2020-11-13 15:25:26 +00:00
Anatol Liu
b1b7727e04
add open Cargo.toml action
2020-11-12 17:48:07 -08:00
bors[bot]
ddccaecb79
Merge #6524
...
6524: Add support for loading rustc private crates r=matklad a=xldenis
This PR presents a solution to the problem of making`rustc_private` crates visible to `rust-analyzer`.
Currently developers add dependencies to those crates behind a `cfg(NOT_A_TARGET)` target to prevent `cargo` from building them.
This solution is unsatisfactory since it requires modifying `Cargo.toml` and causes problems for collaboration or CI.
The proposed solution suggested by @matklad is to allow users to give RA a path where the `rustc` sources could be found and then load that like a normal workspace.
This PR implements this solution by adding a `rustcSource` configuration item and adding the cargo metadata to the crate graph if it is provided.
------
I have no idea how this should be tested, or if this code is generally tested at all. I've locally run the extension with these changes and it correctly loads the relevant crates on a `rustc_private` project of mine.
Co-authored-by: Xavier Denis <xldenis@gmail.com>
2020-11-12 17:55:32 +00:00
Xavier Denis
8716087919
Add support for loading rustc private crates
2020-11-11 12:45:40 +01:00
Aleksey Kladov
0caa491893
Be more pedantic when checking codeAction/resolve support
2020-11-10 20:38:34 +01:00
Aleksey Kladov
7d2eb000b0
Switch to upstream protocol for resolving code action
...
Note that we have to maintain custom implementation on the client
side: I don't see how to marry bulitin resolve support with groups and
snippets.
2020-11-10 18:48:46 +01:00
kjeremy
2d4be2ef2a
Request a refresh of semantic tokens if things are loaded up
2020-10-26 09:23:34 -04:00
bors[bot]
57735f2a32
Merge #6140
...
6140: honour hover.content_format client capability r=lnicola a=robinvd
This removes all markdown when the client does not support the markdown MarkupKind.
Otherwise the output on the editor will have some markdown boilerplate, making it less readable.
For example kak_lsp does not currently support markdown.
![image](https://user-images.githubusercontent.com/22073483/95112949-ef0ff080-0741-11eb-82a7-0594fa2cd736.png )
after:
![image](https://user-images.githubusercontent.com/22073483/95113089-2bdbe780-0742-11eb-94fa-bcfec6d7347a.png )
Co-authored-by: Robin van Dijk <robin@robinjint.nl>
2020-10-06 17:51:20 +00:00
Robin van Dijk
c3cc361294
honor content_format clientcap
...
This removes all markdown when the client does not support the markdown MarkupKind
Otherwise the output on the editor will have some markdown boilerplate, making it less readable
2020-10-05 19:27:29 +02:00
Lukas Wirth
8699331014
Make ImportPrefix a configuration option
2020-10-05 17:41:49 +02:00
Igor Aleksanov
4a1b4b23bb
Replace 'cargo_prefix' option with 'override_cargo'
2020-10-02 12:34:27 +03:00
Igor Aleksanov
2c125f3c63
Add support of runnables arguments in Rust Analyzer
2020-10-02 12:34:27 +03:00
vsrs
b7fda5f936
Make method references CodeLens off by default.
2020-09-29 15:29:20 +03:00
vsrs
eeb40dbece
Add method references CodeLens
2020-09-29 15:29:20 +03:00
flw
e73ee9dfa2
Add hover config linksInHover
to suppress links
2020-09-29 19:47:18 +08:00
Jonas Schievink
d328ee647f
Use log::error!
in a few more places
2020-09-17 17:37:52 +02:00
Lukas Wirth
adc4c6b9d7
Make MergeBehaviour configurable
2020-09-12 12:11:16 +02:00
Andy Russell
24805d1d80
default checkOnSave.enable
to true
in server
2020-09-02 17:44:21 -04:00
Aleksey Kladov
0866b1be89
Align diagnostics config with the rest of rust-analyzer
2020-08-18 16:03:15 +02:00
Igor Aleksanov
34847c8d96
Move analysis config structure to the config.rs
2020-08-18 13:35:36 +03:00
Igor Aleksanov
b56cfcca10
Make disabled diagnostics an argument of corresponding function
2020-08-18 13:32:29 +03:00
Igor Aleksanov
c26c911ec1
Merge branch 'master' into add-disable-diagnostics
2020-08-14 07:34:07 +03:00
Aleksey Kladov
1b0c7701cc
Rename ra_ide -> ide
2020-08-13 17:58:27 +02:00
Pavan Kumar Sunkara
eac24d52e6
Rename ra_project_model -> project_model
2020-08-13 12:05:30 +02:00
Igor Aleksanov
90857ff8b0
Add an AnalysisConfig structure and use it to configure diagnostics run
2020-08-07 14:25:55 +03:00
Clemens Wasser
8d9f8ac273
flycheck: Added checkOnSave.noDefaultFeatures
...
This commit adds the option
`rust-analyzer.checkOnSave.noDefaultFeatures`
and fixes #5550 .
2020-07-30 16:04:01 +02:00
Jonas Schievink
f6f49735e8
Add toggle for experimental diagnostics
2020-07-24 17:39:16 +02:00
bors[bot]
818aeb8a24
Merge #5467
...
5467: Allow null or empty values for configuration r=matklad a=kjeremy
Allow the client to respond to `workspace/configuration` with `null` values. This is allowed per the spec if the client doesn't know about the configuration we've requested.
This also protects against `null` or `{}` during initialize. I'm not sure if we want to interpret `{}` as "don't change anything" but I think that's a reasonable approach to take.
This should help with LSP clients working out of the box.
Fixes #5464
Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-07-21 09:41:54 +00:00
Aleksey Kladov
8f3fdf3315
Typo
2020-07-21 10:50:24 +02:00
Aleksey Kladov
a20b8d751b
Propagate cargo.target to checkOnSave
2020-07-21 10:30:54 +02:00
kjeremy
a32dd9c478
Protect against {}
2020-07-20 18:11:32 -04:00
kjeremy
adc4bb5406
Allow client to respond to workspace/configuration with null values
...
This is allowed per the spec if the client doesn't know about the configuration
we've requested.
2020-07-20 17:42:48 -04:00
Aleksey Kladov
e1e79cf064
Take label offets client capability into account
2020-07-16 18:48:02 +02:00
Aleksey Kladov
d0a8f6a3eb
Automatically reload project info on Cargo.toml changes
2020-07-10 15:35:15 +02:00
Aleksey Kladov
17edf50e2c
Avoid accidently stumping over config values
2020-07-10 10:07:08 +02:00
Aleksey Kladov
7ae696ba76
Remove unwanted dependency
2020-07-08 18:26:31 +02:00
Aleksey Kladov
569504938e
Fix typo
2020-07-05 11:19:16 +02:00
Aleksey Kladov
b8ef8539a6
Fix workspace reloading
2020-07-03 17:19:00 +02:00
Aleksey Kladov
3ef7676076
Implement StatusBar
2020-07-02 15:32:14 +02:00
Aleksey Kladov
a03cfa4926
Automatically reload project on config change
2020-07-01 16:42:14 +02:00
Aleksey Kladov
72fb712dff
Add new module for project loading stuff
2020-06-26 00:27:57 +02:00
Aleksey Kladov
0ec5d4f55c
Rename ra_flycheck -> flycheck
2020-06-25 09:13:46 +02:00
Aleksey Kladov
e6c61d5072
Cleanup project.json deserialization
2020-06-24 16:16:52 +02:00
Aleksey Kladov
a07cad16ab
Rename json_project -> project_json
2020-06-24 16:03:24 +02:00
Aleksey Kladov
154cb8243b
Be more explicit about absolute paths at various places
2020-06-24 14:39:34 +02:00
vsrs
c50157f330
Add Go to Type Definition
hover action.
2020-06-18 10:15:43 +03:00
Gabriel Valfridsson
656e95211e
Warnings as hint or info
2020-06-17 00:00:43 +02:00
Thiébaud Weksteen
44f28f65af
Accept relative paths in rust-project.json
...
If a relative path is found as part of Crate.root_module or Root.path,
interpret it as relative to the location of the rust-project.json file.
2020-06-15 13:11:53 +02:00
Clemens Wasser
fe21fc2d25
checkOnSafe.features and checkOnSafe.allFeatures now work identically.
2020-06-10 09:37:26 +02:00
Clemens Wasser
33b9058838
Most of the checkOnSafe options now default to the cargo equivalent.
2020-06-10 09:27:25 +02:00
Clemens Wasser
47ef544fa5
Added the rust-analyzer.checkOnSave.features option.
2020-06-10 08:51:11 +02:00
Clemens Wasser
684b6fa1b8
flycheck now uses the configured features
2020-06-09 21:47:54 +02:00
vsrs
3434f1dd2c
Add Run|Debug hover actions
2020-06-06 18:17:52 +03:00
vsrs
78c9223b7b
Remove hover contents marking as trusted.
...
Hover contents might be extracted from raw
doc comments and need some validation.
2020-06-05 15:25:01 +03:00
vsrs
b147e6eb95
Code formatting
2020-06-05 15:00:30 +03:00
vsrs
7d0dd17b09
Add hover actions as LSP extension
2020-06-05 14:59:26 +03:00
Mikhail Rakhmanov
6a0083a519
Merge branch 'master' into compute-lazy-assits
...
# Conflicts:
# crates/rust-analyzer/src/main_loop/handlers.rs
# crates/rust-analyzer/src/to_proto.rs
2020-06-03 19:26:01 +02:00
Aleksey Kladov
fa019c8f56
Document rust-project.json
2020-06-03 15:17:26 +02:00
Aleksey Kladov
8baa4c5d07
Groundwork for specifying the set of projects via config
2020-06-03 12:22:01 +02:00
Mikhail Rakhmanov
cb482e6351
Merge remote-tracking branch 'upstream/master' into compute-lazy-assits
...
# Conflicts:
# crates/rust-analyzer/src/to_proto.rs
2020-06-02 23:22:45 +02:00
Mikhail Rakhmanov
57cd936c52
Preliminary implementation of lazy CodeAssits
2020-06-02 23:10:53 +02:00
Laurențiu Nicola
7a66d99897
Disable rust-analyzer.{cargo,checkOnSave}.allFeatures by default
2020-06-02 19:14:34 +03:00
kjeremy
7a46a99490
And a few drive-bys
2020-05-22 17:26:31 -04:00
Aleksey Kladov
2075e77ee5
CodeAction groups
2020-05-22 17:32:46 +02:00
Aleksey Kladov
a752853350
Add snippetTextEdit protocol extension
2020-05-19 20:28:27 +02:00