Commit Graph

266 Commits

Author SHA1 Message Date
Ryo Yoshida
d01283b1f7
Deduplicate tuple indices for completion 2023-06-13 18:01:54 +09:00
Ryo Yoshida
42eab5e100
Deduplicate field names for completion 2023-06-11 19:34:27 +09:00
Ryo Yoshida
b4795507e3
autoderef: completely resolve and deduplicate types 2023-06-11 19:34:22 +09:00
Ryo Yoshida
d091991491
fix(completion): derive source scope from syntax node to be transformed 2023-06-11 15:25:43 +09:00
ponyii
7f45cccda4 lifetime transformation: refactoring & a new test 2023-06-03 21:34:31 +04:00
Lukas Wirth
dc7c6d43c7 Slightly shrink DefMap 2023-06-01 14:46:36 +02:00
hkalbasi
51368793b4 MIR episode 6 2023-05-28 23:25:15 +03:30
Lukas Wirth
c7ef6c25b7 internal: Replace Display impl for Name 2023-05-24 20:55:12 +02:00
Ryo Yoshida
68a74decb6
Process macro_use prelude in semantic scope resolver 2023-05-17 17:45:44 +09:00
hecatia-elegua
2a182f3f1f Add doc(alias)-based method completion 2023-05-10 12:51:08 +02:00
bors
420a038da9 Auto merge of #14513 - hecatia-elegua:alias-based-completion2, r=Veykril
doc(alias)-based completion round 2

Follow-up on #14433
We can now complete fields, functions and some use/mods.
Flyimports don't behave, I don't really have the time to understand the structure there either.
While reading the flyimport code, I removed one method only used there, the closure-tree was a bit confusing, I can revert that if you want.
2023-04-24 06:34:25 +00:00
bors
2400b36a2e Auto merge of #14577 - jsoref:spelling, r=lnicola
Spelling

