Commit graph

5233 commits

Author SHA1 Message Date
bors[bot]
2180591593
Merge #3335
3335: Refactor highlighting a bit r=matklad a=matklad

bors r+

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-27 08:32:44 +00:00
Aleksey Kladov
a8e68ff814 Color constants 2020-02-27 09:32:00 +01:00
Aleksey Kladov
9784ab9f39 Move html highlightig to a separate module 2020-02-27 09:32:00 +01:00
Aleksey Kladov
995c46024b Fix html tests 2020-02-27 09:32:00 +01:00
Aleksey Kladov
f7db49bfc6 Better highlightign API 2020-02-27 09:32:00 +01:00
Shotaro Yamada
33de107ed9 Remove unused dependencies 2020-02-27 14:04:13 +09:00
Edwin Cheng
61fd6c6270 Use text_range::extend_to 2020-02-27 10:06:48 +08:00
kjeremy
bc1985037f Update lsp-types 2020-02-26 16:50:47 -05:00
Aleksey Kladov
c88ba9c4bd Fix 2020-02-26 22:10:23 +01:00
Aleksey Kladov
d1e7a20c00
Merge pull request #3327 from matklad/bitsetoops
Fix bitset ops
2020-02-26 18:32:13 +01:00
Aleksey Kladov
2a2d289e5f Fix bitset ops 2020-02-26 18:09:49 +01:00
Aleksey Kladov
913cdcee8f
Merge pull request #3325 from edwin0cheng/skip-trival-token
Skip trival token in original_range
2020-02-26 17:58:32 +01:00
Aleksey Kladov
f38bac48e5 More type safety for highlighting 2020-02-26 17:17:15 +01:00
Edwin Cheng
553254973e Skip trival token in original_range 2020-02-27 00:12:26 +08:00
Edwin Cheng
871dc2bd3c Remove duplicate comment 2020-02-26 20:55:11 +08:00
Edwin Cheng
ffdc740446 Add recursive support in original_range 2020-02-26 20:53:00 +08:00
Aleksey Kladov
ade0176c20 Remove dead code 2020-02-26 13:26:53 +01:00
Aleksey Kladov
09bc7ca74d Reduce visibility 2020-02-26 13:22:46 +01:00
Aleksey Kladov
c3a4c4429d Refactor primary IDE API
This introduces the new type -- Semantics.
Semantics maps SyntaxNodes to various semantic info, such as type,
name resolution or macro expansions.

To do so, Semantics maintains a HashMap which maps every node it saw
to the file from which the node originated. This is enough to get all
the necessary hir bits just from syntax.
2020-02-26 12:55:50 +01:00
Aleksey Kladov
04deae3dba
Merge pull request #3317 from matklad/no-unicase
Actually drop unicase dependency
2020-02-26 12:00:33 +01:00
Aleksey Kladov
8046622871 Actually drop unicase dependency 2020-02-26 11:38:33 +01:00
Aleksey Kladov
52fd19621c Remove code duplication in tests 2020-02-26 11:25:07 +01:00
adamrk
b1ee6d17a4 get matches from code.descendants 2020-02-25 23:53:29 +01:00
adamrk
94603d9848 save comments as ra_syntax::ast::Comment 2020-02-25 23:35:16 +01:00
nmio
f1b7349e7a clean up 2020-02-25 20:56:24 +00:00
kjeremy
fa355d6339 Rename back to highlight and check event's again highlight range 2020-02-25 14:44:47 -05:00
nmio
39bd3b2bd7 Merge branch 'master' of https://github.com/rust-analyzer/rust-analyzer into find-cargo-toml-up-the-fs 2020-02-25 18:01:59 +00:00
Jeremy Kolb
8f6f864547 Semantic Ranges 2020-02-25 11:37:43 -05:00
bors[bot]
d3040c0deb
Merge #3305
3305: Simplify r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-25 13:59:44 +00:00
Aleksey Kladov
d7da42bd40 Simplify 2020-02-25 14:59:13 +01:00
Aleksey Kladov
469011169b ⬆️ rowan 2020-02-25 14:44:51 +01:00
Aleksey Kladov
6542ab89ce Simplify 2020-02-25 13:49:34 +01:00
bors[bot]
3853a3b643
Merge #3298
3298: Bump chalk and replace TypeFamily with Interner r=flodiebold a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-02-25 11:59:47 +00:00
Aleksey Kladov
136151515a Replace generic with a concrete type 2020-02-25 12:43:08 +01:00
Jeremy Kolb
17ffdf9c27 Add docs 2020-02-24 21:17:20 -05:00
kjeremy
9f0cfb7ad2 Teach the server about Semantic Tokens proposed LSP 2020-02-24 20:59:58 -05:00
Laurențiu Nicola
ed69482d90 Bump chalk and replace TypeFamily with Interner 2020-02-24 22:36:57 +02:00
nmio
34e3ef61bd Initial debugging code 2020-02-24 16:38:59 +00:00
Aleksey Kladov
f551e50c16 When joining lines, unwrap trivial diverging blocks 2020-02-24 17:17:05 +01:00
Kirill Bulatov
7f3c0e8564 Omit type hints for enum variant bind pats 2020-02-24 10:32:46 +03:00
adamrk
4f1d90e73b Handle trivia in strucural search and replace 2020-02-23 22:14:47 +01:00
Yoshua Wuyts
b4970b0fe9 Add suggestion for failed path resolution
This adds https://github.com/rust-analyzer/rust-analyzer/issues/3245 as an inline help text for when path resolution fails.
2020-02-23 15:51:32 +01:00
Kirill Bulatov
b2a7b29bb9 Style fixes 2020-02-23 13:02:00 +03:00
Kirill Bulatov
c200dba167 Add basic parameter name hints heuristics 2020-02-23 12:49:53 +03:00
Kirill Bulatov
ca4557ac52 Fix the tests 2020-02-23 01:44:15 +03:00
Kirill Bulatov
6670868d09 Show more parameter name hints 2020-02-23 01:44:15 +03:00
Kirill Bulatov
4ca22f3a88 Simplify inlay hints processing 2020-02-23 01:44:15 +03:00
Aleksey Kladov
fda118f4e9 Simplify 2020-02-22 16:59:31 +01:00
bors[bot]
46dbe4dc80
Merge #3272
3272: ra_db: removed a couple of explicit lifetimes r=matklad a=Veetaha



