]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoAdd paths::RelPath[Buf]
Aleksey Kladov [Mon, 22 Jun 2020 13:03:37 +0000 (15:03 +0200)]
Add paths::RelPath[Buf]

4 years agoMerge #4899
bors[bot] [Mon, 22 Jun 2020 12:13:18 +0000 (12:13 +0000)]
Merge #4899

4899: don't complete top level attrs inside nested attrs and add better labels r=matklad a=bnjjj

close #4890

Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
4 years agoMerge #4921
bors[bot] [Mon, 22 Jun 2020 11:50:34 +0000 (11:50 +0000)]
Merge #4921

4921: Allow SSR to match type references, items, paths and patterns r=davidlattimore a=davidlattimore

Part of #3186

Co-authored-by: David Lattimore <dml@google.com>
4 years agoAllow SSR to match type references, items, paths and patterns
David Lattimore [Wed, 17 Jun 2020 06:53:51 +0000 (16:53 +1000)]
Allow SSR to match type references, items, paths and patterns

Part of #3186

4 years agodon't complete top level attrs inside nested attrs and add better labels #4899
Benjamin Coenen [Mon, 22 Jun 2020 11:39:05 +0000 (13:39 +0200)]
don't complete top level attrs inside nested attrs and add better labels #4899

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
4 years agoMerge #4928
bors[bot] [Mon, 22 Jun 2020 11:19:09 +0000 (11:19 +0000)]
Merge #4928

4928: Fix renaming mod in use tree r=matklad a=unexge

Fixes #4825

Co-authored-by: unexge <unexge@gmail.com>
4 years agodon't complete top level attrs inside nested attrs and add better labels #4899
Benjamin Coenen [Sun, 21 Jun 2020 17:14:08 +0000 (19:14 +0200)]
don't complete top level attrs inside nested attrs and add better labels #4899

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
4 years agoMerge #4971
bors[bot] [Sun, 21 Jun 2020 16:11:41 +0000 (16:11 +0000)]
Merge #4971

4971: cargo update r=kjeremy a=kjeremy

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
4 years agoUpdate test for new serde
Jeremy Kolb [Sun, 21 Jun 2020 16:10:50 +0000 (12:10 -0400)]
Update test for new serde

4 years agocargo update
Jeremy Kolb [Sun, 21 Jun 2020 15:53:52 +0000 (11:53 -0400)]
cargo update

4 years agoMerge #4969
bors[bot] [Sun, 21 Jun 2020 14:24:51 +0000 (14:24 +0000)]
Merge #4969

4969: Handle bindings after @ in patterns r=flodiebold a=jonas-schievink

This is unstable, behind the `bindings_after_at` feature gate, but the semantics are fairly clear, and this is used at lot in rustc.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
4 years agoHandle bindings after @ in patterns
Jonas Schievink [Sun, 21 Jun 2020 13:18:10 +0000 (15:18 +0200)]
Handle bindings after @ in patterns

4 years agoMerge #4962
bors[bot] [Sun, 21 Jun 2020 12:37:29 +0000 (12:37 +0000)]
Merge #4962

4962: Implement APIs for parsing expressions, types, paths, patterns and items r=davidlattimore a=davidlattimore

Co-authored-by: David Lattimore <dml@google.com>
4 years agoImplement APIs for parsing expressions, types, paths, patterns and items
David Lattimore [Thu, 18 Jun 2020 21:43:19 +0000 (07:43 +1000)]
Implement APIs for parsing expressions, types, paths, patterns and items

4 years agoMerge #4959
bors[bot] [Sun, 21 Jun 2020 12:05:16 +0000 (12:05 +0000)]
Merge #4959

4959: Syntax highlighting for documentation comments on macro definitions r=matklad a=ltentrup

Two minor changes with regards to syntax highlighting of comments attached to macro definitions.

Before
<img width="290" alt="Bildschirmfoto 2020-06-20 um 00 05 19" src="https://user-images.githubusercontent.com/201808/85182705-c561b500-b289-11ea-944e-0bdf6508a44f.png">

After
<img width="288" alt="Bildschirmfoto 2020-06-20 um 00 03 36" src="https://user-images.githubusercontent.com/201808/85182727-d90d1b80-b289-11ea-9d2d-234731f19302.png">
Fixes #4949

Co-authored-by: Leander Tentrup <leander.tentrup@gmail.com>
4 years agoMerge #4963
bors[bot] [Sun, 21 Jun 2020 09:26:47 +0000 (09:26 +0000)]
Merge #4963

