Aleksey Kladov
8b94b429e5
use Source for MacroDef
2019-06-11 18:28:51 +03:00
Aleksey Kladov
a6e339e822
use Source for impl block
2019-06-11 18:28:51 +03:00
Aleksey Kladov
f411c2988d
use Source for Trait
2019-06-11 18:28:51 +03:00
Aleksey Kladov
5e6213b516
simplify
2019-06-11 18:28:51 +03:00
Aleksey Kladov
f2ccc54468
use Source for TypeAlias
2019-06-11 18:28:51 +03:00
Aleksey Kladov
647c8f3df8
reduce duplication in hover
2019-06-11 18:28:51 +03:00
Aleksey Kladov
46bc8675ed
use Source for statics and consts
2019-06-11 18:28:51 +03:00
Aleksey Kladov
4f94af3c4a
use Source for Function
2019-06-11 18:28:51 +03:00
Aleksey Kladov
36865adcb9
Introduce HasSource trait
2019-06-11 18:28:51 +03:00
Aleksey Kladov
2a1fe26b6d
use Source more
2019-06-11 18:28:51 +03:00
Aleksey Kladov
91c120ccea
introduce Source struct
2019-06-11 18:28:51 +03:00
Shotaro Yamada
acafbd66f8
Fix hover for pat that shadows items
2019-06-11 23:46:33 +09:00
Edwin Cheng
656a0fa9f9
Simpliy hover on ast::name
2019-06-11 01:18:32 +08:00
Edwin Cheng
34322ea9a3
Use classify_name_ref in hover
2019-06-11 00:34:43 +08:00
Edwin Cheng
60938ff73e
Remove incorrect FIXME
2019-06-10 03:41:21 +08:00
Edwin Cheng
9ded8d2eab
Formating
2019-06-10 03:39:42 +08:00
Edwin Cheng
e91bf0bba4
Use &str instread of Option<String>
2019-06-10 03:37:34 +08:00
Edwin Cheng
fc70275fed
Rename "string" to "buf"
2019-06-10 03:30:03 +08:00
Edwin Cheng
41cb3fd758
Rename Description to ShortLabel
2019-06-10 03:28:53 +08:00
Edwin Cheng
358ad0efca
Make description_from_symbol depends on symbol
2019-06-10 00:20:49 +08:00
Edwin Cheng
4db0f0ccaf
Rename description funcs
2019-06-10 00:09:19 +08:00
Edwin Cheng
e9848b2e6c
Change docs and description to getter method
2019-06-10 00:04:03 +08:00
Edwin Cheng
aacc894134
Add display::Description
2019-06-09 23:59:59 +08:00
Edwin Cheng
2acf1e16fc
Construct doc individually
2019-06-09 03:27:01 +08:00
Edwin Cheng
d46278d320
Remove node function in NavTarget
2019-06-08 22:27:11 +08:00
Aleksey Kladov
1b783e33e9
one macro def should be enough
2019-06-08 14:48:56 +03:00
bors[bot]
8ba5617613
Merge #1377
...
1377: Use inline snapshots in complete_keyword r=matklad a=sbihel
Relates to #1127
Co-authored-by: Simon Bihel <simon.bihel@ens-rennes.fr>
2019-06-06 13:10:46 +00:00
Alan Du
b28ca32db2
Fix clippy::or_fun_call
2019-06-04 18:05:07 -04:00
Alan Du
40424d4222
Fix clippy::identity_conversion
2019-06-04 18:05:07 -04:00
Alan Du
682bf04bf4
Fix clippy::new_without_default
2019-06-04 18:05:07 -04:00
Alan Du
6939011b27
Fix clippy::assign_op_pattern
2019-06-04 18:05:07 -04:00
Alan Du
21d7964bc3
Fix clippy::useless_format
2019-06-04 18:05:07 -04:00
Alan Du
fb592d76aa
Fix clippy::into_iter_on_ref
2019-06-04 18:05:07 -04:00
Alan Du
619a615298
Fix clippy::len_zero
2019-06-04 18:05:07 -04:00
Alan Du
fafca4cb11
Fix clippy::ptr_arg
2019-06-04 18:05:07 -04:00
Alan Du
b9af1d7c42
Fix clippy::match_ref_pats
2019-06-04 18:05:07 -04:00
Alan Du
ecd420636e
Fix clippy::single_match
2019-06-04 18:05:07 -04:00
Simon Bihel
ec31f475ca
Use inline snapshots in complete_keyword
2019-06-04 21:26:12 +01:00
Aleksey Kladov
8b7f58976b
don't cache parses twice
...
Before this commit, `Parse`s for original file ended up two times in
salsa's db: first, when we parse original file, and second, when we
parse macro or a file.
Given that parse trees are the worst ofenders in terms of memory, it
makes sense to make sure we store them only once.
2019-06-02 20:15:10 +03:00
Aleksey Kladov
2f02e1a8ba
collect macro queries
2019-06-02 18:58:49 +03:00
Aleksey Kladov
5af9e475f4
add AstDatabase
2019-06-02 12:27:36 +03:00
Aleksey Kladov
011599df27
collect types and bodies
2019-06-01 22:47:20 +03:00
Aleksey Kladov
f7d3a87305
collect impl source maps
2019-06-01 22:31:22 +03:00
Aleksey Kladov
d7a2a9171e
don't cache ast_id_to_node
2019-06-01 22:14:42 +03:00
Aleksey Kladov
37e80c5297
show macro expanded trees in the stats as well
2019-06-01 22:13:24 +03:00
Edwin Cheng
371961be0e
Improve goto definition for MBE
2019-06-01 19:34:19 +08:00
Laurențiu Nicola
be15541b03
Sort hover results in tests
2019-05-30 21:20:17 +03:00
Aleksey Kladov
b6a854e161
update ra_ide_api to use builtins
2019-05-30 16:10:07 +03:00
Aleksey Kladov
18ed351747
⬆️ parking_lot
2019-05-30 12:02:30 +03:00
Aleksey Kladov
0ee5bd16c9
cancel salsa's validation
...
This small fix should improve rust-analyzer resopnsivness for
real-time operations like onEnter handling.
Turns out, salsa's validation can take hundreds of milliseconds, and,
in case no changes were made, it won't be triggering any queries.
Because we check for cancellation in queries, that means that
validation is not cancellable!
What this PR does is injecting check_canceled checks into validation,
by using salsa's event API, which wasn't meant to be used like this,
but, hey, it works!
Here's the onEnter handling before and after this change:
https://youtu.be/7-ffPzgvH7o
2019-05-30 10:06:02 +03:00
Laurențiu Nicola
b1e59cb095
Highlight primitive types
2019-05-29 21:54:22 +03:00
bors[bot]
7a1cae59ac
Merge #1337
...
1337: Move syntax errors our of syntax tree r=matklad a=matklad
I am not really sure if it's a good idea, but `SyntaxError` do not really belong to a `SyntaxTree`. So let's just store them on the side?
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-05-29 06:40:39 +00:00
Laurențiu Nicola
9146a64386
Highlight type names correctly
2019-05-29 08:30:53 +03:00
Aleksey Kladov
80a1725147
fix todo
2019-05-28 18:50:53 +03:00
Aleksey Kladov
61e1474ab3
fix typos in mbe tests
2019-05-28 18:46:11 +03:00
bors[bot]
b2bf41b2ba
Merge #1334
...
1334: check for cancellation during macro expansion r=matklad a=matklad
closes #1331
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-05-27 11:45:41 +00:00
Aleksey Kladov
0d2f97e83e
specifically profile cancellation
2019-05-27 14:27:05 +03:00
Pascal Hertleif
5abcca516d
make it build again
2019-05-27 11:26:35 +02:00
Pascal Hertleif
2b200f6e1a
Disable broken struct field rainbowing
2019-05-27 11:26:35 +02:00
Pascal Hertleif
43d5a49653
More clever highlighting, incl draft for structs
2019-05-27 11:26:35 +02:00
Pascal Hertleif
ed89b0638b
Hash based on binding name and shadow counter
2019-05-27 11:26:35 +02:00
Pascal Hertleif
5bf3e949e8
Semantic highlighting spike
...
Very simple approach: For each identifier, set the hash of the range
where it's defined as its 'id' and use it in the VSCode extension to
generate unique colors.
Thus, the generated colors are per-file. They are also quite fragile,
and I'm not entirely sure why. Looks like we need to make sure the
same ranges aren't overwritten by a later request?
2019-05-27 11:26:33 +02:00
Aleksey Kladov
c6e905a79f
Colorize Rust code as HTML
2019-05-25 13:42:34 +03:00
Aleksey Kladov
53ae63835d
⬆️ rustc
2019-05-24 01:46:23 +03:00
Aleksey Kladov
f6d2c3f9d5
profile highlighting
2019-05-23 21:19:54 +03:00
Aleksey Kladov
5d54aa6781
add union to code_model
2019-05-23 20:18:47 +03:00
Laurențiu Nicola
f1ec88cc56
Improve highlighting of name refs
2019-05-23 15:31:35 +03:00
Laurențiu Nicola
444e52e519
Move NameRef classification logic out of reference_definition
2019-05-23 12:32:47 +03:00
bors[bot]
51e82fe6d2
Merge #1299
...
1299: Use ThemeColor and add support for light themes r=matklad a=lnicola
Part of #1294 .
- switch to `ThemeColor`
- add light and high contrast theme definitions
- highlight control flow keywords and `unsafe`
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2019-05-21 13:58:42 +00:00
Laurențiu Nicola
b08362f6d2
Address feedback
2019-05-21 16:28:10 +03:00
Laurențiu Nicola
9ade271a67
Use ThemeColor and add support for light themes
2019-05-21 14:19:08 +03:00
Aleksey Kladov
507c97a18c
⬆️ insta
2019-05-21 13:21:54 +03:00
Sergey Parilin
993abedd77
apply T! macro where it is possible
2019-05-15 15:35:47 +03:00
Aleksey Kladov
16c7405262
expand to syntax node
2019-05-14 09:03:43 +03:00
Aleksey Kladov
549728bba8
make AstId untyped
2019-05-13 19:39:06 +03:00
bors[bot]
033a32f349
Merge #1257
...
1257: Implemented tkn! macro for syntax kinds r=matklad a=pasa
Implementation of #1248
Co-authored-by: Sergey Parilin <sergey.parilin@fxdd.com>
2019-05-13 13:49:14 +00:00
Sergey Parilin
57bb618fd3
Implemented T! macro for syntax kinds
2019-05-13 15:19:57 +03:00
Aleksey Kladov
9cba67b2ad
simplify
2019-05-12 23:03:37 +03:00
Sergey Parilin
26ed925685
fill struct fields diagnostic
2019-05-06 17:16:11 +03:00
Marco Groppo
7e7ea0e79d
Profile diagnostics.
2019-05-05 16:32:53 +02:00
bors[bot]
aa7bdfd37f
Merge #1208
...
1208: [WIP] Goto for Macro's r=matklad a=Lapz
Adds goto definition for macros. Currently only works for macros in the current crate ~~otherwise it panics~~. Proper macro resolution needs to be added for it to resolve macros in other crates.
Todo
- [X] Allow goto from macro calls
- [X] Fix panics
- [x] Add tests
![Screen Recording 2019-04-25 at 18 00 24](https://user-images.githubusercontent.com/19998186/56754499-1dd01c00-6785-11e9-9e9a-1e36de70cfa3.gif )
Co-authored-by: Lenard Pratt <l3np27@gmail.com>
2019-05-04 18:38:10 +00:00
Florian Diebold
a4eb1a546c
Differentiate Tuple / FnPtr type constructors by cardinality
...
This is necessary because Chalk (reasonably) expects each 'struct' to know how
many type parameters it takes.
2019-05-04 19:11:21 +02:00
Lenard Pratt
8198e13c26
Added local macro goto
2019-05-04 17:39:51 +01:00
Aleksey Kladov
ca5aedc9bf
revert eagarly clean astd maps
...
This causes massive slowdown :-(
2019-05-04 15:29:35 +03:00
Aleksey Kladov
6c63a59425
eagarly clean astd maps
2019-05-04 11:53:44 +03:00
Florian Diebold
85633656df
Fix hover on the beginning of a nested expression
...
E.g. in
```
let foo = 1u32;
if true {
<|>foo;
}
```
the hover shows `()`, the type of the whole if expression, instead of the more
sensible `u32`. The reason for this was that the search for an expression was
slightly left-biased: When on the edge between two tokens, it first looked at
all ancestors of the left token and then of the right token. Instead merge the
ancestors in ascending order, so that we get the smaller of the two possible
expressions.
2019-04-28 16:03:49 +02:00
kjeremy
558bdf73c8
simplify match
2019-04-24 14:45:02 -04:00
kjeremy
f69bf6a12b
See through references
2019-04-24 12:09:29 -04:00
bors[bot]
6009af9b7c
Merge #1200
...
1200: Allows searching for case-equivalent symbols (fixes #1151 ) r=matklad a=jrvidal
I couldn't find a nice, functional way of calculating the ranges in one pass so I resorted to a plain old `for` loop.
Co-authored-by: Roberto Vidal <vidal.roberto.j@gmail.com>
2019-04-23 21:25:37 +00:00
Roberto Vidal
dd8c3840cb
CR corrections
2019-04-23 22:19:45 +02:00
kjeremy
a5bf0cdb97
Simplify
2019-04-23 15:44:37 -04:00
kjeremy
7125192c1e
Basic resolution for ADT
2019-04-23 14:32:47 -04:00
Roberto Vidal
b56f010201
Allows searching for case-equivalent symbols ( fixes #1151 )
2019-04-23 20:11:45 +02:00
bors[bot]
c416caeda2
Merge #1194
...
1194: Pr 1190 r=matklad a=matklad
Co-authored-by: Andrea Pretto <eulerdisk@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-04-22 13:19:47 +00:00
Aleksey Kladov
c27a3da5e8
remove path_ident from CompletionContext
...
We really shouldn't be looking at the identifier at point. Instead,
all filtering and sorting should be implemented at the layer above.
This layer should probably be home for auto-import completions as
well, but, since that is not yet implemented, let's just stick this
into complete_scope.
2019-04-22 16:04:56 +03:00
Aleksey Kladov
e01052d1f0
move auto-imoprter into IDE
...
auto-import is purely an IDE concern, so it should be done outside of
HIR
2019-04-22 15:56:28 +03:00
Aleksey Kladov
b811922a53
fix postfix match indent
2019-04-22 10:38:39 +03:00
Andrea Pretto
200032852b
complete_import: prevent panic when the anchor is the completion source range
...
(fix rebase mess)
Please enter the commit message for your changes. Lines starting
2019-04-22 00:48:43 +02:00
Andrea Pretto
9144214958
complete_import: add new import resolver infrastructure with some hardcoded importable name.
...
Changes complete_scope to support that.
2019-04-22 00:14:58 +02:00
Marco Groppo
8ebb20edce
New krate() method in Resolver.
...
Renamed Impl to ImplBlock.
2019-04-20 00:20:26 +02:00
Marco Groppo
e85ee60c42
Initial support for lang items.
2019-04-20 00:10:19 +02:00
Aleksey Kladov
c4a5aa45dc
add a couple of profiling points
2019-04-15 01:10:07 +03:00
Florian Diebold
4f8a49f43c
Refactor method candidate generation a bit
...
This fixes the order in which candidates are chosen a bit (not completely
though, as the ignored test demonstrates), and makes autoderef work with trait
methods. As a side effect, this also makes completion of trait methods work :)
2019-04-14 21:53:35 +02:00
Florian Diebold
413c87f155
Get substs for trait refs in impl blocks
2019-04-14 11:28:53 +02:00
Aleksey Kladov
62d01dd4df
hide resolver
2019-04-13 11:00:15 +03:00
Aleksey Kladov
f4a94e74bc
fold ScopeWithSyntax into SourceAnalyzer
2019-04-13 10:49:01 +03:00
Aleksey Kladov
cec67b2b65
obsolete fixm
2019-04-13 09:50:02 +03:00
Aleksey Kladov
3aae223d93
hide some scopes
2019-04-13 09:31:03 +03:00
Aleksey Kladov
0fd93bc14a
use really correct resolver for expressions
2019-04-13 00:44:47 +03:00
Aleksey Kladov
20013de2ab
fix typo
2019-04-11 17:15:20 +03:00
Aleksey Kladov
ebb0c377f0
remove resolver from CompletonContext
2019-04-11 16:49:35 +03:00
Aleksey Kladov
5471c1ef4b
generalize SourceAnalyzer to handle all defs with bodies
2019-04-11 16:37:29 +03:00
Aleksey Kladov
07cc047b4f
minimize the API
2019-04-11 16:29:33 +03:00
Aleksey Kladov
b6809b6695
rename
2019-04-11 16:29:33 +03:00
Aleksey Kladov
6c2ba945ed
reduce visibility
2019-04-11 16:29:33 +03:00
Aleksey Kladov
505acc973b
Make call info to use real name resolution
2019-04-11 16:29:33 +03:00
Aleksey Kladov
10d66d63d7
introduce SourceAnalyzer
2019-04-11 16:29:33 +03:00
bors[bot]
6d9acb8753
Merge #1131
...
1131: Use inline snapshots in complete_dot r=matklad a=vipentti
Relates to #1127
Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-04-10 11:05:31 +00:00
Ville Penttinen
57283b4e5f
Use inline snapshots in complete_dot
2019-04-10 13:47:20 +03:00
Ville Penttinen
1b19c1c8f2
Use inline snapshots in complete_fn_param
2019-04-10 13:22:50 +03:00
Aleksey Kladov
10726fdb65
type-safer source-map for bindings
2019-04-10 10:48:15 +03:00
Aleksey Kladov
6b993a9760
migrate to salsas interning
2019-04-09 22:51:22 +03:00
Ville Penttinen
45a2b92524
Fix doc comment
2019-04-09 16:08:24 +03:00
Ville Penttinen
07f0069f34
Move display related things from hover to display
2019-04-09 14:45:05 +03:00
Ville Penttinen
fead60aa27
Move FunctionSignature to display/function_signature
2019-04-09 14:45:05 +03:00
Ville Penttinen
bd6ddfcdde
Make display modules private
2019-04-09 14:45:05 +03:00
Ville Penttinen
7821c56be7
Move structure to display/structure
2019-04-09 14:45:05 +03:00
Ville Penttinen
027d4d229d
Move navigation_target to display/navigation_target
2019-04-09 14:45:05 +03:00
Ville Penttinen
946b5789d1
Move completion label functions to display
2019-04-09 14:45:05 +03:00
Ville Penttinen
dfaebd76ab
Add FunctionSignature::from_hir
2019-04-09 14:45:05 +03:00
Ville Penttinen
2fe075f56e
Normalize line-endings in display.rs
...
This changes from CRLF to LF
2019-04-09 14:45:05 +03:00
Ville Penttinen
f4aa15c16b
Move FunctionSignature creation to display
2019-04-09 14:45:05 +03:00
Ville Penttinen
ed65e2619a
Add no parameter test to call_info
2019-04-09 14:45:05 +03:00
Ville Penttinen
7ba22f1c19
Move FunctionSignature to display, remove write_joined
...
write_joined is replaced with `join_to_string::join` which provides the
necessary functionality.
2019-04-09 14:45:05 +03:00
Ville Penttinen
84fde47d00
Move test specific things
2019-04-09 14:45:04 +03:00
Ville Penttinen
751b454442
Update test snapshots
2019-04-09 14:45:04 +03:00
Ville Penttinen
0e49abb7fb
Refactor CallInfo function signatures to new FunctionSignature type
...
This is used by CallInfo to create a pretty printed function signature that can
be used with completions and other places as well.
2019-04-09 14:45:04 +03:00
robojumper
2caa690ef6
Rudimentarily autocomplete tuple struct field access
2019-04-06 01:10:48 +02:00
Aleksey Kladov
0de89f786f
always produce source for import
2019-04-02 17:58:04 +03:00
Aleksey Kladov
7d6bd5d137
always show token text
2019-04-02 14:49:46 +03:00
Aleksey Kladov
49f13d3a9b
fix a panic with glob-import missing a source map
2019-04-02 13:26:09 +03:00
Aleksey Kladov
5287a2506c
More future-proof comment kind
2019-04-02 12:18:52 +03:00
Aleksey Kladov
3f3ff2f0f4
fix comment naming
2019-04-02 10:48:59 +03:00
Aleksey Kladov
ae282d8da6
add ast::tokens
2019-04-02 10:23:29 +03:00
bors[bot]
b7e26c32a1
Merge #1067
...
1067: Take number of arguments at the call-site into account for signature help r=matklad a=kjeremy
Fixes #1065
Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-04-01 11:15:34 +00:00
Aleksey Kladov
9e213385c9
switch to new rowan
2019-04-01 12:06:24 +03:00
kjeremy
80113876e2
Simplify
2019-03-27 11:02:06 -04:00
kjeremy
7b34c4c002
Take number of arguments at the call-site into account for signature help
...
Fixes #1065
2019-03-27 10:00:51 -04:00
bors[bot]
a82755e241
Merge #1059
...
1059: Typed ids r=matklad a=matklad
just some type-safety and refactorings.
closes https://github.com/rust-analyzer/rust-analyzer/issues/1054
bors r+
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-03-26 16:16:54 +00:00
Aleksey Kladov
e28db444df
rename
2019-03-26 19:11:01 +03:00