Commit Graph

17872 Commits

Author SHA1 Message Date
bors[bot]
3381c2e4a8
Merge #9031
9031: Add `public` semantic token modifier for public items r=Veykril a=arzg

Closes #8943.

Co-authored-by: Aramis Razzaghipour <aramisnoah@gmail.com>
2021-06-22 23:58:59 +00:00
Aramis Razzaghipour
3e7472f76c
Add public semantic token modifier for public items 2021-06-23 09:40:04 +10:00
bors[bot]
3762cb4535
Merge #9383
9383: internal: Rewrite token tree lowering to use an explicit stack r=jonas-schievink a=jonas-schievink

Part of https://github.com/rust-analyzer/rust-analyzer/issues/9358, this fixes the first cause of the stack overflow there. Unfortunately we now run into a stack overflow in the parser.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-06-22 22:28:43 +00:00
Jonas Schievink
c6669776e1 Rewrite convert_tokens to use an explicit stack 2021-06-23 00:21:11 +02:00
Jonas Schievink
6504c3c32a Move subtree collection out of TokenConvertor 2021-06-23 00:19:54 +02:00
bors[bot]
38da41ea6e
Merge #9381
9381: Fix compilation on WASM r=matklad a=flodiebold

Fixes #9214.
Fixes #9210.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-06-22 20:01:34 +00:00
Florian Diebold
c61fee6d55 Fix compilation on WASM
Fixes #9214.
Fixes #9210.
2021-06-22 22:01:06 +02:00
bors[bot]
9b29573a4b
Merge #9379
9379: internal: remove one more accidentally quadratic code-path r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-22 18:26:30 +00:00
Aleksey Kladov
7be2d2f008 internal: remove one more accidentally quadratic code-path
Definition::visibility was implemented in a rather roundabout way -- by
asking the parent module about the effective visibility.

This is problematic for a couple of reasons:

