rust/crates/ra_hir_def/src
bors[bot] 5b8fdfe231
Merge #5553
5553: Add fix ranges for diagnostics r=matklad a=SomeoneToIgnore

A follow-up of https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Less.20red.20in.20the.20code

Now diagnostics can apply fixes in a range that's different from the range used to highlight the diagnostics.
Previous logic did not consider the fix range, having both ranges equal, which could cause a lot of red noise in the editor.
Now, the fix range gets used with the fix, the diagnostics range is used for everything else which allows to improve the error highlighting.

before:
<img width="191" alt="image" src="https://user-images.githubusercontent.com/2690773/88590727-df9a6a00-d063-11ea-97ed-9809c1c5e6e6.png">
after:
<img width="222" alt="image" src="https://user-images.githubusercontent.com/2690773/88590734-e1fcc400-d063-11ea-9b7c-25701cbd5352.png">

`MissingFields` and `MissingPatFields` diagnostics now have the fix range as `ast::RecordFieldList` of the expression with an error (as it was before this PR), and the diagnostics range as a `ast::Path` of the expression, if it's present (do you have any example of `ast::Expr::RecordLit` that has no path btw?).
The rest of the diagnostics have both ranges equal, same as it was before this PR.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-08-12 13:44:13 +00:00
..
body Finish rename 2020-07-31 22:04:12 +02:00
item_tree Revert function structs back to using bool to track self param, use first param for self information in syntax highlighting instead 2020-08-10 08:44:54 -04:00
nameres Rename ModuleItem -> Item 2020-07-30 00:23:03 +02:00
path Fix GenericArgs grammar 2020-07-31 18:41:37 +02:00
adt.rs Move unsafe packed ref logic to Semantics, use Attrs::by_key to simplify repr attr lookup 2020-08-10 08:44:54 -04:00
attr.rs Finalize attribute grammar 2020-07-30 20:21:32 +02:00
body.rs Rename RecordLit -> RecordExpr 2020-07-30 16:21:30 +02:00
builtin_type.rs find_path: Builtins are always in scope 2020-04-18 12:06:22 +02:00
child_by_source.rs Rename EnumVariant -> Variant 2020-07-30 17:56:53 +02:00
data.rs Revert function structs back to using bool to track self param, use first param for self information in syntax highlighting instead 2020-08-10 08:44:54 -04:00
db.rs Remove raw item query 2020-06-24 16:53:16 +02:00
diagnostics.rs Better naming and docs 2020-08-11 17:52:05 +03:00
docs.rs Consolidate documentation expansion and merging 2020-06-03 06:54:41 -04:00
dyn_map.rs DynMap 2019-12-06 21:28:05 +01:00
expr.rs Rename Expr::UnsafeBlock to Expr::Unsafe 2020-06-27 10:10:26 -04:00
find_path.rs find_path: return shorter paths for external items 2020-06-12 13:01:20 +02:00
generics.rs Finalize TypeBound grammar 2020-07-31 15:01:18 +02:00
import_map.rs Remove insta for ra_hir_def 2020-07-17 15:54:40 +02:00
item_scope.rs Support Trait as _ imports 2020-07-21 17:55:17 +02:00
item_tree.rs Revert function structs back to using bool to track self param, use first param for self information in syntax highlighting instead 2020-08-10 08:44:54 -04:00
keys.rs Finalize impl Grammar 2020-07-30 18:28:28 +02:00
lang_item.rs Fix some clippy perf warnings 2020-05-25 13:35:52 -04:00
lib.rs Rename ModuleItem -> Item 2020-07-30 00:23:03 +02:00
nameres.rs Support Trait as _ imports 2020-07-21 17:55:17 +02:00
path.rs Rename TypeArgList -> GenericArgList 2020-07-31 18:29:29 +02:00
per_ns.rs Track import type outside of , use enum rather than bool to improve readability 2020-06-25 12:42:12 -04:00
resolver.rs Remove entries_without_primitives 2020-06-30 14:06:23 +02:00
src.rs Merge item tree traits 2020-06-24 16:53:56 +02:00
test_db.rs Switch to fully dynamically dispatched salsa 2020-07-07 10:14:48 +02:00
trace.rs Simplify Arena to use a generic index 2020-03-19 18:46:30 +01:00
type_ref.rs Update grammar 2020-08-01 13:47:19 +02:00
visibility.rs Support Trait as _ imports 2020-07-21 17:55:17 +02:00