Commit Graph

19430 Commits

Author SHA1 Message Date
Jonas Schievink
033f87c2f0 Add some profiling calls to name resolution 2021-10-01 15:30:00 +02:00
bors[bot]
0646d5cf9e
Merge #10413
10413: fix: Fix format highlighting with `concat!` and `unreachable!` r=jonas-schievink a=jonas-schievink

Last item in https://github.com/rust-analyzer/rust-analyzer/issues/10394, closes https://github.com/rust-analyzer/rust-analyzer/issues/10394

Also documents why/how `is_format_string` even works, since I found that nontrivial.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-10-01 11:31:32 +00:00
Jonas Schievink
3bc0d89ade Fix format highlighting with concat! 2021-10-01 13:28:05 +02:00
bors[bot]
47c079a037
Merge #10403
10403: feat: Add semantic token modifier for crate root r=Veykril a=lhvy

Resolves #9073

I managed to implement crate root highlighting for crates mentioned specifically by name (e.g. `serde` in `use serde::Serialize;`), but not for crates referred to with `crate` or `super`. How could I implement this?

> P.S. I'm participating in [Hacktoberfest 2021](https://hacktoberfest.digitalocean.com/). If this PR is up to standard and merged, I'd appreciate if the `hacktoberfest-accepted` label could be added. Thanks!

Co-authored-by: lhvy <me@lhvy.dev>
2021-10-01 11:18:52 +00:00
lhvy
dbb02370a4
Add semantic token modifier for crate root 2021-10-01 20:52:13 +10:00
bors[bot]
bbd5dd0f4c
Merge #10412
10412: feat: highlight `asm!` as format string r=jonas-schievink a=jonas-schievink

![screenshot-2021-10-01-12:34:31](https://user-images.githubusercontent.com/1786438/135606261-a1cb6caf-0a7f-45f7-9dde-0275370b0889.png)

part of https://github.com/rust-analyzer/rust-analyzer/issues/10394

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-10-01 10:35:15 +00:00
Jonas Schievink
cca6ee5757 Expand asm! to format_args! 2021-10-01 12:33:18 +02:00
bors[bot]
8b45de596f
Merge #10411
10411: fix: Parenthesize expressions in `if_to_bool_then` assist where required r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-01 10:20:06 +00:00
Lukas Wirth
816fafd997 Parenthesize expressions in if_to_bool_then assist where required 2021-10-01 12:19:01 +02:00
bors[bot]
c30a6a2974
Merge #10406
10406: internal: Restructure syntax element highlighting into node and token branches r=Veykril a=Veykril

Gets rid of all the unseemly unwraps 
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-30 19:46:57 +00:00
Lukas Wirth
c5ceaefa09 Restructure syntax element highlighting 2021-09-30 21:44:56 +02:00
bors[bot]
8bf2d4fe62
Merge #10404
10404: minor: Simplify r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10405
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-30 18:38:39 +00:00
Lukas Wirth
0c7ea0c9a1 Fix add missing semantic token modifier in SUPPORTED_MODIFIERS 2021-09-30 20:38:05 +02:00
Lukas Wirth
a33939565d Simplify 2021-09-30 19:12:37 +02:00
bors[bot]
4f3ce62b0d
Merge #10402
10402: fix: Don't show flyimport completions in use renames r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10367
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-30 16:18:09 +00:00
Lukas Wirth
d7d16a7ac9 Don't show flyimport completions in use renames 2021-09-30 18:15:55 +02:00
bors[bot]
529b7a4167
Merge #10398
10398: Give defaultLibrary semantic token modifier to items from standard library r=Veykril a=lhvy

Fixes #8999, fixes #2155

`builtInCrates` could be an alternate name to `defaultLibrary`, which one is better?

> P.S. I'm participating in [Hacktoberfest 2021](https://hacktoberfest.digitalocean.com/). If this PR is up to standard and merged, I'd appreciate if the `hacktoberfest-accepted` label could be added. Thanks!

Co-authored-by: lhvy <me@lhvy.dev>
Co-authored-by: Lucas <me@lhvy.dev>
2021-09-30 16:10:23 +00:00
lhvy
0b2ba8be68
Fix builtin_crates return type change 2021-10-01 02:05:00 +10:00
bors[bot]
26a10767cb
Merge #10401
10401: minor: Test runnables check for test prefix and suffix in attributes only r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10393
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-30 16:03:03 +00:00
Lukas Wirth
b742dd313e Test runnables check for test prefix and suffix in attributes only 2021-09-30 18:02:44 +02:00
lhvy
64cbdf6d55
Add comment 2021-10-01 01:58:11 +10:00
Lucas
6606b49710
Reduce allocation in builtin_crates
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-01 01:56:30 +10:00
lhvy
f713cfb818
Remove unneeded semantic token definition 2021-10-01 01:55:29 +10:00
bors[bot]
7a36993892
Merge #10400
10400: fix: fix format string highlighting for `todo!` and `unimplemented!` r=jonas-schievink a=jonas-schievink

Part of https://github.com/rust-analyzer/rust-analyzer/issues/10394

These macros require us to see through the `const_format_args!` invocation the panic macros generate, for that we have to add it to our supported built-in macros.

I've also made the macros in the test `#[macro_export]` (turns out they didn't all resolve correctly before this), which changes the output slightly.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-09-30 15:33:07 +00:00
Jonas Schievink
4465685878 Work around tidy check 2021-09-30 17:32:18 +02:00
lhvy
2b3baa8503
Give defaultLibrary semantic token modifier to items from standard library 2021-10-01 01:19:24 +10:00
bors[bot]
73562aa168
Merge #10399
10399: minor: don't drop binders when doing autoderef r=lnicola a=iDawer