Co-authored-by: Veetaha <gerzoh1@gmail.com>
2020-02-22 15:07:36 +00:00
Veetaha
4255bc70e8 ra_db: removed a couple of explicit lifetimes 2020-02-22 17:00:39 +02:00
bors[bot]
2cbe8a4c4b
Merge #3263
3263: Implement unsizing coercions using Chalk r=matklad a=flodiebold

These are coercions like `&[T; n] -> &[T]`, which are handled by the `Unsize` and `CoerceUnsized` traits. The impls for `Unsize` are all built in to the compiler and require special handling, so we need to provide them to Chalk.

This adds the following `Unsize` impls:
 - `Unsize<[T]> for [T; _]`
 - `Unsize<dyn Trait> for T where T: Trait`
 - `Unsize<dyn SuperTrait> for dyn SubTrait`

Hence we are still missing the 'unsizing the last field of a generic struct' case.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-02-22 12:31:30 +00:00
Veetaha
59dc797eb3
Fix dat comment 2020-02-22 14:16:13 +02:00
Florian Diebold
5a6e770f99 Shorten some code 2020-02-22 13:15:54 +01:00
Florian Diebold
3e106c77ff Rework find_super_trait_path to protect against cycles 2020-02-22 13:14:39 +01:00
bors[bot]
f9acb4333f
Merge #3260
3260: Refactor how builtins are resolved r=matklad a=flodiebold

