]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoAdd new query to stats
Jonas Schievink [Fri, 19 Jun 2020 21:17:53 +0000 (23:17 +0200)]
Add new query to stats

4 years agoDon't include downstream crate in query
Jonas Schievink [Fri, 19 Jun 2020 20:33:13 +0000 (22:33 +0200)]
Don't include downstream crate in query

4 years agoReplace `impls_in_trait` with `CrateImplDefs`
Jonas Schievink [Thu, 18 Jun 2020 23:29:34 +0000 (01:29 +0200)]
Replace `impls_in_trait` with `CrateImplDefs`

4 years agoMerge #4930
bors[bot] [Thu, 18 Jun 2020 19:43:05 +0000 (19:43 +0000)]
Merge #4930

4930: Avoid all unchecked indexing in match checking r=flodiebold a=jonas-schievink

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/4416, but replaces it with a false positive.

r? @flodiebold

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
4 years agoMerge #4941
bors[bot] [Thu, 18 Jun 2020 14:05:54 +0000 (14:05 +0000)]
Merge #4941

4941: Simplify r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoSimplify
Aleksey Kladov [Thu, 18 Jun 2020 14:02:45 +0000 (16:02 +0200)]
Simplify

4 years agoMerge #4903
bors[bot] [Thu, 18 Jun 2020 13:23:14 +0000 (13:23 +0000)]
Merge #4903

4903: Add highlighting support for doc comments r=matklad a=Nashenas88

The language server protocol includes a semantic modifier for documentation. This change exports that modifier for doc comments so users can choose to highlight them differently compared to regular comments.

Example:
<img width="375" alt="Screen Shot 2020-06-16 at 10 34 14 AM" src="https://user-images.githubusercontent.com/1673130/84788271-f6599580-afbc-11ea-96e5-7a0215da620b.png">

CC @woody77

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
4 years agoRemove logic to mark all doctest code as
Paul Daniel Faria [Thu, 18 Jun 2020 13:14:02 +0000 (09:14 -0400)]
Remove logic to mark all doctest code as

4 years agoMerge #4935
bors[bot] [Thu, 18 Jun 2020 10:41:37 +0000 (10:41 +0000)]
Merge #4935

4935: Simplify r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoSimplify
Aleksey Kladov [Thu, 18 Jun 2020 10:39:41 +0000 (12:39 +0200)]
Simplify

4 years agoMerge #4821
bors[bot] [Thu, 18 Jun 2020 10:34:21 +0000 (10:34 +0000)]
Merge #4821

4821: display Doctest code lens before comment r=matklad a=bnjjj

close #4785

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
4 years agodisplay Doctest code lens before comment #4785
Benjamin Coenen [Thu, 18 Jun 2020 09:31:15 +0000 (11:31 +0200)]
display Doctest code lens before comment #4785

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
4 years agoMerge #4872
bors[bot] [Thu, 18 Jun 2020 06:48:12 +0000 (06:48 +0000)]
Merge #4872

4872: Reduce the usage of bare subscript operator r=matklad a=Veetaha

Co-authored-by: Veetaha <veetaha2@gmail.com>
4 years agoMerge #4934
bors[bot] [Thu, 18 Jun 2020 06:31:24 +0000 (06:31 +0000)]
Merge #4934

4934: Remove special casing for library symbols r=matklad a=matklad

We might as well handle them internally, via queries.

I am not sure, but it looks like the current LibraryData setup might
even predate salsa? It's not really needed and creates a bunch of
complexity.

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoRemove special casing for library symbols
Aleksey Kladov [Thu, 18 Jun 2020 06:29:34 +0000 (08:29 +0200)]
Remove special casing for library symbols

We might as well handle them internally, via queries.

I am not sure, but it looks like the current LibraryData setup might
even predate salsa? It's not really needed and creates a bunch of
complexity.

4 years agoMerge #4932
bors[bot] [Thu, 18 Jun 2020 04:45:06 +0000 (04:45 +0000)]
Merge #4932

4932: Simplify r=matklad a=Veetaha

Co-authored-by: Veetaha <veetaha2@gmail.com>
4 years agoSimplify
Veetaha [Wed, 17 Jun 2020 23:00:48 +0000 (02:00 +0300)]
Simplify