4963: Download artifacts into tmp dir r=matklad a=Veetaha

This should prevent partially downloaded files in cases when the user closes vsode before the download is complete.
There is also a new more descriptive error message when the user has multiple vscode windows open and tries to download the server.
Related: https://github.com/rust-analyzer/rust-analyzer/issues/4938#issuecomment-646738360

Co-authored-by: Veetaha <veetaha2@gmail.com>
4 years agoMerge #4947
bors[bot] [Sat, 20 Jun 2020 22:14:21 +0000 (22:14 +0000)]
Merge #4947

4947: Replace `impls_in_trait` query with smarter use of `CrateImplDefs` r=matklad a=jonas-schievink

`impls_in_trait` was allocating a whopping ~400 MB of RAM when running analysis-stats on r-a itself.

Remove it, instead adding a query that computes a summary `CrateImplDefs` map for all transitive dependencies. This can probably still be made more efficient, but this already reduces the peak memory usage by 25% without much performance impact on analysis-stats.

**Before**:

```
Total: 34.962107188s, 2083mb allocated 2141mb resident
   422mb ImplsForTraitQuery (deps)
   250mb CrateDefMapQueryQuery
   147mb MacroArgQuery
   140mb TraitSolveQuery (deps)
    68mb InferQueryQuery (deps)
    62mb ImplDatumQuery (deps)
```

**After**:

```
Total: 35.261100358s, 1520mb allocated 1569mb resident
   250mb CrateDefMapQueryQuery
   147mb MacroArgQuery
   144mb TraitSolveQuery (deps)
    68mb InferQueryQuery (deps)
    61mb ImplDatumQuery (deps)
    45mb BodyQuery
    45mb ImplDatumQuery
```

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
4 years agoMerge #4964
bors[bot] [Sat, 20 Jun 2020 21:24:54 +0000 (21:24 +0000)]
Merge #4964

4964: Move ReqQueue to lsp-server r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoMove ReqQueue to lsp-server
Aleksey Kladov [Sat, 20 Jun 2020 21:08:01 +0000 (23:08 +0200)]
Move ReqQueue to lsp-server

4 years agoMerge #4961
bors[bot] [Sat, 20 Jun 2020 19:39:41 +0000 (19:39 +0000)]
Merge #4961

4961: Centralize handing of in-flight requests r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoMerge #4958
bors[bot] [Sat, 20 Jun 2020 15:10:35 +0000 (15:10 +0000)]
Merge #4958

4958: Infer FnSig via Fn traits r=flodiebold a=adamrk

Addresses https://github.com/rust-analyzer/rust-analyzer/issues/4481.
When inferring types check if the callee implements one of the builtin `Fn` traits. Also autoderef the callee before trying to figure out it's `FnSig`.

Co-authored-by: adamrk <ark.email@gmail.com>
4 years agoPush obligation instead of matching on solution
adamrk [Sat, 20 Jun 2020 15:00:57 +0000 (17:00 +0200)]
Push obligation instead of matching on solution

4 years agoDownload artifacts into tmp dir
Veetaha [Sat, 20 Jun 2020 12:38:08 +0000 (15:38 +0300)]
Download artifacts into tmp dir

4 years agoCentralize handing of in-flight requests
Aleksey Kladov [Sat, 20 Jun 2020 11:06:11 +0000 (13:06 +0200)]
Centralize handing of in-flight requests

4 years agoGet Output assoc type by name
adamrk [Sat, 20 Jun 2020 09:53:55 +0000 (11:53 +0200)]
Get Output assoc type by name

4 years agoAdd test for dyn Fn Output
adamrk [Sat, 20 Jun 2020 09:43:40 +0000 (11:43 +0200)]
Add test for dyn Fn Output

4 years agomove tests to ra_hir_ty
adamrk [Sat, 20 Jun 2020 09:32:01 +0000 (11:32 +0200)]
move tests to ra_hir_ty

4 years agoFixes to callable_sig_from_fn_trait
adamrk [Sat, 20 Jun 2020 09:04:46 +0000 (11:04 +0200)]
Fixes to callable_sig_from_fn_trait

4 years agoMake get_fn_trait a method of FnTrait
adamrk [Sat, 20 Jun 2020 06:42:35 +0000 (08:42 +0200)]
Make get_fn_trait a method of FnTrait

4 years agoSwitch back callable_sig for known fn types
adamrk [Sat, 20 Jun 2020 06:13:14 +0000 (08:13 +0200)]
Switch back callable_sig for known fn types