This PR corrects misspellings identified by the [check-spelling action](https://github.com/marketplace/actions/check-spelling).

The misspellings have been reported at https://github.com/jsoref/rust-analyzer/actions/runs/4699991040#summary-12751355796

The action reports that the changes in this PR would make it happy: https://github.com/jsoref/rust-analyzer/actions/runs/4699991284#summary-12751356293

closes #14567
2023-04-19 14:05:40 +00:00
Josh Soref
bc7d84c3ce Spelling
* a rule
* access
* after
* amount
* annotations
* assignment
* assist
* associated
* attribute
* borrowed
* built-in type
* clarification
* command
* const
* constructor
* corresponding
* counterparts
* curlies
* dependencies
* deterministic
* diagnostic
* duplicates
* edge
* edited
* efficient
* elsewhere
* execution
* expression
* extensions
* extracted
* fill
* github
* helper
* heuristic
* incomplete
* indent end
* inlay
* invocation
* lifetime
* looking
* maybe
* move
* mutability
* mutable
* necessarily
* necessary
* negative
* nonexistent
* occurred
* offsets
* offsetted
* overridden
* parameters
* params
* params_and_where_preds_in_scope
* paredit
* parent
* parentheses
* prepended if
* punctuation
* receive
* receiver
* referring
* repeated
* representing
* semantically
* separately
* shouldnot
* siblings
* similar
* something's
* statement
* struct
* structure
* surprise
* the
* this
* transparent
* unimplemented
* unnamed
* unnecessary
* unneeded
* unreachable
* unterminated
* utilities
* variant
* variants
* visibility
* work around (v)
* workaround

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-19 09:45:55 -04:00
Ryo Yoshida
4db87f9346
Fix release channel detection
See bootstrap code in rust-lang/rust for versioning details: e49122fb1c/src/bootstrap/lib.rs (L1244)
2023-04-18 02:12:17 +09:00
Ryo Yoshida
ac03de773f
Add flag to disallow opaque types for DisplayTarget::SourceCode 2023-04-12 19:03:48 +09:00
hecatia-elegua
398af0259f
Merge branch 'master' into alias-based-completion2 2023-04-11 21:14:52 +02:00
bors
7501d3b721 Auto merge of #14551 - lowr:patch/no-unstable-item-compl-on-stable, r=Veykril
Fix faulty variable extraction

Followup to #14549

Fixes https://github.com/rust-lang/rust-analyzer/pull/14549#discussion_r1163128814 and https://github.com/rust-lang/rust-analyzer/pull/14549#discussion_r1163132104
2023-04-11 17:43:15 +00:00
Ryo Yoshida
0a638676d1
Fix faulty variable extraction 2023-04-12 02:35:43 +09:00
bors
a1af8bb141 Auto merge of #14548 - Veykril:smol-str, r=Veykril
minor: Bump smol-str
2023-04-11 15:03:24 +00:00
Lukas Wirth
1456b53051 Bump smol-str 2023-04-11 14:39:19 +02:00
Ryo Yoshida
e6e48728da
Add tests for stability check in completion 2023-04-11 21:21:15 +09:00
Ryo Yoshida
0ce71dd76f
completion: check stability 2023-04-11 21:21:13 +09:00
hecatia-elegua
33ee157f3b Render alias text for use imports
* removes one method breaking the flow
2023-04-06 17:25:30 +02:00
hecatia-elegua
b4515d987f Add doc(alias)-based use and other mod completion 2023-04-05 22:08:59 +02:00
hecatia-elegua
f87f468dbd Add doc(alias)-based function name completion 2023-04-05 19:35:21 +02:00
hecatia-elegua
410acd7188 Add doc(alias)-based field completion 2023-04-05 19:28:55 +02:00
bors
265f83031f Auto merge of #14433 - hecatia-elegua:alias-based-completion, r=Veykril
Add doc-alias based completion

Closes #14406.

I adapted the parsing code from the CfgExpr parsing code, maybe there's a better abstraction for both, or attribute parsing in general. It also includes `doc(hidden)`-parsing, which means it could replace the other function.
There are a few tests for parsing.

`process_all_names` changed the most, I added some docs there to explain what happens.

Many call sites just pass an empy vec to `add_path_resolution`'s `doc_aliases`, since either it doesn't make sense to pass anything (e.g. visibility completion) or I don't know where to get them from. Shouldn't really matter, as it will just not show aliases if the vec is empty and we can extend alias completion in these cases later.

I added two tests in `special.rs` for struct name completion (which was the main thing I wanted). I also tried function and field names, but these don't work yet. I want to add those in a follow-up PR.
2023-04-05 13:44:51 +00:00
hecatia-elegua
c469936aac Address review comments part 1 2023-03-30 17:35:57 +02:00
Lukas Wirth
e244942209 internal: Set Durability to HIGH for enable_proc_attr_macros input 2023-03-30 15:11:22 +02:00
hecatia-elegua
ba2b48d1b8 Fix3 2023-03-29 14:58:33 +02:00
hecatia-elegua
53afac72d2 Fix2 2023-03-29 14:34:06 +02:00
hecatia-elegua
0863389dd1 Add doc-alias based completion 2023-03-29 14:08:25 +02:00
bors
7c05f55f0c Auto merge of #13789 - feniljain:fix_enum_completion, r=Veykril
feat: show only missing variant suggestion for enums in patterns completion and bump them in list too

Fixes #12438

### Points to help in review:

- This PR can be reviewed commit wise, first commit is about bumping enum variant completions up in the list of completions and second commit is about only showing enum variants which are not complete
- I am calculating missing variants in analysis.rs by firstly locating the enum and then comparing each of it's variant's name and checking if arm string already contains that name, this is kinda hacky but I didn't want to implement complete missing_arms assist here as that would have been too bulky to run on each completion cycle ( if we can improve this somehow would appreciate some inputs on it )

### Output:

https://user-images.githubusercontent.com/49019259/208245540-57d7321b-b275-477e-bef0-b3a1ff8b7040.mov

Relevant Zulip Discussion: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Issue.20.2312438
2023-03-18 07:06:27 +00:00
feniljain
a79a76a942 refactor: pass is_variant_missing as args to build_completion 2023-03-18 11:46:22 +05:30
feniljain
f7113685b5 fix: make tests valid rust code 2023-03-18 11:43:45 +05:30
feniljain
6778d1a6eb feat: do not remove other variants, just push them down in list 2023-03-16 22:54:12 +05:30
bors
e611fbe6ab Auto merge of #14355 - Veykril:completion-ref-strip, r=Veykril
fix: Fix reference completions being emitted in places other than argument lists

Fixes https://github.com/rust-lang/rust-analyzer/issues/14331
2023-03-15 09:47:20 +00:00
Lukas Wirth
82ed68c95e fix: Fix reference completions being emitted in places other than argument lists 2023-03-15 10:41:17 +01:00
feniljain
d03c789798 chore: change casing for variants in tests 2023-03-15 10:11:43 +05:30
Lukas Wirth
2c364f6e5a Fix tests 2023-03-14 19:55:20 +01:00
feniljain
a10372dac6 fix: use compute_type_match correctly and update tests accordingly 2023-03-14 11:41:25 +05:30
bors
544b4cfe4d Auto merge of #109069 - lnicola:rust-analyzer-2023-03-13, r=lnicola
⬆️ `rust-analyzer`

r? `@ghost`
2023-03-13 16:54:43 +00:00
Laurențiu Nicola
b2f6fd4f96 ⬆️ rust-analyzer 2023-03-13 10:42:24 +02:00
clubby789
c6da2f9d96 Remove uses of box_syntax in rustc and tools 2023-03-12 13:19:46 +00:00
Laurențiu Nicola
7e711da2f0 ⬆️ rust-analyzer 2023-02-20 10:14:12 +02:00
Laurențiu Nicola
bc45c7659a ⬆️ rust-analyzer 2023-02-13 13:55:14 +02:00
arcnmx
25242fe93f ⬆️ rust-analyzer
Merge commit '368e0bb32f1178cf162c2ce5f7e10b7ae211eb26'
2023-01-09 10:36:22 -08:00
feniljain
794988c53b feat: filter already present enum variants in match arms 2022-12-17 19:21:21 +05:30
feniljain
68fd1ce313 feat: bump variant suggestion for enums in patterns completion 2022-12-17 19:21:21 +05:30
bors
15ff8a5a9f Auto merge of #13715 - feniljain:fix_completions, r=jonas-schievink
fix: breaking snippets on typed incomplete suggestions

Possible fix for #7929

Fix the case where if a user types `&&42.o`, snippet completion was still applying &&Ok(42). Note this was fixed previously on `&&42.` but this still remained a problem for this case

Previous relevant PR: #13517

### Points to help in review:

- The main problem why everything broke on adding an extra `o` was, earlier `dot_receiver` was `42.` which was a `LITERAL` but now `42.o` becomes a `FIELD_EXPR`

- Till now `include_references` was just checking for parent of `LITERAL` and if it was a `REF_EXPR`, but now we consider `FIELD_EXPR` and traverse all of them, finally to reach `REF_EXPR`. If `REF_EXPR` is not found we  just return the original `initial_element`

- We are constructing a new node during `include_references` because if we rely on `dot_receiver` solely we would get `&&42.o` to be replaced with, but we want `&&42` to be replaced with

### Output Video:

https://user-images.githubusercontent.com/49019259/205420166-efbdef78-5b3a-4aef-ab4b-d892dac056a0.mov

Hope everything I wrote makes sense 😅

Also interestingly previous PR's number was `13517` and this PR's number is `13715`, nicee
2022-12-12 14:37:45 +00:00