4 years agoAvoid all unchecked indexing in match checking
Jonas Schievink [Wed, 17 Jun 2020 19:41:07 +0000 (21:41 +0200)]
Avoid all unchecked indexing in match checking

4 years agoMerge #4927
bors[bot] [Wed, 17 Jun 2020 15:53:07 +0000 (15:53 +0000)]
Merge #4927

4927: Better encapsulate reverse-mapping of files to cargo targets r=matklad a=matklad

We need to find a better way to do it...

CrateGraph by itself is fine, CargoWorkspace as well, but the mapping
between the two seems arbitrary...

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoBetter encapsulate reverse-mapping of files to cargo targets
Aleksey Kladov [Wed, 17 Jun 2020 15:51:46 +0000 (17:51 +0200)]
Better encapsulate reverse-mapping of files to cargo targets

We need to find a better way to do it...

CrateGraph by itself is fine, CargoWorkspace as well, but the mapping
between the two seems arbitrary...

4 years agoMerge #4925
bors[bot] [Wed, 17 Jun 2020 15:08:17 +0000 (15:08 +0000)]
Merge #4925

4925: Syntax highlighting for escape sequences in strings r=matklad a=ltentrup

I have added a new semantic token type `ESCAPE_SEQUENCE` as the LSP specification does not seem to have an appropriate token type. This may actually be a regression for some users, as the TextMate Rust grammar has a scope `constant.character.escape.rust` which highlights escape sequences (which caused problems with semantic highlighting, see #4138).

Fixes #2604.

Co-authored-by: Leander Tentrup <leander.tentrup@gmail.com>
4 years agoEnsure all existing doctest code highlights have documentation modifier
Paul Daniel Faria [Wed, 17 Jun 2020 13:33:21 +0000 (09:33 -0400)]
Ensure all existing doctest code highlights have documentation modifier

4 years agoSyntax highlighting for escape sequences in strings
Leander Tentrup [Wed, 17 Jun 2020 13:27:13 +0000 (15:27 +0200)]
Syntax highlighting for escape sequences in strings

4 years agoAdd highlighting support for doc comments
Paul Daniel Faria [Tue, 16 Jun 2020 00:17:26 +0000 (20:17 -0400)]
Add highlighting support for doc comments

4 years agoMerge #4913 #4915 #4916
bors[bot] [Wed, 17 Jun 2020 11:01:37 +0000 (11:01 +0000)]
Merge #4913 #4915 #4916

4913: Remove debugging code for incremental sync r=matklad a=lnicola

4915: Inspect markdown code fences to determine whether to apply syntax highlighting r=matklad a=ltentrup

Fixes #4904

4916: Warnings as hint or info r=matklad a=GabbeV

Fixes #4229

This PR is my second attempt at providing a solution to the above issue. My last PR(#4721) had to be rolled back(#4862) due to it overriding behavior many users expected. This PR solves a broader problem while trying to minimize surprises for the users.

### Problem description
The underlying problem this PR tries to solve is the mismatch between [Rustc lint levels](https://doc.rust-lang.org/rustc/lints/levels.html) and [LSP diagnostic severity](https://microsoft.github.io/language-server-protocol/specification#diagnostic). Rustc currently doesn't have a lint level less severe than warning forcing the user to disable warnings if they think they get to noisy. LSP however provides two severitys below warning, information and hint. This allows editors like VSCode to provide more fine grained control over how prominently to show different diagnostics.

Info severity shows a blue squiggly underline in code and can be filtered separately from errors and warnings in the problems panel.
![image](https://user-images.githubusercontent.com/13839236/84830640-0bb8d900-b02a-11ea-9e2f-0561b0e8f1ef.png)
![image](https://user-images.githubusercontent.com/13839236/84826931-ffca1880-b023-11ea-8080-5e5b91a6ac0d.png)

Hint severity doesn't show up in the problems panel at all and only show three dots under the affected code or just faded text if the diagnostic also has the unnecessary tag.
![image](https://user-images.githubusercontent.com/13839236/84827165-55062a00-b024-11ea-8bd6-bdbf1217c4c5.png)

### Solution
The solution provided by this PR allows the user to configure lists of of warnings to report as info severity and hint severity respectively. I purposefully only convert warnings and not errors as i believe it's a good idea to have the editor show the same severity as the compiler as much as possible.
![image](https://user-images.githubusercontent.com/13839236/84829609-50437500-b028-11ea-80a8-1bbd05680ba7.png)

### Open questions
#### Discoverability
How do we teach this to new and existing users? Should a section be added to the user manual? If so  where and what should it say?

#### Defaults
Other languages such as TypeScript report unused code as hint by default. Should rust-analyzer similarly report some problems as hint/info by default?

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Co-authored-by: Leander Tentrup <leander.tentrup@gmail.com>
Co-authored-by: Gabriel Valfridsson <gabriel.valfridsson@gmail.com>
4 years agoMerge #4914
bors[bot] [Wed, 17 Jun 2020 10:53:22 +0000 (10:53 +0000)]
Merge #4914

4914: Fix panic in match checking r=flodiebold a=jonas-schievink

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

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
4 years agoMerge #4919
bors[bot] [Wed, 17 Jun 2020 09:31:13 +0000 (09:31 +0000)]
Merge #4919

4919: Remove :expr from placeholders r=matklad a=davidlattimore

Reasoning discussed at https://github.com/rust-analyzer/rust-analyzer/issues/3186#issuecomment-644069324

Co-authored-by: David Lattimore <dml@google.com>
4 years agoRemove :expr from placeholders
David Lattimore [Tue, 16 Jun 2020 10:01:03 +0000 (20:01 +1000)]
Remove :expr from placeholders

Reasoning discussed at #3186

4 years agoWarnings as hint or info
Gabriel Valfridsson [Tue, 16 Jun 2020 20:26:33 +0000 (22:26 +0200)]
Warnings as hint or info

4 years agoInspect markdown code fences to determine whether to apply syntax highlighting
Leander Tentrup [Tue, 16 Jun 2020 21:03:59 +0000 (23:03 +0200)]
Inspect markdown code fences to determine whether to apply syntax highlighting

4 years agoUse ra_fixture and reformat tests
Jonas Schievink [Tue, 16 Jun 2020 20:54:41 +0000 (22:54 +0200)]
Use ra_fixture and reformat tests

4 years agoFix index-out-of-bounds panic in match checking
Jonas Schievink [Tue, 16 Jun 2020 20:45:34 +0000 (22:45 +0200)]
Fix index-out-of-bounds panic in match checking

4 years agoRemove debugging code for incremental sync
Laurențiu Nicola [Tue, 16 Jun 2020 18:28:57 +0000 (21:28 +0300)]
Remove debugging code for incremental sync

4 years agoMerge #4911
bors[bot] [Tue, 16 Jun 2020 17:37:18 +0000 (17:37 +0000)]
Merge #4911

4911: cargo update r=kjeremy a=kjeremy

Co-authored-by: kjeremy <kjeremy@gmail.com>
4 years agocargo update
kjeremy [Tue, 16 Jun 2020 17:21:38 +0000 (13:21 -0400)]
cargo update

4 years agoMerge #4909
bors[bot] [Tue, 16 Jun 2020 16:58:41 +0000 (16:58 +0000)]
Merge #4909

4909: Anchor file-system operations to the file, and not to the source root.  r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoAnchor file-system operations to the file, and not to the source root.
Aleksey Kladov [Tue, 16 Jun 2020 16:45:58 +0000 (18:45 +0200)]
Anchor file-system operations to the file, and not to the source root.

Anchoring to the SourceRoot wont' work if the path is absolute:

  #[path = "/tmp/foo.rs"]
  mod foo;

Anchoring to a file will.

However, we *should* anchor, instead of just producing an abs path.

I can imagine a situation where, for example, rust-analyzer processes
crates from different machines (or, for example, from in-memory git
branch), where the same absolute path in different crates might refer
to different files in the end!

4 years agoMerge #4908
bors[bot] [Tue, 16 Jun 2020 15:24:40 +0000 (15:24 +0000)]
Merge #4908

4908: Fix typos in docs/dev/README.md r=kjeremy a=okaneco

Small grammar and spelling changes in the README.md for the dev docs.

Co-authored-by: okaneco <47607823+okaneco@users.noreply.github.com>
4 years agoFix typos in docs/dev/README.md
okaneco [Tue, 16 Jun 2020 14:44:56 +0000 (10:44 -0400)]
Fix typos in docs/dev/README.md
Small grammar and spelling changes

4 years agoMerge #4891
bors[bot] [Tue, 16 Jun 2020 11:48:36 +0000 (11:48 +0000)]
Merge #4891

4891: New VFS API r=matklad a=matklad

cc @flodiebold , @jonas-schievink

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoNew VFS API
Aleksey Kladov [Mon, 15 Jun 2020 11:29:07 +0000 (13:29 +0200)]
New VFS API

4 years agoMerge #4876
bors[bot] [Tue, 16 Jun 2020 11:40:51 +0000 (11:40 +0000)]
Merge #4876

4876: Syntactic highlighting of NAME_REF for injections r=matklad a=ltentrup

This commit adds a function that tries to determine the syntax highlighting class of NAME_REFs based on the usage.
It is used for highlighting injections (such as highlighting of doctests) as the semantic logic will most of the time result in unresolved references.
It also adds a color to unresolved references in HTML encoding.

Follow up of #4683.
Fixes #4809.

Co-authored-by: Leander Tentrup <leander.tentrup@gmail.com>
4 years agoMerge #4878
bors[bot] [Tue, 16 Jun 2020 05:29:05 +0000 (05:29 +0000)]
Merge #4878

4878: Make "Replace qualified name with use" replace *all* mentions of the path r=matklad a=jonas-schievink

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

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
4 years agoOperate only on AST paths instead of HIR
Jonas Schievink [Mon, 15 Jun 2020 22:49:59 +0000 (00:49 +0200)]
Operate only on AST paths instead of HIR

4 years agoSimplify
Jonas Schievink [Mon, 15 Jun 2020 20:59:49 +0000 (22:59 +0200)]
Simplify

4 years agoIt's fookin' raw
Jonas Schievink [Mon, 15 Jun 2020 20:39:26 +0000 (22:39 +0200)]
It's fookin' raw

4 years agoSyntactic highlighting of NAME_REF for injections
Leander Tentrup [Sun, 14 Jun 2020 12:43:43 +0000 (14:43 +0200)]
Syntactic highlighting of NAME_REF for injections

This commit adds a function that tries to determine the syntax highlighting class of NAME_REFs based on the usage.
It is used for highlighting injections (such as highlighting of doctests) as the semantic logic will most of the time result in unresolved references.
It also adds a color to unresolved references in HTML encoding.

4 years agoMerge #4860
bors[bot] [Mon, 15 Jun 2020 15:03:31 +0000 (15:03 +0000)]
Merge #4860

4860: Accept relative paths in rust-project.json r=matklad a=tweksteen

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.

Fixes: #4816
Co-authored-by: Thiébaud Weksteen <tweek@google.com>
4 years agoMerge #4877
bors[bot] [Mon, 15 Jun 2020 13:44:46 +0000 (13:44 +0000)]
Merge #4877

4877: Fix syntax highlighting of recursive macros r=matklad a=ltentrup

Add syntax highlighting for the BANG (`!`) token if the parent is `MACRO_CALL`.

Before:
<img width="514" alt="before" src="https://user-images.githubusercontent.com/201808/84595030-11f65c00-ae56-11ea-9bb2-b1abe2236990.png">

After:
<img width="516" alt="recursive-macro" src="https://user-images.githubusercontent.com/201808/84594981-d196de00-ae55-11ea-8636-f877d5d795ff.png">

Fixes #4694.

Co-authored-by: Leander Tentrup <leander.tentrup@gmail.com>
4 years agoMerge #4892
bors[bot] [Mon, 15 Jun 2020 13:15:33 +0000 (13:15 +0000)]
Merge #4892

4892: Make ra_syntax::{SyntaxNodeChildren, SyntaxElementChildren} public. r=matklad a=davidlattimore

SyntaxNode::children and SyntaxNode::children_with_tokens return these types, but there's currently no way AFAIK to name them.

Co-authored-by: David Lattimore <dml@google.com>
4 years agoMerge #4893
bors[bot] [Mon, 15 Jun 2020 13:07:38 +0000 (13:07 +0000)]
Merge #4893

4893: Add Embark Studios to the sponsors list r=matklad a=matklad

Forgot to do this when updating the sponsors list on the website the
last time :(

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoAdd Embark Studios to the sponsors list
Aleksey Kladov [Mon, 15 Jun 2020 13:06:03 +0000 (15:06 +0200)]
Add Embark Studios to the sponsors list

Forgot to do this when updating the sponsors list on the website the
last time :(

4 years agoFix syntax highlighting of recursive macros
Leander Tentrup [Sun, 14 Jun 2020 13:40:06 +0000 (15:40 +0200)]
Fix syntax highlighting of recursive macros

Add syntax highlighting for the BANG (`!`) token if the parent is `MACRO_CALL`.

4 years agoMake ra_syntax::{SyntaxNodeChildren, SyntaxElementChildren} public.
David Lattimore [Mon, 15 Jun 2020 11:36:30 +0000 (21:36 +1000)]
Make ra_syntax::{SyntaxNodeChildren, SyntaxElementChildren} public.

SyntaxNode::children and SyntaxNode::children_with_tokens return these types, but there's currently no way AFAIK to name them.

4 years agoAccept relative paths in rust-project.json
Thiébaud Weksteen [Tue, 9 Jun 2020 19:26:42 +0000 (21:26 +0200)]
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.

4 years agoMerge #4889
bors[bot] [Mon, 15 Jun 2020 09:02:53 +0000 (09:02 +0000)]
Merge #4889

4889: Deprecate hir::Path::from_ast r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoUpdate parser tests with env var
Aleksey Kladov [Mon, 15 Jun 2020 09:02:17 +0000 (11:02 +0200)]
Update parser tests with env var

4 years agoAllow attributes on expressions
Aleksey Kladov [Mon, 15 Jun 2020 08:59:05 +0000 (10:59 +0200)]
Allow attributes on expressions

https://github.com/rust-lang/rust/pull/69201/

4 years agoDeprecate hir::Path::from_ast
Aleksey Kladov [Mon, 15 Jun 2020 08:49:40 +0000 (10:49 +0200)]
Deprecate hir::Path::from_ast

4 years agoMerge #4888
bors[bot] [Mon, 15 Jun 2020 08:33:45 +0000 (08:33 +0000)]
Merge #4888

4888: Var naming r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoVar naming
Aleksey Kladov [Mon, 15 Jun 2020 08:33:17 +0000 (10:33 +0200)]
Var naming

4 years agoMerge #4882
bors[bot] [Mon, 15 Jun 2020 08:25:05 +0000 (08:25 +0000)]
Merge #4882

4882: _match.rs: improve comment formatting r=matklad a=jonas-schievink

This results in much nicer rustdoc output

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
4 years agoMerge #4880
bors[bot] [Mon, 15 Jun 2020 08:13:22 +0000 (08:13 +0000)]
Merge #4880

4880: "fill match arms" assist: Match on bind patterns r=flodiebold a=tobz1000

This prevents duplication of match arms where the pre-existing arm is a bind pattern.

Co-authored-by: Toby Dimmick <tobydimmick@pm.me>
4 years agofill_match_arms bind pattern implementation
Toby Dimmick [Sun, 14 Jun 2020 21:44:28 +0000 (22:44 +0100)]
fill_match_arms bind pattern implementation

4 years agofill_match_arms bind pattern test
Toby Dimmick [Sun, 14 Jun 2020 21:43:16 +0000 (22:43 +0100)]
fill_match_arms bind pattern test

4 years agodisplay Doctest code lens before comment #4785
Benjamin Coenen [Sun, 14 Jun 2020 19:50:24 +0000 (21:50 +0200)]
display Doctest code lens before comment #4785

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
4 years ago_match.rs: improve comment formatting
Jonas Schievink [Sun, 14 Jun 2020 13:56:02 +0000 (15:56 +0200)]
_match.rs: improve comment formatting

4 years agoMerge #4875
bors[bot] [Sun, 14 Jun 2020 12:16:00 +0000 (12:16 +0000)]
Merge #4875

4875: Introduce paths crate r=matklad a=matklad

It's a good idea to distinguish between absolute and relative paths at
the type level, to avoid accidental dependency on the cwd, which
really shouldn't matter for rust-analyzer service

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoIntroduce paths crate
Aleksey Kladov [Sun, 14 Jun 2020 12:08:28 +0000 (14:08 +0200)]
Introduce paths crate

It's a good idea to distinguish between absolute and relative paths at
the type level, to avoid accidental dependency on the cwd, which
really shouldn't matter for rust-analyzer service

4 years agoReduce the usage of bare subscript operator
Veetaha [Sun, 14 Jun 2020 09:48:16 +0000 (12:48 +0300)]
Reduce the usage of bare subscript operator

4 years agoShorten *all* qualified paths when adding use
Jonas Schievink [Sat, 13 Jun 2020 17:05:31 +0000 (19:05 +0200)]
Shorten *all* qualified paths when adding use

4 years agoExpose `find_insert_use_container`
Jonas Schievink [Sat, 13 Jun 2020 16:56:14 +0000 (18:56 +0200)]
Expose `find_insert_use_container`

4 years agoFix `rewrite_root` when there's only 1 replacement
Jonas Schievink [Sat, 13 Jun 2020 16:55:10 +0000 (18:55 +0200)]
Fix `rewrite_root` when there's only 1 replacement

4 years agoMerge #4867
bors[bot] [Sat, 13 Jun 2020 12:35:44 +0000 (12:35 +0000)]
Merge #4867

4867: Cleanup URL handling r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoMerge #4869
bors[bot] [Sat, 13 Jun 2020 12:27:51 +0000 (12:27 +0000)]
Merge #4869

4869: Discourage allocation r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoDiscourage allocation
Aleksey Kladov [Sat, 13 Jun 2020 12:27:23 +0000 (14:27 +0200)]
Discourage allocation

4 years agoCleanup URL handling
Aleksey Kladov [Sat, 13 Jun 2020 09:00:06 +0000 (11:00 +0200)]
Cleanup URL handling

4 years agoMerge #4868
bors[bot] [Sat, 13 Jun 2020 12:12:08 +0000 (12:12 +0000)]
Merge #4868

4868: Fix if and while postfix completions r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoFix if and while postfix completions
Aleksey Kladov [Sat, 13 Jun 2020 12:06:13 +0000 (14:06 +0200)]
Fix if and while postfix completions

4 years agoMerge #4700
bors[bot] [Sat, 13 Jun 2020 12:02:59 +0000 (12:02 +0000)]
Merge #4700

4700: Add top level keywords completion r=matklad a=mcrakhman

This fixes the following issue: https://github.com/rust-analyzer/rust-analyzer/issues/4566.

Also added simple logic which filters the keywords which can be used with unsafe on the top level.

Co-authored-by: Mikhail Rakhmanov <rakhmanov.m@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoMore concise completion tests
Aleksey Kladov [Sat, 13 Jun 2020 11:57:18 +0000 (13:57 +0200)]
More concise completion tests

4 years agoCleanup
Aleksey Kladov [Sat, 13 Jun 2020 11:47:30 +0000 (13:47 +0200)]
Cleanup

4 years agoMerge #4862
bors[bot] [Sat, 13 Jun 2020 11:04:42 +0000 (11:04 +0000)]
Merge #4862

4862: Revert "Hide squiggly for unused and unnecessary" r=matklad a=GabbeV

This reverts https://github.com/rust-analyzer/rust-analyzer/pull/4721

Co-authored-by: Gabriel Valfridsson <gabriel.valfridsson@gmail.com>
4 years agoRemove accidentally added adoc file
Mikhail Rakhmanov [Sat, 13 Jun 2020 08:48:39 +0000 (10:48 +0200)]
Remove accidentally added adoc file

4 years agoAdd keywords completions on source file position
Mikhail Rakhmanov [Sat, 13 Jun 2020 08:43:39 +0000 (10:43 +0200)]
Add keywords completions on source file position

4 years agoMerge branch 'master' into keyword_completion
Mikhail Rakhmanov [Sat, 13 Jun 2020 06:42:15 +0000 (08:42 +0200)]
Merge branch 'master' into keyword_completion

# Conflicts:
# docs/user/generated_features.adoc

4 years agoFix tests and remove unused methods
Mikhail Rakhmanov [Fri, 12 Jun 2020 23:21:48 +0000 (01:21 +0200)]
Fix tests and remove unused methods

4 years agoAdd more patterns, tests and fix keywords
Mikhail Rakhmanov [Fri, 12 Jun 2020 22:55:21 +0000 (00:55 +0200)]
Add more patterns, tests and fix keywords

4 years agoRewrite snapshot checks
Mikhail Rakhmanov [Fri, 12 Jun 2020 18:30:57 +0000 (20:30 +0200)]
Rewrite snapshot checks

4 years agoRevert "Hide squiggly for unused and unnecessary"
Gabriel Valfridsson [Fri, 12 Jun 2020 16:39:50 +0000 (18:39 +0200)]
Revert "Hide squiggly for unused and unnecessary"

This reverts commit 599c105e6fabb2b81c2d0a11b86c0c96f6ab1b88.

4 years agoMerge #4857
bors[bot] [Fri, 12 Jun 2020 14:28:40 +0000 (14:28 +0000)]
Merge #4857

4857: Fix invalid shorthand initialization diagnostic for tuple structs r=jonas-schievink a=OptimalStrategy

Initializing tuple structs explicitly, like in the example below, produces a "Shorthand struct initialization" diagnostic that leads to a compilation error when applied:
```rust
struct S(usize);

fn main() {
    let s = S { 0: 0 };  // OK, but triggers the diagnostic
    // let s = S { 0 };  // Compilation error
}
```

This PR adds a check that the field name is not a literal.

Co-authored-by: OptimalStrategy <george@usan-podgornov.com>
Co-authored-by: OptimalStrategy <17456182+OptimalStrategy@users.noreply.github.com>
4 years agosimplify determining whether the field is a tuple field
OptimalStrategy [Fri, 12 Jun 2020 14:16:19 +0000 (10:16 -0400)]
simplify determining whether the field is a tuple field

4 years agoMerge #4855
bors[bot] [Fri, 12 Jun 2020 12:49:30 +0000 (12:49 +0000)]
Merge #4855

4855: Use more idiomatic style for lifetimes in generated code r=matklad a=Veetaha

Co-authored-by: Veetaha <veetaha2@gmail.com>
4 years agoMerge #4856
bors[bot] [Fri, 12 Jun 2020 12:41:52 +0000 (12:41 +0000)]
Merge #4856

4856: Simplify r=matklad a=Veetaha

Co-authored-by: Veetaha <veetaha2@gmail.com>
4 years agoMerge #4858
bors[bot] [Fri, 12 Jun 2020 11:47:56 +0000 (11:47 +0000)]
Merge #4858

4858: find_path: return shorter paths for external items r=flodiebold a=jonas-schievink

If a containing module is already in scope, there's no need to use the full path to the item.

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

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
4 years agoRemove comment and incorrect assert
Mikhail Rakhmanov [Fri, 12 Jun 2020 11:14:53 +0000 (13:14 +0200)]
Remove comment and incorrect assert

4 years agoReturn snapshots to tests
Mikhail Rakhmanov [Fri, 12 Jun 2020 11:06:26 +0000 (13:06 +0200)]
Return snapshots to tests

4 years agofind_path: return shorter paths for external items
Jonas Schievink [Fri, 12 Jun 2020 11:01:20 +0000 (13:01 +0200)]
find_path: return shorter paths for external items

If a containing module is already in scope, there's no need to
use the full path to the item.

4 years agoMore assert refactoring
Mikhail Rakhmanov [Fri, 12 Jun 2020 10:15:53 +0000 (12:15 +0200)]
More assert refactoring

4 years agoAdd more pattern tests
Mikhail Rakhmanov [Fri, 12 Jun 2020 08:12:15 +0000 (10:12 +0200)]
Add more pattern tests