Lukas Wirth
ef92453dfe
internal: Refactor FamousDefs builtin crate search
2022-03-30 22:23:54 +02:00
Florian Diebold
fa923f9b19
Adjust value in syntax highlighting benchmark
2022-03-23 19:28:01 +01:00
Laurențiu Nicola
1a37b17162
Replace write! with direct calls
2022-03-21 10:43:36 +02:00
Lukas Wirth
ddf144051a
internal: Treat {global_}asm macros as unsafe
2022-03-20 19:31:00 +01:00
Lukas Wirth
68de7b30e0
feat: Tag macro calls as unsafe if they expand to unsafe expressions
2022-03-20 19:07:44 +01:00
Matthias Krüger
5a0078c9d1
more clippy fixes:
...
clippy::search_is_some
clippy::redundant_static_lifetimes
clippy::match_single_binding
clippy::match_ref_pats
clippy::map_entry
clippy::manual_map
clippy::iter_overeager_cloned
clippy::into_iter_on_ref
clippy::extra_unused_lifetimes
2022-03-12 16:50:49 +01:00
Matthias Krüger
1f70886b15
fix clippy::single_char_pattern
2022-03-12 16:50:49 +01:00
yipinliu
0c54921f93
Fixed code style issues
2022-03-12 20:36:56 +08:00
yipinliu
8247925313
Fixed tidy test
2022-03-12 20:04:14 +08:00
yipinliu
581e1bf0d7
Highlight escape sequences in byte strings
2022-03-12 19:03:14 +08:00
bors[bot]
d70ea759b3
Merge #11663
...
11663: Internal: Add hir_def::MacroId, add Macro{Id} to ModuleDef{Id} r=Veykril a=Veykril
With this we can now handle macros like we handle ModuleDefs making them work more like other definitions and allowing us to remove a bunch of special cases. This also enables us to track the modules these macros are defined in, instead of only recording the crate they come from.
Introduces a new class of `MacroId`s (for each of the 3 macro kinds) into `hir_def`. We can't reuse `MacroDefId` as that is defined in `hir_expand` which doesn't know of modules, so now we have two different macro ids, this unfortunately requires some back and forth mapping between the two via database accesses which I hope won't be too expensive.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-09 10:26:34 +00:00
Lukas Wirth
eba90936c1
Move ide crates to new hir::Macro
2022-03-08 23:52:26 +01:00
Luna Razzaghipour
6da1228898
Emit more detailed highlighting for %
, >>
, <<
2022-03-07 20:16:03 +11:00
Lukas Wirth
ab21cf2f4f
internal: Re-arrange ide_db modules
2022-03-06 19:04:04 +01:00
Lukas Wirth
97076c074d
internal: Simplify and optimize syntax_highlighting
2022-03-06 03:49:54 +01:00
Lukas Wirth
e8edbb5d6f
Add a macro case for the keyword highlighting test fixture
2022-03-06 00:26:15 +01:00
Lukas Wirth
d460b7c9d1
Fix extern crate self having self unresolved
2022-03-06 00:17:40 +01:00
Lukas Wirth
e5bb661b7a
Highlight Self
as a keyword by default
2022-03-06 00:13:45 +01:00
Lukas Wirth
5c0aee013e
Fix highlighting of Self
2022-03-05 23:34:37 +01:00
Lukas Wirth
c0d6471143
fix: Recognize Self
as a proper keyword
2022-03-05 23:20:06 +01:00
hkalbasi
4fa8749c44
Preserve order of generic args
2022-03-04 11:46:14 +03:30
Lukas Wirth
464dd814ca
slightly improve highlighting performance for derive annotated items
2022-03-03 22:59:34 +01:00
Lukas Wirth
8ded3ec9cf
fix: Fix semantic highlighting breaking for lifetimes in macros
2022-03-03 22:53:03 +01:00
Lukas Wirth
47ce4436e4
Make hir::Local::name infallible
2022-02-26 16:36:44 +01:00
Lukas Wirth
36603e0478
Rename test highlighting output files
2022-02-26 14:52:42 +01:00
Lukas Wirth
c99fb4b1ac
Split up highlighting tests a bit more
2022-02-26 14:45:09 +01:00
Lukas Wirth
48189bc1b4
Re-order and cleanup highlighting tests
2022-02-26 14:29:03 +01:00
Lukas Wirth
7b89d5ede2
internal: Expand the derive attribute into a pseudo expansion
2022-02-22 10:20:40 +01:00
Lukas Wirth
f6def3ccdf
fix: Fix proc-macro server not using the supplied span in Ident::new
2022-01-31 17:02:57 +01:00
Lukas Wirth
91279db2b4
Move format specifier lexing from syntax to ide_db
2022-01-15 13:14:59 +01:00
Lukas Wirth
82fccb971e
feat: Add very simplistic ident completion for format_args! macro input
2022-01-15 12:23:26 +01:00
Lukas Wirth
b32f611b6e
fix: Fix outline modules spilling inner doc injections into their parent
2022-01-08 14:54:31 +01:00
Lukas Wirth
ca4baa6e55
Use FileAstId<ast::Adt>
in nameres where appropriate instead
2022-01-07 14:20:27 +01:00
bors[bot]
68bc12c3b8
Merge #11157
...
11157: internal: Remove `SemanticScope::speculative_resolve_as_mac` r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11132
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-04 16:49:47 +00:00
Lukas Wirth
19f1ff5c70
give resolve_derive_ident
a more robust api
2022-01-03 16:00:45 +01:00
Lukas Wirth
087122ad1a
fix: Fix highlighting hack for self-params
2022-01-03 01:32:03 +01:00
Lukas Wirth
6b7b09d329
internal: Record unresolved derive invocations in hir
2022-01-02 23:44:23 +01:00
Lukas Wirth
762a3b3030
Fix tool module classification not working correctly
2022-01-02 23:14:18 +01:00
Lukas Wirth
19d894cdec
minor: Cleanup syntax highlighting
2022-01-02 22:23:05 +01:00
Lukas Wirth
22160c418b
fix NameRefClass misclassifying proc-macros
2022-01-02 19:20:10 +01:00
Lukas Wirth
9eed85b171
fix syntactic highlighting for macros
2022-01-02 19:10:23 +01:00
Lukas Wirth
3a525c831f
internal: Handle macro calls better in highlighting
2022-01-02 19:10:10 +01:00
Lukas Wirth
e09d410dcd
Simplify
2021-12-07 15:06:56 +01:00
Lukas Wirth
9b4ca77572
fix: Add highlighting hack back for unresolved attributes
2021-12-05 11:59:07 +01:00
Lukas Wirth
b35a50cb10
fix: Fix self keyword not being tagged as such in highlighting properly
2021-12-04 19:07:18 +01:00
Lukas Wirth
e4f2d0e3a8
Introduce SymbolKind::Derive
2021-12-04 18:18:09 +01:00
Lukas Wirth
642c1eb720
Introduce SymbolKind::Attribute
2021-12-04 18:01:22 +01:00
Lukas Wirth
d174158abc
Rename things: Tool -> ToolModule
2021-12-03 17:15:19 +01:00
Lukas Wirth
db559e5049
Simplify
2021-12-03 17:07:06 +01:00
Lukas Wirth
d1677f3286
Remove syntax highlighting hack for builtin attrs
2021-12-03 16:54:34 +01:00
Lukas Wirth
e58af219a4
feat: Resolve builtin-attr and tools in ide layer
2021-12-03 16:32:17 +01:00
Jake Heinz
30b0464ed8
add a fixme:
2021-12-01 12:26:27 +00:00
Jake Heinz
ba92bb1ed9
simplify
2021-12-01 12:25:08 +00:00
Jake Heinz
d2480ecb9f
ide: hack to make self not unresolved reference in async trait wrapped impl's
2021-12-01 12:17:20 +00:00
Jake Heinz
b357569d0f
add test
2021-12-01 10:28:18 +00:00
Lukas Wirth
f3b25a6fc8
Disable string highlight injection for macros changing string literals
2021-11-23 22:13:10 +01:00
Lukas Wirth
77f08d0fc3
Split parts of ide_db::call_info
off into ide
2021-11-22 13:23:34 +01:00
Lukas Wirth
7776aad166
internal: Flatten Definition::ModuleDef
variant
2021-11-11 00:05:53 +01:00
Lukas Wirth
26419c0379
Fix proc-macro attributes being shadowed by their functions in IDE layer
2021-11-08 14:49:50 +01:00
Lukas Wirth
7fdbdc4ab2
Enable auto-import and qualify-path in derive attributes
2021-10-28 18:40:38 +02:00
Lukas Wirth
3018ffd85e
Refactor ide handling for paths in derive inputs
2021-10-28 16:47:19 +02:00
Milo
35e5daacc3
more clippy fixes
2021-10-16 12:32:55 +01:00
Milo
35de195c41
a few clippy fixes
2021-10-14 19:57:21 +01:00
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