* first, it doesn't work for local items
* second, asking module about visibility of a child is a linear
  operation (that's a problem in itself, tracked in #9378)

Instead, lets ask the declared visibility directly, we have all the code
for it, and need only to actually us it.
2021-06-22 21:26:07 +03:00
bors[bot]
9239943b84
Merge #9377
9377: internal: count ItemScopes r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-22 18:03:38 +00:00
Aleksey Kladov
260a24d05e internal: count ItemScopes 2021-06-22 21:02:08 +03:00
bors[bot]
0e0d77d0a3
Merge #9376
9376: minor: clarify naming r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-22 17:57:24 +00:00
Aleksey Kladov
4772cb6b30 minor: clarify naming 2021-06-22 20:56:52 +03:00
bors[bot]
16d83ccbe2
Merge #9374
9374: Update crates r=kjeremy a=kjeremy

Drops byteorder

Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-06-22 17:24:57 +00:00
kjeremy
5b6e168928 Update crates 2021-06-22 13:18:48 -04:00
bors[bot]
76c88e9ca9
Merge #9373
9373: internal: Factor out `pick_best_token` ide pattern into `ide_db` r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-22 17:17:54 +00:00
Lukas Wirth
f615efdfc3 Factor out pick_best_token ide pattern into ide_db 2021-06-22 17:50:15 +02:00
bors[bot]
4e2ec914f4
Merge #9372
9372: intenral: dont export impl details r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-22 13:54:20 +00:00
Aleksey Kladov
9526c198f6 intenral: dont export impl details 2021-06-22 16:53:53 +03:00
bors[bot]
5ede497778
Merge #9370
9370: minor: extend source_to_def docs r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-22 13:12:39 +00:00
Aleksey Kladov
2860f25ef3 minor: extend source_to_def docs 2021-06-22 16:12:01 +03:00
bors[bot]
fa0d568522
Merge #9369
9369: internal: document source_to_def and it's connection to Kotlin&Roslyn r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-22 12:32:02 +00:00
Aleksey Kladov
bf9ce9e65c internal: document source_to_def and it's connection to Kotlin&Roslyn 2021-06-22 15:31:04 +03:00
bors[bot]
ff92afb4c1
Merge #9368
9368: fix: Prefer identifier tokens in expand_macro r=Veykril a=Veykril

Fixes #9366
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-22 10:06:34 +00:00
Lukas Wirth
b423c61ce6 Prefer identifier tokens in expand_macro 2021-06-22 12:03:51 +02:00
bors[bot]
e2ca2325f5
Merge #9367
9367: Document perf characteristic of to_node r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-22 08:46:01 +00:00
Aleksey Kladov
e611c6758c Document perf characteristic of to_node 2021-06-22 11:45:22 +03:00
bors[bot]
37dc2dfada
Merge #9348
9348: output to log file if RA_LOG_FILE is defined in environment r=rezural a=rezural

This adds a check for RA_LOG_FILE, and logs to that if defined. It currently overrides flags.log_file. If this is undesirable, I will add a check.

Co-authored-by: rezural <rezural@protonmail.com>
2021-06-21 21:42:02 +00:00
rezural
ceeee5e3c6 add documentation of RA_LOG_FILE 2021-06-22 07:28:33 +10:00
bors[bot]
afe056eef1
Merge #9364
9364: Split hover actions config into its own config struct r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-21 20:00:56 +00:00
Lukas Wirth
65d683df36 Collapse documentation and markdown config settings into an enum 2021-06-21 21:57:01 +02:00
bors[bot]
d2b89ebb92
Merge #9363
9363: Set explicit target directory to avoid cargo deadlock r=jonas-schievink a=oxalica

Fix #9360 

r? @jonas-schievink 

Co-authored-by: oxalica <oxalicc@pm.me>
2021-06-21 19:48:02 +00:00
Lukas Wirth
99c95b8fa1 Split hover actions config into its own config struct 2021-06-21 21:47:54 +02:00
oxalica
d368b663bd
Set explicit target directory to avoid cargo deadlock 2021-06-22 03:34:32 +08:00
bors[bot]
8b3d93ee29
Merge #9362
9362: feature: massively improve performance for large files r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-21 18:04:57 +00:00
Aleksey Kladov
099b63e7c0 feature: massively improve performance for large files
This story begins in #8384, where we added a smart test for our syntax
highting, which run the algorithm on synthetic files of varying length
in order to guesstimate if the complexity is O(N^2) or O(N)-ish.

The test turned out to be pretty effective, and flagged #9031 as a
change that makes syntax highlighting accidentally quadratic. There was
much rejoicing, for the time being.

Then, lnicola asked an ominous question[1]: "Are we sure that the time
is linear right now?"

Of course it turned out that our sophisticated non-linearity detector
*was* broken, and that our syntax highlighting *was* quadratic.

Investigating that, many brave hearts dug deeper and deeper into the
guts of rust-analyzer, only to get lost in a maze of traits delegating
to traits delegating to macros.

Eventually, matklad managed to peel off all layers of abstraction one by
one, until almost nothing was left. In fact, the issue was discovered in
the very foundation of the rust-analyzer -- in the syntax trees.

Worse, it was not a new problem, but rather a well-know, well-understood
and event (almost) well-fixed (!) performance bug.

The problem lies within `SyntaxNodePtr` type -- a light-weight "address"
of a node in a syntax tree [3]. Such pointers are used by rust-analyzer all
other the place to record relationships between IR nodes and the
original syntax.

Internally, the pointer to a syntax node is represented by node's range.
To "dereference" the pointer, you traverse the syntax tree from the
root, looking for the node with the right range. The inner loop of this
search is finding a node's child whose range contains the specified
range. This inner loop was implemented by naive linear search over all
the children. For wide trees, dereferencing a single `SyntaxNodePtr` was
linear. The problem with wide trees though is that they contain a lot of
nodes! And dereferencing pointers to all the nodes is quadratic in the
size of the file!

The solution to this problem is to speed up the children search --
rather than doing a linear lookup, we can use binary search to locate
the child with the desired interval.

Doing this optimization was one of the motivations (or rather, side
effects) of #6857. That's why `rowan` grew the useful
`child_or_token_at_range` method which does exactly this binary search.

But looks like we've never actually switch to this method? Oups.

Lesson learned: do not leave broken windows in the fundamental infra.
Otherwise, you'll have to repeatedly re-investigate the issue, by
digging from the top of the Everest down to the foundation!

[1]: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/.60syntax_highlighting_not_quadratic.60.20failure/near/240811501
[2]: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Syntax.20highlighting.20is.20quadratic
[3]: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Syntax.20highlighting.20is.20quadratic/near/243412392
2021-06-21 20:14:38 +03:00
bors[bot]
f06ddbea6a
Merge #9080
9080: Improve completion of cfg attributes r=JamieCunliffe a=JamieCunliffe

This will close #5398 and it also adds some completion for cfg options.

Co-authored-by: Jamie Cunliffe <Jamie.Cunliffe@outlook.com>
2021-06-21 17:05:21 +00:00
Jamie Cunliffe
ae823aa23f Move features into potential_cfg_options 2021-06-21 17:54:05 +01:00
Jamie Cunliffe
284483b347 Improve completion of cfg attributes
The completion of cfg will look at the enabled cfg keys when
performing completion.

It will also look crate features when completing a feature cfg
option. A fixed list of known values for some cfg options are
provided.

For unknown keys it will look at the enabled values for that cfg key,
which means that completion will only show enabled options for those.
2021-06-21 17:47:00 +01:00
bors[bot]
1b05dbba39
Merge #9359
9359: internal: Update vscode-languageclient r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-06-21 15:49:02 +00:00
kjeremy
b88019c610 Update vscode-languageclient 2021-06-21 11:39:13 -04:00
bors[bot]
56e61bdfea
Merge #9165
9165: Apply some clippy suggestions r=matklad a=clemenswasser



Co-authored-by: Clemens Wasser <clemens.wasser@gmail.com>
2021-06-21 15:11:21 +00:00
Clemens Wasser
47747cd412 Apply some clippy suggestions 2021-06-21 16:40:21 +02:00
bors[bot]
25bf451c84
Merge #9264
9264: feat: Make documentation on hover configurable r=Veykril a=Veykril

This also implements deprecation support for config options as this renames `hoverActions_linksInHover` to `hover_linksInHover`.

Fixes #9232

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-21 14:15:49 +00:00
Lukas Wirth
43098d99ae Remove deprecation support in config 2021-06-21 16:15:25 +02:00
bors[bot]
5567b8a632
Merge #9314
9314: Fix extract_function with await r=sasurau4 a=sasurau4

Fix #9287 

Co-authored-by: Daiki Ihara <sasurau4@gmail.com>
2021-06-21 13:59:29 +00:00
Daiki Ihara
873aa904f2 Fix var name 2021-06-21 22:47:39 +09:00
bors[bot]
b48aba0090
Merge #9227
9227: Add a config setting to disable the 'test' cfg in specified crates r=matklad a=lf-

If you are opening libcore from rust-lang/rust as opposed to e.g.
goto definition from some other crate which would use the sysroot
instance of libcore, a `#![cfg(not(test))]` would previously have made
all the code excluded from the module tree, breaking the editor
experience.

Core does not need to ever be edited with `#[cfg(test)]` enabled,
as the tests are in another crate.

This PR puts in a slight hack that checks for the crate name "core" and
turns off `#[cfg(test)]` for that crate.

Fixes #9203 
Fixes #9226 

Co-authored-by: Jade <software@lfcode.ca>
2021-06-21 13:41:27 +00:00
bors[bot]
4402f2b280
Merge #9357
9357: fix: Update sysroot crates r=jonas-schievink a=jonas-schievink

Removes `rtstartup`, since that's not a Cargo crate (its files are compiled into object files and linked alongside the stdlib).

Adds  `std_detect`.

Part of https://github.com/rust-analyzer/rust-analyzer/issues/9352 (doesn't fix it since std_detect is full of `cfg_if!`)

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-06-21 13:27:57 +00:00
Jonas Schievink
9e306909db Update sysroot crates 2021-06-21 15:26:26 +02:00