4 years agoRecursively compute impl sets
Jonas Schievink [Fri, 19 Jun 2020 22:36:02 +0000 (00:36 +0200)]
Recursively compute impl sets

4 years agoSyntax highlighting for documentation comments on macro definitions
Leander Tentrup [Fri, 19 Jun 2020 22:02:42 +0000 (00:02 +0200)]
Syntax highlighting for documentation comments on macro definitions

4 years agoMerge #4952
bors[bot] [Fri, 19 Jun 2020 21:40:59 +0000 (21:40 +0000)]
Merge #4952

4952: Shift bound variables correctly when using assoc type shorthand r=matklad a=flodiebold

Fixes #4885.
Fixes #4800.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
4 years agoMerge #4951
bors[bot] [Fri, 19 Jun 2020 21:28:32 +0000 (21:28 +0000)]
Merge #4951

4951: Don't panic on crates depending on themselves r=matklad a=flodiebold

Fixes #3883.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
4 years agoMerge #4955
bors[bot] [Fri, 19 Jun 2020 21:18:18 +0000 (21:18 +0000)]
Merge #4955

4955: Update workaround comment r=matklad a=Veetaha

Co-authored-by: Veetaha <veetaha2@gmail.com>
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 agoInfer FnSig from Fn traits
adamrk [Sun, 7 Jun 2020 19:57:29 +0000 (21:57 +0200)]
Infer FnSig from Fn traits

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 agoShift bound variables correctly when using assoc type shorthand
Florian Diebold [Fri, 19 Jun 2020 16:32:42 +0000 (18:32 +0200)]
Shift bound variables correctly when using assoc type shorthand

Fixes #4885.
Fixes #4800.

4 years agoMerge #4950
bors[bot] [Fri, 19 Jun 2020 19:47:30 +0000 (19:47 +0000)]
Merge #4950

4950: Use correct substs for super trait assoc types r=matklad a=flodiebold

When referring to an associated type of a super trait, we used the substs of the
subtrait. That led to the #4931 crash if the subtrait had less parameters, but
it could also lead to other incorrectness if just the order was different.

Fixes #4931.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
4 years agoUse correct substs for super trait assoc types
Florian Diebold [Fri, 19 Jun 2020 14:29:38 +0000 (16:29 +0200)]
Use correct substs for super trait assoc types

When referring to an associated type of a super trait, we used the substs of the
subtrait. That led to the #4931 crash if the subtrait had less parameters, but
it could also lead to other incorrectness if just the order was different.

Fixes #4931.

4 years agoMerge #4957
bors[bot] [Fri, 19 Jun 2020 18:48:06 +0000 (18:48 +0000)]
Merge #4957

4957: Fix substs in resolve_value_path for ImplSelf r=flodiebold a=Speedy37

Fixes #4953.

This is the first fix I do in hir_ty, I hope I got it right :)

Co-authored-by: Vincent Rouillé <vincent@speedy37.fr>
4 years agoFix substs in resolve_value_path for ImplSelf
Vincent Rouillé [Fri, 19 Jun 2020 18:33:04 +0000 (20:33 +0200)]
Fix substs in resolve_value_path for ImplSelf

Fixes #4953.

4 years agoUpdate workaround comment
Veetaha [Fri, 19 Jun 2020 17:52:06 +0000 (20:52 +0300)]
Update workaround comment

4 years agoDon't panic on crates depending on themselves
Florian Diebold [Fri, 19 Jun 2020 16:02:54 +0000 (18:02 +0200)]
Don't panic on crates depending on themselves

Fixes #3883.

4 years agoMerge #4851
bors[bot] [Fri, 19 Jun 2020 15:08:52 +0000 (15:08 +0000)]
Merge #4851

4851: Add quickfix to add a struct field r=TimoFreiberg a=TimoFreiberg

Related to #4563
I created a quickfix for record literals first because the NoSuchField diagnostic was already there.
To offer that quickfix for FieldExprs with unknown fields I'd need to add a new diagnostic (or create a `NoSuchField` diagnostic for those cases)

I think it'd make sense to make this a snippet completion (to select the generated type), but this would require changing the `Analysis` API and I'd like some feedback before I touch that.

Co-authored-by: Timo Freiberg <timo.freiberg@gmail.com>
4 years agoMerge #4937
bors[bot] [Fri, 19 Jun 2020 13:43:42 +0000 (13:43 +0000)]
Merge #4937

4937: Allow overriding rust-analyzer display version r=matklad a=oxalica

The build script invokes `git` for version information which is displayed when rust-analyzer is called with `--version`. But in build environment without `git` or when the source code is not a git repo, there's no way to manually specify the version information.