This fixes #10396 panic introduced in #10373

Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-09-30 15:17:12 +00:00
Jonas Schievink
b994469a13 Add const_format_args! builtin macro, fix highlighting 2021-09-30 17:16:39 +02:00
Dawer
df4bb02b6f minor: don't drop binders when doing autoderef 2021-09-30 19:57:15 +05:00
bors[bot]
12fe0e4ffe
Merge #10397
10397: fix: fix format string highlighting for `panic!` and `assert!` r=jonas-schievink a=jonas-schievink

part of https://github.com/rust-analyzer/rust-analyzer/issues/10394

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-09-30 14:37:43 +00:00
Jonas Schievink
375a0ff785 Use itertools 2021-09-30 16:37:12 +02:00
Jonas Schievink
b8437f71b6 Less hacky assert! expansion 2021-09-30 16:30:26 +02:00
Jonas Schievink
368c5f6023 Fix format string highlighting in panic! 2021-09-30 15:53:47 +02:00
bors[bot]
161a5e8724
Merge #10395
10395: Add pub(super) along with pub(crate) and pub as a completion keyword r=lnicola a=azdavis

I've gotten used to typing `pc` in front of items to get `pub(crate)`, but recently I needed `pub(super)`. So I tried typing `ps` and it didn't work. Now it should!

Co-authored-by: Ariel Davis <ariel.z.davis@icloud.com>
2021-09-30 06:07:50 +00:00
Ariel Davis
00a615b819 Add pub(super) along with pub(crate) and pub as a completion keyword 2021-09-29 21:55:15 -07:00
bors[bot]
b21f15a237
Merge #10389
10389: fix: use the right `HirFileId` when expanding macros in fn parameters r=Veykril a=SkiFire13

Fixes #10388

Co-authored-by: Giacomo Stevanato <giaco.stevanato@gmail.com>
2021-09-29 19:20:12 +00:00
Giacomo Stevanato
034dd41ea8 Add regression test 2021-09-29 21:08:44 +02:00
Giacomo Stevanato
624ee23147 Use the right HirFileId for LowerCtx when expanding macros in fn parameter types 2021-09-29 21:06:37 +02:00
bors[bot]
9e3e98db8a
Merge #10384
10384: Add vscode native onEnterRules r=matklad,lnicola a=HKalbasi

This PR copy onEnterRules configurations [from vscode-rust](https://github.com/rust-lang/vscode-rust/blob/master/src/extension.ts#L287) based on discussion in #6254 

I understand that the ideal way is to use parser data for this, and probably all other things that language-config do. But since it can't be enabled (or at least it isn't enabled) by default in vscode, I think this is needed (until onEnter becomes official LSP and get vscode support).

People can still configure shortcut and use the parser based onEnter, so it wouldn't harm anyone.


Co-authored-by: hamidreza kalbasi <hamidrezakalbasi@protonmail.com>
2021-09-29 17:21:56 +00:00
bors[bot]
ee12b0f173
Merge #10181
10181: Begining of lsif r=HKalbasi a=HKalbasi

This PR adds a `lsif` command to cli, which can be used as `rust-analyzer lsif /path/to/project > dump.lsif`. It now generates a valid, but pretty useless lsif (only supports folding ranges). The propose of this PR is to discussing about the structure of lsif generator, before starting anything serious.

cc `@matklad` #8696 #3098


Co-authored-by: hamidreza kalbasi <hamidrezakalbasi@protonmail.com>
2021-09-29 13:13:03 +00:00
hamidreza kalbasi
5bd0f50111 remove glob import and cancellables 2021-09-29 16:25:10 +03:30
bors[bot]
1bd14e0530
Merge #10385
10385: Make `extern crate test;` work r=jonas-schievink a=jonas-schievink

This implements support for dependencies that are not added to the extern prelude of a crate, and add the `test` crate from the sysroot as such a dependency.

This does mean we now index `test` on startup, but I didn't notice much of a difference (and also, r-a can be used while it is still indexing).

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6714

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-09-28 19:48:03 +00:00
Jonas Schievink
0e6922f8a8 Implicitly depend on test 2021-09-28 21:39:41 +02:00
bors[bot]
629db286d1
Merge #10373
10373: fix: `into_iterator` not completed on `Vec<{unknown}>` r=iDawer a=iDawer

Fixes  #10297 

Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-09-28 19:38:59 +00:00
Dawer
f222665ebe fix: replace errors in a type when doing autoderef 2021-09-29 00:26:58 +05:00
Jonas Schievink
0b76b29512 support non-extern-prelude dependencies 2021-09-28 21:23:46 +02:00
bors[bot]
cd9f27d424
Merge #10382
10382: fix: Fix inline_call breaking RecordExprField shorthands r=Veykril a=Veykril

Fixes #10349
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-28 17:23:11 +00:00
Lukas Wirth
774a8cf08b Fix inline_call breaking RecordExprField shorthands 2021-09-28 19:22:32 +02:00
hamidreza kalbasi
0dbaf64b12 add vscode native onEnterRules 2021-09-28 20:23:25 +03:30
bors[bot]
c6d95657ee
Merge #10305
10305: Move `GenericParams`'s handling of `impl Trait` into `fn_data_query` r=flodiebold a=SkiFire13

Fixes #10286

Co-authored-by: Giacomo Stevanato <giaco.stevanato@gmail.com>
2021-09-28 16:30:07 +00:00