Commit graph

464 commits

Author SHA1 Message Date
Aleksey Kladov
74f8201586 Avoid intermediate collections 2021-01-20 14:49:29 +03:00
Aleksey Kladov
724059569b Don't show runnable suggestions for other files
It't be actually great to have these once we have run anything dialog,
but for run the thing at point it makes sense to show a limited set.
2021-01-20 14:30:50 +03:00
Aleksey Kladov
46b4f89c92 . 2021-01-20 01:56:11 +03:00
bors[bot]
8935106b39
Merge #7321
7321: Support runnables in macros r=matklad a=edwin0cheng

fixes  #4771

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-01-19 09:27:45 +00:00
Edwin Cheng
8b03b58ad7 Support runnables in macros 2021-01-19 16:58:11 +08:00
Lukas Wirth
e31420fbe2 Remove obsolete RangeInfo usage in references 2021-01-18 21:10:01 +01:00
bors[bot]
342bf41022
Merge #7297 #7338
7297: Propose trait associated items and autoimport traits on completion r=matklad a=SomeoneToIgnore

![trait_imports](https://user-images.githubusercontent.com/2690773/104819998-6faeb480-583a-11eb-8b45-b7351b51b90e.gif)

Closes #7248

7338: Parse `impl const Trait` r=Veykril a=Veykril

Closes #7313

bors r+

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-18 19:40:11 +00:00
Lukas Wirth
21a6384ce6 Remove obsolete RangeInfo usage in rename 2021-01-18 20:28:20 +01:00
bors[bot]
39282ec419
Merge #7332
7332: Rename reference search uses ide_db::search directly r=matklad a=Veykril

https://github.com/rust-analyzer/rust-analyzer/pull/7251#discussion_r556644241

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-18 19:00:04 +00:00
Lukas Wirth
6015a66cae Make rename reference search use ide_db::search directly 2021-01-18 18:57:59 +01:00
Lukas Wirth
22b9b9abe7 Add test for reference search on self declaration param 2021-01-18 18:21:40 +01:00
bors[bot]
9daba961f2
Merge #7291
7291: Wrap remaining self/super/crate in Name{Ref} r=matklad a=Veykril

That should be the remaining special casing for `self` 🎉 

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-18 16:13:06 +00:00
Aleksey Kladov
738cf7d495 Minor 2021-01-18 16:09:44 +03:00
bors[bot]
9eb37fbdeb
Merge #7292
7292: Swap assert_eq_text\!(expected, actual) r=matklad a=u5surf

Fixes #7283 

Swap assert_eq_text parameters in the order (expected, actual)

Co-authored-by: yugo-horie <u5.horie@gmail.com>
2021-01-18 10:12:54 +00:00
Kirill Bulatov
db335a1bbf Add flyimport completion for trait assoc items 2021-01-16 20:44:12 +02:00
Kirill Bulatov
6742f38e49 Share import_assets and related entities 2021-01-16 19:33:36 +02:00
yugo-horie
f273995a25 Swap assert_eq_text\!(expected, actual) 2021-01-16 13:30:26 +09:00
Lukas Wirth
98718e0544 Wrap remaining self/super/crate in Name{Ref} 2021-01-15 22:18:43 +01:00
bors[bot]
8a869e870a
Merge #7288
7288: Handle self/super/crate in PathSegment as NameRef r=matklad a=Veykril

Wrapping self/super/crate in NameRef as per https://github.com/rust-analyzer/rust-analyzer/pull/7261#issuecomment-760023172



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-15 18:40:47 +00:00
Lukas Wirth
cb863390f2 Handle self/super/crate in PathSegment as NameRef 2021-01-15 19:21:23 +01:00
Aleksey Kladov
6dbba4d75d Remove useless wrapper 2021-01-15 20:15:33 +03:00
Lukas Wirth
d5095329a1 Phase out SourceFileEdits in favour of a plain HashMap 2021-01-14 22:43:36 +01:00
Lukas Wirth
f51457a643 Group file source edits by FileId 2021-01-14 18:35:22 +01:00
bors[bot]
39167b97d8
Merge #7260
7260: Render Fn* trait objects and impl types as rust does r=matklad a=Veykril

Also fixes raw ptr impl types being rendered ambiguously with multiple predicates.
This moves out the `FamousDefs::Fixture` into its own file as well, cause I figured it is big enough to get its own file at this point + we also get highlighting this way when editing it.

Fixes #3012

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-14 09:07:15 +00:00
Aleksey Kladov
3d78f502bd Use upstream TextSize API 2021-01-13 21:32:24 +03:00
Lukas Wirth
3d6480bc31 Render Fn* trait objects and impl types as rust does 2021-01-13 13:29:47 +01:00
bors[bot]
f84f5cb0ea
Merge #7262
7262: Don't show internal server error on rename r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-13 12:09:26 +00:00
Aleksey Kladov
f0e802f490 Don't show internal server error on rename
Doesn't quite work due to https://github.com/microsoft/vscode-languageserver-node/issues/730

Note that this intentionally removes `impl std::Error for RenameError`
-- we nether want to blindly bubble the rename error.
2021-01-13 15:07:30 +03:00
Lukas Wirth
aff9102afb Rename FileReferences -> UsageSearchResult 2021-01-12 15:56:24 +01:00
Lukas Wirth
2c1777a2e2 Ensure uniqueness of file ids in reference search via hashmap 2021-01-12 15:51:02 +01:00
Lukas Wirth
fbdb32adfc Group references by FileId 2021-01-12 01:03:04 +01:00
bors[bot]
8ad325a806
Merge #7051 #7219 #7245 #7246
7051: Check dbg! macro in tidy_test r=matklad a=edwin0cheng

Same as `check_todo` but for dbg! macro

r? @matklad 

7219: Refactor rename name checking r=matklad a=Veykril

Improves the user facing error messages a bit and prevents renaming to `_` when the name is referenced as this would change source to not compile anymore since `_` is only a pattern, not a proper identifier.

7245: Encourage gifs r=matklad a=matklad

bors r+
🤖

7246: Unfreeze cargo_metadata r=matklad a=kjeremy

It now pulls in a newer version of semver-parser.

This does add a dependency on `cargo-platform` in the interest of correctness.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-01-11 13:37:28 +00:00
Aleksey Kladov
8adf5cc0e3 Goto for inner doc links works for module inner doc comments 2021-01-11 16:24:50 +03:00
Lukas Wirth
f7af0b4b96 Add some more marks to rename tests 2021-01-11 00:28:21 +01:00
Lukas Wirth
2347944aae Use local error macros in references/rename 2021-01-10 21:59:44 +01:00
bors[bot]
607b9ea160
Merge #7218
7218: Fix typos r=Veykril a=regexident

Apart from the very last commit on this PR (which fixes a public type's name) all changes are non-breaking.

Co-authored-by: Vincent Esche <regexident@gmail.com>
2021-01-10 18:16:29 +00:00
bors[bot]
b3ae7974af
Merge #7239
7239: Replace SyntaxKind usage with T! macro where applicable r=lnicola a=Veykril

https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/dev/style.md#token-names

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-10 16:31:32 +00:00
Lukas Wirth
e618d12903 Replace SyntaxKind usage with T! macro where applicable 2021-01-10 17:14:01 +01:00
Laurențiu Nicola
10e7fd25fe Fix typo, parentheses is plural 2021-01-10 17:56:53 +02:00
bors[bot]
77362c7173
Merge #6238
6238: Split punctuation semantic highlighting up into more tags r=matklad a=Veykril

Open question would be the name of the delimiter modifiers. I chose them this was as I see them this way but from what I remember people tend to mix the names however they like. So maybe using `delimSquare`, `delimCurly`, `delimRound` would be better. That would also go well with `angle` becoming `delimAngle`?

Closes #6152

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-10 12:45:07 +00:00
Lukas Wirth
78fe6133c4 Split punctuation semantic highlighting up into more tags 2021-01-10 13:33:03 +01:00
bors[bot]
dcbb77cb6c
Merge #7206 #7231
7206: Use hir::GenericParam in ide_db::Definition instead of relisting all 3 r=Veykril a=Veykril

Basically just this:
```diff
 pub enum Definition {
     Macro(MacroDef),
     Field(Field),
     ModuleDef(ModuleDef),
     SelfType(Impl),
     Local(Local),
-    TypeParam(TypeParam),
-    LifetimeParam(LifetimeParam),
-    ConstParam(ConstParam),
+    GenericParam(GenericParam),
     Label(Label),
 }
```

7231: Cleaner API r=matklad a=matklad

bors r+
🤖

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-10 11:45:59 +00:00
Aleksey Kladov
fc3fc571d2 Cleaner API 2021-01-10 14:36:15 +03:00
Lukas Wirth
b795128dde Use hir::GenericParam in ide_db::Definition instead of relisting all 3 2021-01-10 12:33:47 +01:00
bors[bot]
1ed1c14b2b
Merge #7229
7229: Cleanup r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-01-10 11:24:52 +00:00
Aleksey Kladov
3a6ae42eac Cleanup 2021-01-10 14:24:01 +03:00
bors[bot]
6a0a47dd14
Merge #6980
6980: Implement to support intra-doc link r=matklad a=sasurau4

Helps with #6168 

This PR is very limited implementation to support intra-doc. It only support links indicate same file function.

I want someone to feedback me about this implementation. If the approach is good, I will continue this PR to support other symbols like enum and struct. 

Co-authored-by: Daiki Ihara <sasurau4@gmail.com>
2021-01-10 10:02:10 +00:00
bors[bot]
4fddf40f5b
Merge #7224
7224: Remove unnecessary allocation when checking whether to hide argument name hint r=jhpratt a=jhpratt

The case-insensitive prefix/suffix check can be performed
character-by-character. This allows the check to be done without having
to allocate a new string. As a side effect, it's also no longer
necessary to convert the entire string to lowercase, as it's done as
needed. As the only case equality we're handling is ASCII, this
operation can be further optimized by using byte equality, rather than
character equality.

cc @SomeoneToIgnore, as it's an update on my PR from yesterday.

Co-authored-by: Jacob Pratt <jacob@jhpratt.dev>
2021-01-10 09:34:24 +00:00
Jacob Pratt
5e81892d4d
Skip leading underscores unconditionally 2021-01-10 04:23:32 -05:00
Aleksey Kladov
083986030e Replace state with function 2021-01-10 11:57:17 +03:00