Commit Graph

12332 Commits

Author SHA1 Message Date
Paul Daniel Faria
6cde0b1aa0 Add support for extern crate
This adds syntax highlighting, hover and goto def
functionality for extern crate
2020-08-08 14:14:18 -04:00
bors[bot]
8a57afe5a4
Merge #5684
5684: Semantic highlighting for unsafe union field access r=jonas-schievink a=Nashenas88

This change adds support for unions in inference and lowering, then extends on that to add the unsafe semantic modifier on field access only. The `is_possibly_unsafe` function in `syntax_highlighting.rs` could be extended to support fns and static muts so that their definitions are not highlighted as unsafe, but only their usage.

Also, each commit of this PR updates the tests. By reviewing the files by commit, it's easy to see how the changes in the code affected the tests.

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
2020-08-08 16:45:37 +00:00
bors[bot]
eed05a95b4
Merge #5689
5689: Remove clone r=kjeremy a=Veetaha



Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-08-08 16:18:01 +00:00
Paul Daniel Faria
be935b2b56 Apply unsafe semantic highlighting to union field access 2020-08-08 11:29:56 -04:00
Paul Daniel Faria
3bf033e548 Add support for unions in inference and lowering 2020-08-08 11:29:56 -04:00
Paul Daniel Faria
a39d503ef3 Add additional checks for union inference tests 2020-08-08 11:29:50 -04:00
Veetaha
b1ec08e3ff Remove clone 2020-08-08 17:42:50 +03:00
bors[bot]
a69f19a6a5
Merge #5686
5686: Fix typo in settings description r=kjeremy a=rherrmann

Remove a duplicate word from the description of the `warningsAsHint` setting.

