Commit graph

8164 commits

Author SHA1 Message Date
Aleksey Kladov
f8a59adf5e Tease apart orthogonal concerns in markdown link rewriting
`hir` should know nothing about URLs, markdown and html. It should
only be able to:

* resolve stringy path from documentation
* generate canonical stringy path for a def

In contrast, link rewriting should not care about semantics of paths
and names resolution, and should be concern only with text mangling
bits.
2020-08-26 20:24:00 +02:00
Aleksey Kladov
1c0ac2b9b4 Cleanup hover links tests 2020-08-26 18:36:16 +02:00
León Orell Valerian Liehr
63caef372a Improve support for code block attributes 2020-08-26 15:55:06 +02:00
Aleksey Kladov
7431ec82c9 Simplify 2020-08-26 13:40:45 +02:00
bors[bot]
868aaf2bc6
Merge #5889
5889: Allow logging to file r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-08-26 11:21:17 +00:00
Aleksey Kladov
ed6304131a Simplify 2020-08-26 13:20:46 +02:00
Aleksey Kladov
bb50614d88 Simplify help 2020-08-26 13:20:46 +02:00
Aleksey Kladov
a53c6f6fee Allow redirecting logs to a specific file
There's a surprising lack of crates which are like env_logger, but
also allow writing to a file. Let's write our own then!
2020-08-26 13:20:46 +02:00
Aleksey Kladov
0fc8fd2bd5 **Inline Variable** works with field shorthand 2020-08-26 13:03:14 +02:00
Aleksey Kladov
189521a4db Add sysroot shortcut to rust-project.json 2020-08-25 19:41:56 +02:00
Aleksey Kladov
c6dffe479b Cleanup heavy tests 2020-08-25 19:26:45 +02:00
Aleksey Kladov
9786a8f2d4 Don't expose indexing details 2020-08-25 18:40:41 +02:00
Aleksey Kladov
4f6ca0e081 Minor 2020-08-25 18:07:25 +02:00
Aleksey Kladov
7239d8ca95 Provide better stack trace for overlapping edits
Overlapping indels are a bug. Checking this *always* is tricky (needs
a sorted data structure to not suffer O(N^2) perf). But
opportunistically checking small indels should give provide 80% of the
benefits.
2020-08-25 17:59:37 +02:00
Aleksey Kladov
7fcda5aa46 Prepare to share sysroot lowering code between Cargo & ProjectJSON 2020-08-25 17:53:24 +02:00
Aleksey Kladov
18b667cfcb Complete pub in fields 2020-08-25 17:22:23 +02:00
Aleksey Kladov
6b8bc132dc Prep work for overriding sysroot
The idea here is to make auto-discovery optional, and to allow to set
the path to sysroot directly. This is handy for JSON projects.
2020-08-25 17:04:24 +02:00
Aleksey Kladov
cd9ecdf467 Remove monomorphisation from doclinks resolving code 2020-08-25 14:58:22 +02:00
Aleksey Kladov
66e5ced894 Remove AttrDef 2020-08-25 14:44:15 +02:00
Aleksey Kladov
7487885309 Simplify 2020-08-25 12:58:00 +02:00
Aleksey Kladov
575fb9ab6a Move attrs from code_module to a separate module 2020-08-25 12:56:01 +02:00
Aleksey Kladov
663749beab Minor 2020-08-25 12:48:00 +02:00
Aleksey Kladov
b45dd9ef54 Use the same abstraction for attrs and docs
Doc comments *are* attributes, so there's no reason to have two crates
here.
2020-08-25 12:13:31 +02:00
bors[bot]
59c77ff062
Merge #5866
5866: Improve logging
 r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-08-25 09:46:21 +00:00
Aleksey Kladov
3a72afed8c Improve logging 2020-08-25 11:43:21 +02:00
bors[bot]
96cbad9fb5
Merge #4873
4873: Resolve links in hover documentation r=matklad a=zacps

This PR resolves links in hover documentation. Both the upcoming intra-doc-links style and the old "path-based" style.

## Todo

* [x] More tests
* [ ] Benchmark (Is there an easy way to benchmark this?)
* [x] ~~Resolve issues with the markdown parser/get rid of it~~ Migrate to `pulldown_cmark_to_cmark`
* [x] Reorganise code (Tips appreciated)

---

Fixes #503

Co-authored-by: Zac Pullar-Strecker <zacmps@gmail.com>
2020-08-25 09:11:26 +00:00
Aleksey Kladov
7721accebf Cleanup invert-if
* stick to trivial factory functions in make
* compress the logic for inverting Option/Result
2020-08-25 11:00:32 +02:00
Zac Pullar-Strecker
b835f06cec Merge remote-tracking branch 'upstream/master' into 503-hover-doc-links 2020-08-25 16:44:36 +12:00
Zac Pullar-Strecker
452afaebe1 Changes from review 2020-08-25 16:40:43 +12:00
Jonas Schievink
f3ac19e8cd Support extern types 2020-08-24 22:02:55 +02:00
Pavan Kumar Sunkara
b2d43daeb4 Allow rust-analyzer auto publishing 2020-08-24 17:27:17 +02:00
bors[bot]
81fa00c5b5
Merge #5733
5733: Fix expand glob import bugs r=matklad a=unexge