This fixes autocompletion suggesting e.g. `self::usize`. (I thought we had a bug for that, but I didn't find it.)

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-02-22 11:25:09 +00:00
Veetaha
5f15e3aeb0
ra_mbe: Remove explicit type annotation 2020-02-22 13:14:46 +02:00
Veetaha
28bdb65407 ra_mbe: added test for malformed token in macro invokation
There was a panic where lexer returned None on malformed tokens.
But now we just ignore tokenization errors in mbe.
2020-02-22 13:10:54 +02:00
Veetaha
93a19bda17 ra_mbe: convert_literal now works with malformed tokens 2020-02-22 13:10:54 +02:00
Florian Diebold
c200025794 Fix shift_bound_vars
It should only shift free vars (maybe the name isn't the best...)
2020-02-22 11:09:21 +01:00
Florian Diebold
463df6720c Fix wrong handling of bare dyn Trait exposed by canonicalizer fix
The self type in the `dyn Trait` trait ref should always be ^0, but we didn't
put that in there in the bare case.
2020-02-22 11:09:21 +01:00
Florian Diebold
2d5ab63247 Add &dyn Trait -> &dyn SuperTrait coercion, and fix &T -> &dyn Trait 2020-02-22 11:09:21 +01:00
Florian Diebold
f126808b2e Fix handling of binders in canonicalization
I'm looking forward to getting rid of this in favor of Chalk's implementation.
2020-02-22 11:09:21 +01:00
Florian Diebold
0dfbbaf03b Implement dyn Trait unsizing as well 2020-02-22 11:09:21 +01:00
Florian Diebold
de39d221a1 Implement unsize coercion using proper trait solving 2020-02-22 11:09:21 +01:00
bors[bot]
baf832d6d9
Merge #3262
3262: Fix handling of const patterns r=matklad a=flodiebold

E.g. in `match x { None => ... }`, `None` is a path pattern (resolving to the
option variant), not a binding. To determine this, we need to try to resolve the
name during lowering. This isn't too hard since we already need to resolve names
for macro expansion anyway (though maybe a bit hacky).

Fixes #1618.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-02-22 00:27:09 +00:00
adamrk
fe8ce4c41d remove unneeded collect 2020-02-21 23:51:30 +01:00
Adam Bratschi-Kaye
7be1044104 use Vec::extend instead of Vec::push in loop
Co-Authored-By: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-02-21 23:51:30 +01:00
adamrk
8b3f449b5f rename module references 2020-02-21 23:51:30 +01:00
Florian Diebold
f1f45f9191 Fix handling of const patterns
E.g. in `match x { None => ... }`, `None` is a path pattern (resolving to the
option variant), not a binding. To determine this, we need to try to resolve the
name during lowering. This isn't too hard since we already need to resolve names
for macro expansion anyway (though maybe a bit hacky).

Fixes #1618.
2020-02-21 17:01:19 +01:00
Florian Diebold
31af774254 Refactor how builtins are resolved
This fixes autocompletion suggesting e.g. self::usize.
2020-02-21 15:39:51 +01:00
Florian Diebold
e50201345e Normalize associated types in types coming from Chalk
Fixes #3232.
2020-02-21 14:06:19 +01:00
Edwin Cheng
d70ddec746 Remove unused placeholder 2020-02-21 18:33:45 +08:00
Edwin Cheng
4e48a73f9c Improve server version info 2020-02-21 18:33:45 +08:00
Aleksey Kladov
7f4b205b72 Better errorse 2020-02-20 18:41:12 +01:00
Laurențiu Nicola
5cd311d64e Fix off by one in onEnter 2020-02-20 11:24:47 +02:00
bors[bot]
e00b9ca3c9
Merge #3215
3215: Exclude methods from non-parameter types introduced by generic constraints r=flodiebold a=lnicola

Fixes #3184.

r? @flodiebold

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-02-19 19:46:37 +00:00
Aleksey Kladov
9549aad525 Fill missing fields of enum variants 2020-02-19 18:17:09 +01:00
Aleksey Kladov
7db7c86881
Merge pull request #3239 from matklad/opt-backtrace
Make backtrace optional
2020-02-19 17:13:27 +01:00
Aleksey Kladov
2ff23c172e Make backtrace optional 2020-02-19 16:28:25 +01:00
kjeremy
044180847a Bump lsp-types 2020-02-19 09:14:05 -05:00
bors[bot]
27587f3501
Merge #3236
3236: Merge NameDefinition and NameKind r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-19 13:57:03 +00:00
Aleksey Kladov
372439dec8 Merge NameDefinition and NameKind 2020-02-19 14:56:22 +01:00
bors[bot]
ff41558296
Merge #3235
3235: Derive visibility as well r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-19 13:46:48 +00:00
Aleksey Kladov
0d5ae89948 Derive visibility as well 2020-02-19 14:45:49 +01:00
bors[bot]
b560de4117
Merge #3234
3234: Don't store deriveable Module info in NameDefinition r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-19 13:33:30 +00:00
Aleksey Kladov
86b66067f6 Don't store deriveable Module info in NameDefinition 2020-02-19 14:32:22 +01:00
Aleksey Kladov
bcb5f1b65c Extend selection handles commas in tuple pats 2020-02-19 13:59:19 +01:00
bors[bot]
624a9978e2
Merge #3231
3231: Add `remove_mut` assist r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-19 11:49:52 +00:00
Aleksey Kladov
312a779610 Add remove_mut assist 2020-02-19 12:44:54 +01:00
bors[bot]
eb804261dc
Merge #3228
3228: Use proper range for hover on macro arguments r=matklad a=edwin0cheng

This PR use `original_range` to remap the range of found syntax node in `hover` and thus it should return the proper text range now.

fixed #3000 
fixed #3135 


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-02-19 10:46:00 +00:00
Laurențiu Nicola
5b05209744 Exclude methods from non-parameter types introduced by generic constraints 2020-02-19 10:46:13 +02:00
Shotaro Yamada
d06733efeb Cleanup 2020-02-19 13:36:59 +09:00
Shotaro Yamada
dd0c3c41b9 Fix a crash with non-ascii whitespace in doc-comments 2020-02-19 13:13:29 +09:00
Edwin Cheng
b9d94d73a2 Use proper range for hover on macro arguments 2020-02-19 11:56:27 +08:00
Aleksey Kladov
b4450b1043 Cleanup imports 2020-02-18 23:52:53 +01:00
Aleksey Kladov
97ab471b6d Minor simplification 2020-02-18 18:52:33 +01:00
Kirill Bulatov
f6816c253b Update versions 2020-02-18 16:12:40 +02:00
Kirill Bulatov
eceaf94f19 More manual clippy fixes 2020-02-18 16:12:37 +02:00
Kirill Bulatov
b8ddcb0652 Run cargo +nightly fix --clippy -Z unstable-options 2020-02-18 16:03:08 +02:00
bors[bot]
eab80cd961
Merge #3218
3218: Cut some deps r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-02-18 13:46:54 +00:00