bors[bot]
0646d5cf9e
Merge #10413
...
10413: fix: Fix format highlighting with `concat!` and `unreachable!` r=jonas-schievink a=jonas-schievink
Last item in https://github.com/rust-analyzer/rust-analyzer/issues/10394 , closes https://github.com/rust-analyzer/rust-analyzer/issues/10394
Also documents why/how `is_format_string` even works, since I found that nontrivial.
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-10-01 11:31:32 +00:00
Jonas Schievink
3bc0d89ade
Fix format highlighting with concat!
2021-10-01 13:28:05 +02:00
bors[bot]
47c079a037
Merge #10403
...
10403: feat: Add semantic token modifier for crate root r=Veykril a=lhvy
Resolves #9073
I managed to implement crate root highlighting for crates mentioned specifically by name (e.g. `serde` in `use serde::Serialize;`), but not for crates referred to with `crate` or `super`. How could I implement this?
> P.S. I'm participating in [Hacktoberfest 2021](https://hacktoberfest.digitalocean.com/ ). If this PR is up to standard and merged, I'd appreciate if the `hacktoberfest-accepted` label could be added. Thanks!
Co-authored-by: lhvy <me@lhvy.dev>
2021-10-01 11:18:52 +00:00
lhvy
dbb02370a4
Add semantic token modifier for crate root
2021-10-01 20:52:13 +10:00
Jonas Schievink
cca6ee5757
Expand asm!
to format_args!
2021-10-01 12:33:18 +02:00
Lukas Wirth
c5ceaefa09
Restructure syntax element highlighting
2021-09-30 21:44:56 +02:00
bors[bot]
529b7a4167
Merge #10398
...
10398: Give defaultLibrary semantic token modifier to items from standard library r=Veykril a=lhvy
Fixes #8999 , fixes #2155
`builtInCrates` could be an alternate name to `defaultLibrary`, which one is better?
> P.S. I'm participating in [Hacktoberfest 2021](https://hacktoberfest.digitalocean.com/ ). If this PR is up to standard and merged, I'd appreciate if the `hacktoberfest-accepted` label could be added. Thanks!
Co-authored-by: lhvy <me@lhvy.dev>
Co-authored-by: Lucas <me@lhvy.dev>
2021-09-30 16:10:23 +00:00
lhvy
0b2ba8be68
Fix builtin_crates return type change
2021-10-01 02:05:00 +10:00
Jonas Schievink
4465685878
Work around tidy check
2021-09-30 17:32:18 +02:00
lhvy
2b3baa8503
Give defaultLibrary semantic token modifier to items from standard library
2021-10-01 01:19:24 +10:00
Jonas Schievink
b994469a13
Add const_format_args!
builtin macro, fix highlighting
2021-09-30 17:16:39 +02:00
Jonas Schievink
b8437f71b6
Less hacky assert!
expansion
2021-09-30 16:30:26 +02:00
Jonas Schievink
368c5f6023
Fix format string highlighting in panic!
2021-09-30 15:53:47 +02:00
Lukas Wirth
ba84b91e78
Add a mirror function-like proc-macro expander for tests
2021-09-21 14:55:54 +02:00
Lukas Wirth
33cdc21832
Don't highlight unsafe traits as unsafe in safe impls
2021-09-15 15:46:45 +02:00
Lukas Wirth
0f4463e45e
fix source_to_def trying to use attribute macro calls as containers
2021-09-14 14:42:14 +02:00
Lukas Wirth
538ac599d2
Add some more attribute ide tests
2021-09-14 03:57:29 +02:00
Aleksey Kladov
6df00f8495
internal: make naming consistent
2021-08-14 17:01:28 +03:00
Jake Heinz
4fba518b02
[semantic-highlighting] functions that consume are marked as HlMod::Consuming
2021-08-10 07:31:30 +00:00
Lukas Wirth
f55441f7ed
Document reference highlighting mod
2021-08-04 19:00:52 +02:00
bors[bot]
1b02cafa43
Merge #9734
...
9734: semantic highlighting: add reference hlmod r=matklad a=jhgg
This PR adds the "reference" highlight modifier!
I basically went around and looked for `HlMod::Mutable` to find the callsites to add a reference. I think these all make sense!
Co-authored-by: Jake Heinz <jh@discordapp.com>
Co-authored-by: Jake <jh@discordapp.com>
2021-08-04 09:37:30 +00:00
Jake Heinz
19b1d505db
match style
2021-08-04 06:14:58 +00:00
Jake Heinz
44726b6ca3
fix + update expects
2021-08-04 06:12:41 +00:00
Jake
e01ff775ae
Apply suggestions from code review
...
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-03 23:07:46 -07:00
Jake
28b6a30752
Update crates/ide/src/syntax_highlighting/highlight.rs
...
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-03 09:54:27 -07:00
Lukas Wirth
b96f1adf5c
Give TypeInfo fields and methods more appropriate names
2021-08-03 17:28:51 +02:00
Lukas Wirth
8afa2722b2
Revise TypeInfo::ty usage
2021-08-03 17:24:43 +02:00
Lukas Wirth
25ff7171c4
Introduce TypeInfo
2021-08-03 16:41:53 +02:00
Lukas Wirth
62ab73767f
resolve_doc_path is able to resolve to macros
2021-08-02 14:33:09 +02:00
Jake Heinz
0eb1afdcb7
update expects
2021-07-31 06:08:05 +00:00
Jake Heinz
0f434b8620
move to else f
2021-07-31 04:50:19 +00:00
Jake Heinz
2baef17bb1
semantic highlighting: add reference hlmod
2021-07-31 04:42:47 +00:00
Lukas Wirth
3fab50019c
Simplify
2021-07-26 20:26:24 +02:00
Lukas Wirth
bfe0fa009e
Resolve derive attribute input macro paths in ide layer
2021-07-24 20:35:43 +02:00
Lukas Wirth
e8f1abf5f7
Correctly generate link fragments for associated items
2021-07-20 16:01:27 +02:00
Lukas Wirth
d1256a3709
Assign mutable semantic token modifier to assignment operators
2021-07-13 18:32:02 +02:00
Lukas Wirth
b3337c26db
Split main highlighting function up into a few subfunctions
2021-07-13 18:29:57 +02:00
Lukas Wirth
c65bb7f8b9
Explicitly check for reference locals or fields in Name classification
2021-07-11 15:04:40 +02:00
Aleksey Kladov
bbb053532e
internal: remove one more needless extern crate
2021-07-11 15:48:49 +03:00
Aleksey Kladov
f42648e305
internal: remove needless distinction between a carte and its root mod
2021-07-11 14:55:24 +03:00
Lukas Wirth
9a1b9b3c78
Resolve attribute paths in attribute highlighting
2021-06-28 21:53:17 +02:00
Aramis Razzaghipour
3e7472f76c
Add public
semantic token modifier for public items
2021-06-23 09:40:04 +10:00
Lukas Wirth
29054e02fb
Highlight unsafe trait refs as unsafe only in impl blocks and definitions
2021-06-15 21:49:59 +02:00
Maan2003
5ac6804bb3
cargo fmt
2021-06-13 09:48:15 +05:30
Maan2003
c50b4579ec
clippy::useless_return
2021-06-13 09:35:29 +05:30
Maan2003
c9b4ac5be4
clippy::redudant_borrow
2021-06-13 09:24:16 +05:30
Lukas Wirth
e09723f0af
Highlight tuple field accesses correctly
2021-06-11 21:19:19 +02:00
Lukas Wirth
3c40b15d62
Don't descend MacroCall TokenTree delimiters
2021-06-09 15:02:11 +02:00
bors[bot]
5a1fd05760
Merge #9003
...
9003: minor: Document semantic token modifiers r=Veykril a=Veykril
Part of #6457
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-05-26 12:08:56 +00:00
Lukas Wirth
887dd2d5bb
Document semantic token modifiers
2021-05-26 13:37:54 +02:00
Aramis Razzaghipour
8960a08951
Fix bug where library functions were not highlighted as such
2021-05-26 09:26:13 +10:00
Aramis Razzaghipour
d75277b66b
Refactor application of library
semantic token modifier
2021-05-25 12:20:12 +10:00
Aramis Razzaghipour
eca4b764e4
Remove superfluous early-returns
2021-05-24 14:54:48 +10:00
Aramis Razzaghipour
e51188cd09
Rename ‘foreign’ semantic token modifier to ‘library’
2021-05-24 14:54:48 +10:00
Aramis Razzaghipour
fa0d0bfb7f
Add testing of foreign item highlighting
2021-05-24 14:54:16 +10:00
Aramis Razzaghipour
b4cddc0705
Highlight foreign modules as such
2021-05-24 14:54:16 +10:00
Aramis Razzaghipour
c32428571c
Remove hir krate methods
2021-05-24 14:54:16 +10:00
Aramis Razzaghipour
4fd5248749
Add highlighting of items from other crates
2021-05-24 14:53:48 +10:00
Aramis Razzaghipour
4d4dbcfead
Give ‘unsafe’ semantic token modifier to unsafe traits
2021-05-23 21:45:10 +10:00
bors[bot]
ef6df1d994
Merge #8853
...
8853: Tag Self in impls as a TypeAlias r=matklad a=Veykril
bors r+
Fixes #4398
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-05-16 17:35:40 +00:00
Lukas Wirth
90230e882d
Tag Self in impls as a TypeAlias
2021-05-16 15:12:58 +02:00
bors[bot]
a57bd59f35
Merge #8813
...
8813: Get some more array lengths! r=lf- a=lf-
This is built on #8799 and thus contains its changes. I'll rebase it onto master when that one gets merged. It adds support for r-a understanding the length of:
* `let a: [u8; 2] = ...`
* `let a = b"aaa"`
* `let a = [0u8; 4]`
I have added support for getting the values of byte strings, which was not previously there. I am least confident in the correctness of this part and it probably needs some more tests, as we currently have only one test that exercised that part (!).
Fixes #2922 .
Co-authored-by: Jade <software@lfcode.ca>
2021-05-16 01:53:12 +00:00
Lukas Wirth
4b5b54279a
Attach comments to ast::Impl
2021-05-15 17:32:28 +02:00
hi-rustin
765ccf2eca
Address comments
2021-05-14 17:47:16 +08:00
hi-rustin
b98c119ba6
Apply async semantic token modifier to async/await keywords
...
Only async semantic token modifier
2021-05-14 10:47:00 +08:00
Jade
73023c0299
Support length for ByteStrings
...
I am not confident that my added byte string parsing is right.
2021-05-12 21:22:46 -07:00
Lukas Tobias Wirth
5a78d96d0e
Fix block comment intra doc link injection ranges
2021-05-04 13:51:57 +02:00
Bastian Kersting
421cf9a1bd
Fixed formatting
2021-04-26 11:37:28 +02:00
Bastian Kersting
336b81abd7
Added mutable semantic token modifier for &mut self methods
2021-04-26 09:24:18 +02:00
Lukas Wirth
1e88f5ec8e
Simplify highlight token match guards
2021-04-23 17:27:18 +02:00
Lukas Wirth
ef6f596b4b
Sort HlMod variants and ALL const
2021-04-23 17:24:58 +02:00
Lukas Wirth
c005ce60a0
Tag yield
and await
as ControlFlow in semantic highlighting
2021-04-23 17:24:45 +02:00
Adrian Stanciu
1c75d8975c
Fix typo: comparision -> comparison
2021-04-19 18:44:38 +03:00
Lukas Wirth
2f62c0117a
Check for rust doc code attributes like rustdoc does
2021-04-19 13:32:52 +02:00
Lukas Wirth
8a959497b1
Don't require all doc fences to be valid for identifying rust code
2021-04-19 11:41:45 +02:00
Chayim Refael Friedman
6c287e1504
Accept E<error_number>
notation in doctests
...
```compile_fail,E0000
```
The code was stolen from rustdoc at 392ba2ba1a/src/librustdoc/html/markdown.rs (L866-L867)
2021-04-18 06:15:40 +03:00
bors[bot]
03e0bf7f55
Merge #8354
...
8354: Distinguishing between different operators in semantic highlighting r=matklad a=chetankhilosiya
Co-authored-by: Chetan Khilosiya <chetan.khilosiya@gmail.com>
2021-04-13 11:46:23 +00:00
Aleksey Kladov
327323ad25
internal: fix flakiness of accidentally quadratic test
2021-04-13 12:56:24 +03:00
Jakub Kądziołka
2f60cec3ac
Fix typo: liner -> linear
...
🙈
2021-04-12 20:20:25 +02:00
Aleksey Kladov
e012efca27
Let's try testing for "is not quadratic" condition
2021-04-10 12:43:07 +03:00
Chetan Khilosiya
4a9dd149aa
8024: Added the trait modifier for assoc types.
2021-04-09 01:00:35 +05:30
Chetan Khilosiya
b232549653
8279: Fix the not operator use and test case fix.
2021-04-08 22:58:26 +05:30
Chetan Khilosiya
1735b3ef6a
8279: Added initial implementation for
...
Operator semantic highlighting.
2021-04-08 22:58:26 +05:30
bors[bot]
c2be91dcd8
Merge #8245
...
8245: Properly resolve intra doc links in hover and goto_definition r=matklad a=Veykril
Unfortunately involves a bit of weird workarounds due to pulldown_cmark's incorrect lifetimes on `BrokenLinkCallback`... I should probably open an issue there asking for the fixes to be pushed to a release since they already exist in the repo for quite some time it seems.
Fixes #8258 , Fixes #8238
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-04-05 12:30:20 +00:00
Chetan Khilosiya
518c9c7548
Revert "8024: Added test case for highlighting trait items."
...
This reverts commit d7dcd41801
.
2021-03-31 01:46:01 +05:30
Chetan Khilosiya
d0fcd5c5e0
8024: Fix for function name change.
2021-03-31 00:47:37 +05:30
Chetan Khilosiya
d7dcd41801
8024: Added test case for highlighting trait items.
2021-03-31 00:31:15 +05:30
Chetan Khilosiya
56f624532a
8024: Updated the implementation for trait modifier.
...
Fixed the test cases.
2021-03-31 00:31:15 +05:30
Chetan Khilosiya
f269fe7156
8024: Added the trait modifier for methods
...
method in impls and method calls will have trait modifier.
2021-03-31 00:31:15 +05:30
Lukas Wirth
bb56b7a75c
Use new new docs string source mapping in goto_def and hover
2021-03-30 18:27:16 +02:00
Lukas Wirth
9a327311e4
Implement basic Documentation source to syntax range mapping
2021-03-30 17:20:43 +02:00
Lukas Wirth
6b8358d4d9
Remove code duplication in highlight injection
2021-03-29 20:11:28 +02:00
Edwin Cheng
4520002b63
Unleash macro 2.0 in hightlight and more
2021-03-27 14:42:49 +08:00
cynecx
5ff3299dd6
syntax: return owned string instead of leaking string
2021-03-26 18:30:59 +01:00
Lukas Wirth
8b0d0bd9c7
Show item info when hovering intra doc links
2021-03-23 19:57:04 +01:00
Lukas Wirth
38048c35d8
Don't use an untyped String for ActiveParam tracking
2021-03-20 23:22:09 +01:00
Jonas Schievink
636de3c709
Add AttrsWithOwner
and clean up source_map
2021-03-19 21:23:57 +01:00
Jonas Schievink
fc5f73de45
Move AttrsOwnerNode
to syntax and make it public
2021-03-19 20:05:17 +01:00
bors[bot]
7200b994c9
Merge #8097
...
8097: Parse extended_key_value_attributes r=jonas-schievink a=Veykril
Companion PR https://github.com/rust-analyzer/ungrammar/pull/31
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-19 11:38:40 +00:00
Lukas Wirth
4771a56791
Parse extended_key_value_attributes
2021-03-19 02:13:46 +01:00
Lukas Wirth
8c0f454d11
Use a highlight modifier for intra doc links
2021-03-18 22:32:07 +01:00
Lukas Wirth
d41a1690d2
Track source file IDs in source mapping of Attrs
2021-03-18 13:16:27 +01:00
Lukas Wirth
9763f0a6bd
Semantic highlight intradoclinks in documentation
2021-03-17 21:00:01 +01:00
Lukas Wirth
37964f9fef
Inject highlight into block doc comments
2021-03-17 19:12:28 +01:00
bors[bot]
0fbfab3b45
Merge #8059
...
8059: Move doc-comment highlight injection from AST to HIR r=matklad,jonas-schievink a=Veykril
Fixes #5016
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-17 11:13:54 +00:00
Lukas Wirth
cdfb5c353f
Remove quadratic attr source lookup
2021-03-17 11:22:40 +01:00
Matthias Krüger
048dad8c2e
don't clone types that are copy (clippy::clone_on_copy)
2021-03-17 01:56:31 +01:00
Lukas Wirth
c766492d26
Properly handle doc attributes in doc-comment highlight injection
2021-03-16 21:15:26 +01:00
Lukas Wirth
acc6458390
Replace trait object boxing with extra AttrsOwnerNode
2021-03-16 19:06:58 +01:00
Lukas Wirth
11e9bc60a2
Move doc-comment highlight injection from AST to HIR
2021-03-16 18:57:47 +01:00
Aleksey Kladov
f5a81ec468
Upgrade rowan
...
Notably, new rowan comes with support for mutable syntax trees.
2021-03-16 16:10:49 +03:00
Lukas Wirth
814d617d34
Show whether a binding is mutable or not on hover
2021-03-09 17:18:50 +01:00
Aleksey Kladov
61f15b72ac
Add parsing benchmark
2021-02-09 21:52:34 +03:00
Aleksey Kladov
4b1279d0b1
Infra for "unit" benchmarking
2021-02-09 20:25:39 +03:00
Lukas Wirth
426ad8e165
Classify function calls as functions when shadowed by types
2021-01-28 19:08:55 +01:00
bors[bot]
0c37b3a0fc
Merge #7353
...
7353: Add LifetimeParam and ConstParam to CompletionItemKind r=matklad a=Veykril
Adds `LifetimeParam` and `ConstParam` to `CompletionItemKind` and maps them both to `TypeParam` in the protocol conversion as there are no equivalents, so nothing really changes there.
`ConstParam` could be mapped to `Const` I guess but I'm split on whether that would be better?
Additions were solely inspired by (the single) test output for const params.
Also sorts the variants of `CompletionItemKind` and its to_proto match.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-01-22 15:31:47 +00:00
Lukas Wirth
563a175fdb
Move SymbolKind to ide_db
2021-01-20 15:25:34 +01:00
Aleksey Kladov
46b4f89c92
.
2021-01-20 01:56:11 +03:00
Lukas Wirth
98718e0544
Wrap remaining self/super/crate in Name{Ref}
2021-01-15 22:18:43 +01:00
Lukas Wirth
cb863390f2
Handle self/super/crate in PathSegment as NameRef
2021-01-15 19:21:23 +01:00
Aleksey Kladov
3d78f502bd
Use upstream TextSize API
2021-01-13 21:32:24 +03: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
Aleksey Kladov
083986030e
Replace state with function
2021-01-10 11:57:17 +03:00
Aleksey Kladov
eeceff3179
Refactor highlighting
2021-01-09 23:07:32 +03:00
Aleksey Kladov
92dac67d0c
Simplify
2021-01-09 17:31:22 +03:00
Aleksey Kladov
4a8d2c098d
Better highlight for fixtures
2021-01-09 16:07:41 +03:00
Aleksey Kladov
62b17bac92
Simplify
2021-01-09 15:54:38 +03:00
Aleksey Kladov
d4fb7476ef
Better names
2021-01-09 15:38:32 +03:00
Aleksey Kladov
8a0bd50036
Reduce duplication
2021-01-09 15:12:21 +03:00
Aleksey Kladov
3dfa2768ac
Shorten names
2021-01-09 14:48:15 +03:00
Aleksey Kladov
64a6ee4535
Shorten frequent names
2021-01-09 14:44:01 +03:00
Aleksey Kladov
6fb52af521
Rename dummy -> none
2021-01-09 14:41:31 +03:00
Aleksey Kladov
e30c1c3fbf
Simplify highlighting infra
...
This also fixes the killer whale bug
2021-01-08 23:47:35 +03:00
Aleksey Kladov
f459375f48
Better fixture highlight
2021-01-07 19:11:27 +03:00
Mara Bos
273d2f9123
Formatting.
2021-01-01 17:31:32 +01:00
Mara Bos
4833972067
Add support for Rust 2021.
2021-01-01 17:22:23 +01:00
Lukas Wirth
18bf2e5af5
Add ConstParams to the ide layer
2021-01-01 14:43:16 +01:00
Lukas Wirth
42e3f97c30
Support labels in reference search
2020-12-24 15:40:18 +01:00
Aleksey Kladov
9f6d76da77
Make sure that HighlightModifier::ALL is synchronized with enum
2020-12-19 18:47:36 +03:00
Aleksey Kladov
113688cef0
Clarify the meaning of no-op highlight tag
2020-12-19 17:16:05 +03:00
Aleksey Kladov
a13947abe6
Use more Rustic highlighting specifiers
...
*Method* works for OO languages, but in rust we can also have
associated constants & types, so let's move this to a modifier.
2020-12-19 17:10:47 +03:00
Aleksey Kladov
c45221907a
Deduplicate highlight tags and symbol kinds
...
Curiously, LSP uses different enums for those, and unsurprising and
annoyingly, there are things which exist in one but not in the other.
Let's not repeat the mistake and unify the two things
2020-12-18 23:04:26 +03:00
Jonas Schievink
b238ddd21a
Make macro def krate mandatory
...
Refactors builtin derive support to go through proper name resolution
2020-12-15 20:33:05 +01:00