fixes https://github.com/rust-analyzer/rust-analyzer/issues/5709

TODOs:
- [x] Incorrect node replacing
<details>
    <summary>Details</summary>

```rust
use crate::{
    body::scope::{ExprScopes, ScopeId},
    body::Body,
    builtin_type::BuiltinType,
    db::DefDatabase,
    expr::{ExprId, PatId},
    generics::GenericParams,
    item_scope::{BuiltinShadowMode, BUILTIN_SCOPE},
    nameres::CrateDefMap,
    path::*<|>,
    per_ns::PerNs,
    visibility::{RawVisibility, Visibility},
    AdtId, AssocContainerId, ConstId, ContainerId, DefWithBodyId, EnumId, EnumVariantId,
    FunctionId, GenericDefId, HasModule, ImplId, LocalModuleId, Lookup, ModuleDefId, ModuleId,
    StaticId, StructId, TraitId, TypeAliasId, TypeParamId, VariantId,
};
```
becames
```rust
use crate::{PathKind, name, name, ModPath};
```
</details>

- [x] Ignoring visibility
<details>
    <summary>Details</summary>

```rust
mod foo {
    mod bar {
        pub struct Bar;
    }
}

use foo::bar::*;

fn baz(bar: Bar) {}
```
becames
```rust
mod foo {
    mod bar {
        pub struct Bar;
    }
}

use foo::bar::Bar;

fn baz(bar: Bar) {}
```
although mod `bar` is private
</details>

- [x] Eating attributes

Co-authored-by: unexge <unexge@gmail.com>
2020-08-24 14:26:33 +00:00
Pavan Kumar Sunkara
63f63acc7c Add TBD description to arena 2020-08-24 13:29:10 +02:00
bors[bot]
31cb13dde8
Merge #4776
4776: Do a weekly minor publish to crates.io r=matklad a=pksunkara

This is the same system I set up on Chalk repo.

Every week it creates a new minor version, pushes it to github and then deploys it to crates.io.

Co-authored-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
2020-08-24 11:14:45 +00:00
bors[bot]
150e3843b0
Merge #5845
5845: Omit lenses for not runnable doctests r=matklad a=SomeoneToIgnore

Ideally, we should properly parse the doctest attributes before, but since I need it for the code lens only, this way should suffice for now

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-08-24 11:08:11 +00:00
Pavan Kumar Sunkara
335add49db Add description for crates that will be published 2020-08-24 13:07:22 +02:00
Zac Pullar-Strecker
5452368fad Renames, comments, and dead code removal 2020-08-24 21:50:30 +12:00
Zac Pullar-Strecker
7bbca7a1b3 Merge remote-tracking branch 'upstream/master' into 503-hover-doc-links 2020-08-24 21:20:13 +12:00
Pavan Kumar Sunkara
a8fa5cd42e Add version to deps in cargo.toml 2020-08-24 11:10:41 +02:00
Zac Pullar-Strecker
ca464650ee Add a test to document unimplemented case 2020-08-24 20:47:10 +12:00
Zac Pullar-Strecker
4f5f608b49 Reorganise code 2020-08-24 20:26:45 +12:00
dragfire
1d129a7172 Invert if should be smart about is_some, is_none, is_ok, is_err 2020-08-23 22:30:34 -06:00
Kirill Bulatov
cdd75a699a Omit lenses for not runnable doctests 2020-08-22 22:03:02 +03:00
bors[bot]
e65d48d1fb
Merge #5823
5823: Don't underline function definition if self is &mut r=Nashenas88 a=matklad

The self is right there, and is already underlined, so it makes little
sense to emit even more underlines.

before:
![before](https://user-images.githubusercontent.com/1711539/90672843-0d379500-e257-11ea-840f-b0caed4410f1.png)
after:
![after](https://user-images.githubusercontent.com/1711539/90672840-0c9efe80-e257-11ea-9739-23af433841c6.png)



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-08-22 14:41:17 +00:00
Aleksey Kladov
863b1fb731 ⬆️ ungrammar 2020-08-21 19:14:05 +02:00
Aleksey Kladov
b0fd3faf36 Switch to expect_test from crates.io 2020-08-21 13:19:31 +02:00
Aleksey Kladov
66e0c9f840 Remove expect crate 2020-08-21 13:15:56 +02:00
unexge
ef54e8451d Use new Definition::usages API in expand glob import 2020-08-20 21:35:47 +03:00
unexge
5cff4b60be Fix importing private modules in expand glob import 2020-08-20 21:34:53 +03:00
unexge
5d28dec7b9 Fix importing unused traits in expand glob import 2020-08-20 21:34:53 +03:00