Co-authored-by: Rüdiger Herrmann <ruediger.herrmann@gmx.de>
2020-08-08 11:51:14 +00:00
Yusuke Tanaka
cd49e41642
Add test for handle_document_symbol (#5655) 2020-08-08 20:49:09 +09:00
Yusuke Tanaka
b970d675f5
Reverse document symbols for each scope (#5655) 2020-08-08 20:48:45 +09:00
Rüdiger Herrmann
c04b2e39da
Fix typo in settings description
Remove a duplicate word from the description of the `warningsAsHint` setting.
2020-08-08 11:57:54 +02:00
bors[bot]
7a02cc8845
Merge #5679
5679: Account for static mut in missing unsafe diagnostic r=jonas-schievink a=Nashenas88

Accessing or modifying a static mut is an unsafe operation. The "missing unsafe" diagnostic now tracks this.

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
2020-08-07 12:26:23 +00:00
bors[bot]
911ef38b24
Merge #5678
5678: Static mut unsafe semantic highlighting r=jonas-schievink a=Nashenas88

This marks static mutable names as unsafe, since accessing or modifying a static mut is an unsafe operation.

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
2020-08-07 12:20:13 +00:00
Igor Aleksanov
c51fb7aca5 Fix failing test 2020-08-07 14:35:43 +03:00
Igor Aleksanov
78c1a87797 Add a test for disabled diagnostics 2020-08-07 14:26:36 +03:00
Igor Aleksanov
90857ff8b0 Add an AnalysisConfig structure and use it to configure diagnostics run 2020-08-07 14:25:55 +03:00
bors[bot]
ae1197accd
Merge #5674
5674: Update chalk r=matklad a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-08-07 10:32:06 +00:00
Igor Aleksanov
c463d217a1 Add names for diagnostics and add a possibility to disable them 2020-08-07 13:18:47 +03:00
Paul Daniel Faria
a6532905a9 Add test for unsafe union field access highlighting 2020-08-06 21:15:31 -04:00
Paul Daniel Faria
f089690a21 Account for static mut in missing unsafe diagnostic 2020-08-06 20:55:29 -04:00
Paul Daniel Faria
8e657f663d Mark static mutable names as unsafe 2020-08-06 20:07:42 -04:00
Paul Daniel Faria
6be528da0d Add test for accessing static mut 2020-08-06 19:58:37 -04:00
Jeremy Kolb
4591bd458d Update chalk 2020-08-05 22:24:23 -04:00
bors[bot]
f1d507270c
Merge #5526
5526: Handle semantic token deltas r=kjeremy a=kjeremy

This basically takes the naive approach where we always compute the tokens but save space sending over the wire which apparently solves some GC problems with vscode.

This is waiting for https://github.com/gluon-lang/lsp-types/pull/174 to be merged. I am also unsure of the best way to stash the tokens into `DocumentData` in a safe manner.

Co-authored-by: kjeremy <kjeremy@gmail.com>
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-08-06 01:44:38 +00:00
Jeremy Kolb
195111d769 Address PR comments 2020-08-05 21:35:35 -04:00
bors[bot]
2cb079ba9a
Merge #5672
5672: align names in make

 r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-08-05 22:29:27 +00:00
bors[bot]
ed4687f698
Merge #5639
5639: SSR: Allow `self` in patterns. r=jonas-schievink a=davidlattimore

It's now consistent with other variables in that if the pattern references self, only the `self` in scope where the rule is invoked will be accepted. Since `self` doesn't work the same as other paths, this is implemented by restricting the search to just the current function. Prior to this change (since path resolution was implemented), having self in a pattern would just result in no matches.

Co-authored-by: David Lattimore <dml@google.com>
2020-08-05 22:07:35 +00:00
David Lattimore
3eea41a68c Use SyntaxNode.ancestors instead of a loop 2020-08-06 07:36:03 +10:00
Aleksey Kladov
09d3b7d7a2 align names in make 2020-08-05 19:37:26 +02:00
bors[bot]
5ebf92cd0e
Merge #5648
5648: Add expand glob import assist r=jonas-schievink a=unexge

closes https://github.com/rust-analyzer/rust-analyzer/issues/5557

Co-authored-by: unexge <unexge@gmail.com>
2020-08-05 17:05:07 +00:00
bors[bot]
32246b91c2
Merge #5664
5664: Fix renamed self module. r=jonas-schievink a=Nashenas88

Fixes #5663 

Now `inner_mod` below is properly marked as a `module`.
```rust
use crate::inner::{self as inner_mod};
mod inner {}
```

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
2020-08-05 16:56:39 +00:00
bors[bot]
dab810b1e6
Merge #5669
5669: Document release process r=jonas-schievink a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-08-05 13:53:01 +00:00
bors[bot]
5721cca2f3
Merge #5494
5494: Use salsa's purge to account for all memory r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-08-05 13:31:37 +00:00
Aleksey Kladov
edd4a83ee3 Use salsa's purge to account for all memory 2020-08-05 15:28:20 +02:00
Aleksey Kladov
33447e2855
Update docs/dev/README.md
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-08-05 14:01:51 +02:00
Aleksey Kladov
36d75f3105 Document release process 2020-08-05 13:50:47 +02:00
bors[bot]
2ad29eb231
Merge #5668
5668: Fix relative path handling for custom rustfmt r=matklad a=matklad

`current_dir` and relative paths to executables works differently on
unix and windows (unix behavior does not make sense), see:

17e30e83a1/src/lib.rs (L295-L324)

The original motivation to set cwd was to make rustfmt read the
correct rustfmt.toml, but that was future proofing, rather than a bug
fix.

So, let's just remove this and see if breaks or fixes more use-cases.

If support for per-file config is needed, we could use `--config-path`
flag.



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-08-05 11:26:16 +00:00
Aleksey Kladov
ffe4a5e114 Fix relative path handling for custom rustfmt
`current_dir` and relative paths to executables works differently on
unix and windows (unix behavior does not make sense), see:

17e30e83a1/src/lib.rs (L295-L324)

The original motivation to set cwd was to make rustfmt read the
correct rustfmt.toml, but that was future proofing, rather than a bug
fix.

So, let's just remove this and see if breaks or fixes more use-cases.

If support for per-file config is needed, we could use `--config-path`
flag.
2020-08-05 13:20:36 +02:00
unexge
6cb090345e Pattern match on slice elements instead of using .first().unwrap() 2020-08-05 13:25:26 +03:00
unexge
5214b4cdba Look for trait methods in expand glob import assist 2020-08-05 11:29:00 +03:00
Paul Daniel Faria
4e2e3543c7 When resolving a rename, fallback to the name higher in the use tree if the path segment is self 2020-08-04 09:28:40 -04:00
Paul Daniel Faria
cc3eb85311 Add test showing unresolved module rename 2020-08-04 09:26:38 -04:00
bors[bot]
af6e9a7eb3
Merge #5658
5658: do not add to `pub use` in assists that insert a use statement r=jonas-schievink a=jbr

closes #5657 , see issue for rationale

Initially I wrote a version of this that changed the signature of `insert_use_statement` to take an `Option<VisibilityKind>` and only add to use statements with the same visibility, but that didn't make sense for any of the current uses of `insert_use_statement` (they all expected private visibility).

Co-authored-by: Jacob Rothstein <hi@jbr.me>
2020-08-04 12:47:11 +00:00
bors[bot]
2b0c2f6771
Merge #5659
5659: Revert LineIndex optimizations to fix #5656 r=matklad a=lazear

This PR reverts the changes from https://github.com/rust-analyzer/rust-analyzer/pull/5532, which was causing issues as described in
https://github.com/rust-analyzer/rust-analyzer/issues/5656

Co-authored-by: Michael Lazear <lazear@scripps.edu>
2020-08-03 23:18:16 +00:00
Michael Lazear
2e72e74dbd Revert "Restore line index micro-optimization"
This reverts commit 83a87fcd11.
2020-08-03 13:35:32 -07:00
Jacob Rothstein
03a61134f2
do not add to pub use statements 2020-08-03 12:17:05 -07:00
bors[bot]
33e53d4721
Merge #5653
5653: Fold trait declarations r=SomeoneToIgnore a=lnicola

Fixes #5652

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-08-03 17:25:26 +00:00
Laurențiu Nicola
f1bbc776c0 Fold trait declarations 2020-08-03 15:45:39 +03:00
bors[bot]
f17d2d1289
Merge #5628
5628: Rename test modules r=matklad a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-08-03 11:47:56 +00:00
unexge
bdb97756ca Simplify find_mod_path with use of node.ancestors 2020-08-03 13:04:20 +03:00