This patch respects environment variable ~`REV`~ `RUST_ANALYZER_REV` in compile time for overriding.

Related: https://github.com/NixOS/nixpkgs/pull/90976

Co-authored-by: oxalica <oxalicc@pm.me>
4 years agoMerge #4839
bors[bot] [Fri, 19 Jun 2020 13:34:24 +0000 (13:34 +0000)]
Merge #4839

4839: `Go to Type Definition` hover action. r=matklad a=vsrs

![hover_actions_goto](https://user-images.githubusercontent.com/62505555/83335671-0122e380-a2b7-11ea-9922-fbdcfb11a7f3.gif)

This implementation supports things like `dyn Trait<SomeType>`, `-> impl Trait`, etc.

Co-authored-by: vsrs <vit@conrlab.com>
4 years agoMerge #4948
bors[bot] [Fri, 19 Jun 2020 13:10:52 +0000 (13:10 +0000)]
Merge #4948

4948: Speedup VFS::partition r=matklad a=matklad

The task of `partition` function is to bin the flat list of paths into
disjoint filesets. Ideally, it should be incremental -- each new file
should be added to a specific fileset.

However, preliminary measurnments show that it is actually fast enough
if we just optimize this to use a binary search instead of a linear
scan.

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoSpeedup VFS::partition
Aleksey Kladov [Fri, 19 Jun 2020 13:07:32 +0000 (15:07 +0200)]
Speedup VFS::partition

The task of `partition` function is to bin the flat list of paths into
disjoint filesets. Ideally, it should be incremental -- each new file
should be added to a specific fileset.

However, preliminary measurnments show that it is actually fast enough
if we just optimize this to use a binary search instead of a linear
scan.

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 agodon't complete top level attrs inside nested attrs and add better labels #4890
Benjamin Coenen [Thu, 18 Jun 2020 19:31:49 +0000 (21:31 +0200)]
don't complete top level attrs inside nested attrs and add better labels #4890

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
4 years agoFix fmt
oxalica [Thu, 18 Jun 2020 18:25:07 +0000 (02:25 +0800)]
Fix fmt

4 years agoAllow overriding rust-analyzer display revision
oxalica [Thu, 18 Jun 2020 12:31:32 +0000 (20:31 +0800)]
Allow overriding rust-analyzer display revision

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 agoApply suggestions from code review
vsrs [Thu, 11 Jun 2020 20:06:58 +0000 (23:06 +0300)]
Apply suggestions from code review

4 years agoAdd Type::walk method
vsrs [Thu, 11 Jun 2020 17:17:32 +0000 (20:17 +0300)]
Add Type::walk method

4 years agoRemove AdtOrTrait
vsrs [Thu, 11 Jun 2020 11:41:42 +0000 (14:41 +0300)]
Remove AdtOrTrait

4 years agoAdd `rust-analyzer.gotoLocation` command
vsrs [Wed, 10 Jun 2020 20:01:19 +0000 (23:01 +0300)]
Add `rust-analyzer.gotoLocation` command

4 years agoAdd associated type test.
vsrs [Wed, 10 Jun 2020 19:58:25 +0000 (22:58 +0300)]
Add associated type test.

4 years agoFix type "items" order.
vsrs [Wed, 10 Jun 2020 19:56:49 +0000 (22:56 +0300)]
Fix type "items" order.

4 years agoAdd `Go to Type Definition` hover action.
vsrs [Wed, 10 Jun 2020 18:24:36 +0000 (21:24 +0300)]
Add `Go to Type Definition` hover action.

4 years agoFix rust-analyzer.debug.openDebugPane option
vsrs [Wed, 10 Jun 2020 13:15:28 +0000 (16:15 +0300)]
Fix rust-analyzer.debug.openDebugPane option

4 years agoFix empty hover action group for a runnable.
vsrs [Wed, 10 Jun 2020 11:23:06 +0000 (14:23 +0300)]
Fix empty hover action group for a runnable.

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 branch 'fix_renaming_mod_in_use_tree' of https://github.com/unexge/rust-analyze...
unexge [Wed, 17 Jun 2020 17:22:55 +0000 (20:22 +0300)]
Merge branch 'fix_renaming_mod_in_use_tree' of https://github.com/unexge/rust-analyzer into fix_renaming_mod_in_use_tree

4 years agoFix renaming mod in use tree
unexge [Thu, 11 Jun 2020 21:40:59 +0000 (00:40 +0300)]
Fix renaming mod in use tree

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>