Lukas Wirth
4b577e2bc8
Support c string literals
2023-05-18 11:06:05 +02:00
hkalbasi
a6e5a912f9
Expand format_args!
with more details
2023-05-16 19:12:40 +03:30
Lukas Wirth
8e116855f5
Add macro modifier for highlighting tokens in macro calls
2023-05-13 11:43:39 +02:00
Jake Heinz
157069e232
fix: ide: do not highlight escapes in raw strings
2023-05-02 07:16:25 +00:00
bvanjoi
f0c74b30ed
fix(ide): highlight escapes in char
2023-04-06 23:20:12 +08:00
bors
ea22d245b6
Auto merge of #14499 - DropDemBits:drive-by-fixmes, r=Veykril
...
minor: Fix some simple FIXMEs
Each FIXME fix has been split into its own commit, since they're all pretty independent changes.
(Forgot to open a PR for this a few days ago, oops)
2023-04-05 20:42:55 +00:00
DropDemBits
0a144f7fff
Use bind by-move to get the parent from the match
2023-03-31 17:48:59 -04:00
Lukas Wirth
31db1fc75f
internal: Refine CrateOrigin variants
2023-03-31 10:36:13 +02:00
hkalbasi
eb4939e217
Support overloaded deref MIR lowering
2023-03-17 14:02:55 +03:30
Lukas Wirth
b6e7cf3201
Highlight unresolved derives as being unresolved
2023-03-08 13:51:14 +01:00
Ryo Yoshida
29c957f973
Lower and handle trait aliases in HIR
2023-03-04 00:24:07 +09:00
Lukas Wirth
4f6b5f41d4
Recover better for more delimited sequences
2023-02-14 13:52:15 +01:00
Daniel Eades
cc80c5bd07
remove unnecessary lazy evaluations
2023-01-02 15:02:54 +00:00
Maybe Waffle
346bf5fb5b
Implement do yeet
expression
2022-12-28 23:17:13 +00:00
bors
74ae2dd303
Auto merge of #13840 - lowr:fix/hir-callable-sig-escaping-boundvars, r=lowr
...
fix: handle lifetime variables in `CallableSig` query
Fixes #13838
The problem is similar to #13223 : we've been skipping non-empty binders, letting lifetime bound variables escape.
I ended up refactoring `hir_ty::callable_sig_from_fnonce()`. Like #13223 , I chose to make use of `InferenceTable` which is capable of handling variables (I feel we should always use it when we solve trait-related stuff instead of manually building obligations/queries).
I couldn't make up a test that crashes without this patch (since the function I'm fixing is only used *outside* `hir-ty`, simple `hir-ty` test wouldn't cause crash), but at least I tested with my local build and made sure it doesn't crash with the code in the original issue. I'd appreciate any help to find a regression test.
2022-12-25 14:53:16 +00:00
Ryo Yoshida
a1a408367e
Add regression test
2022-12-25 23:29:33 +09:00
Yuri Astrakhan
e16c76e3c3
Inline all format arguments where possible
...
This makes code more readale and concise,
moving all format arguments like `format!("{}", foo)`
into the more compact `format!("{foo}")` form.
The change was automatically created with, so there are far less change
of an accidental typo.
```
cargo clippy --fix -- -A clippy::all -W clippy::uninlined_format_args
```
2022-12-24 14:36:10 -05:00
Lukas Wirth
027bfd68ba
Fix operator highlighting tags applying too broadly
2022-09-20 14:33:44 +02:00
Jonas Schievink
322e7060de
Resolve doc links on impl blocks
2022-08-23 17:50:45 +02:00
Lukas Wirth
f6f0516603
Add config for macro bang token highlighting, disable by default
2022-08-23 14:05:56 +02:00
Lukas Wirth
9700c95ced
Make doc comment highlight injection configurable
2022-08-23 14:05:55 +02:00
Lukas Wirth
9a201873b8
Move highlight configuration from protocol into the feature
2022-08-23 14:05:55 +02:00
Lukas Wirth
16315edaee
Make punctuation highlighting configurable, disable it by default
2022-08-23 14:05:55 +02:00
Laurențiu Nicola
eca6f2e897
Fix test_rainbow_highlighting gate
2022-08-07 09:29:26 +03:00
Lukas Wirth
618cfd792c
fix: Fix ast-id up when merging raw attributes
2022-07-30 09:43:30 +02:00
Laurențiu Nicola
948c9afc73
Only run rainbow highlighting test on 64-bit Unix
2022-07-28 21:03:59 +03:00
Lukas Wirth
aa1491ecde
Record derive helper attributes, resolve them in IDE layer
2022-07-26 09:26:51 +02:00
Amos Wenger
7e285e1ef5
Run cargo fmt
2022-07-20 15:06:15 +02:00
Amos Wenger
816f7fe12a
Run cargo fix --edition-idioms
2022-07-20 15:02:08 +02:00
bors
22e53f1d33
Auto merge of #12549 - bitgaoshu:goto_where_trait_m_impl, r=Veykril
...
feat: Go to implementation of trait methods
try goto where the trait method implies, #4558
2022-07-18 16:29:23 +00:00
bors
766c5f0861
Auto merge of #12689 - Veykril:macro-rec, r=Veykril
...
internal: Record all macro definitions in ItemScope
Fixes https://github.com/rust-lang/rust-analyzer/issues/12100
Doesn't resolve the shadowing issues though, fixing those is gonna be really tricky I believe unless we can come up with a nice scheme to "order" item tree items (using syntax ranges and file ids would be a pain and also a bad idea since that'll require us to potentially reparse files in collection).
2022-07-16 16:45:26 +00:00
Lukas Wirth
7ff6c36716
fix: Don't show qualified path completions for private items
2022-07-15 13:30:43 +02:00
Lukas Wirth
db49ac8734
internal: Record all macro definitions in ItemScope
2022-07-05 11:28:47 +02:00
bitgaoshu
353829fc4e
highlight: trait path
2022-06-24 23:04:35 +08:00
bitgaoshu
9e6bff79f4
fix some test due to resolve to where trait m impl
2022-06-24 19:15:16 +08:00
Lukas Wirth
76ae5434fa
internal: Bump Dependencies
2022-06-10 17:30:02 +02:00
bvanjoi
f6b8525b1d
feat: escape format specifier( close : #12258 )
2022-05-22 15:32:24 +08:00
Lukas Wirth
88e297e47d
minor: Simplify
2022-05-20 16:52:10 +02:00
Jonas Schievink
9bd11459ba
Revert "Auto merge of #12149 - jonas-schievink:literally-just-a-literal, r=jonas-schievink"
...
This reverts commit cc9ae2b89e
, reversing
changes made to 7dfd1cb572
.
2022-05-13 15:08:14 +02:00
Jonas Schievink
37443eb9a1
Maybe everything else *should* have to deal with it
2022-05-05 16:28:59 +02:00
Jonas Schievink
34dc8e9383
Wrap floats in token trees in FLOAT_LITERAL
node
2022-05-05 16:28:59 +02:00
Jonas Schievink
1bc3305d95
Split float literal tokens at the .
2022-05-05 16:28:58 +02:00
Lukas Wirth
4255996965
Re-export FxHashMap
and FxHashSet
from ide_db
2022-04-25 18:51:59 +02:00
Lukas Wirth
be27efabfa
fix: Tag macro_rules
macro bang with MacroBang
tag
2022-04-15 19:16:18 +02:00
Jonas Schievink
5d8b4c40eb
Determine function unsafety semantically
2022-04-07 18:33:03 +02:00
Lukas Wirth
4a1423337f
fix: Attempt to resolve paths in const arguments heuristically
...
While we don't support const args in type inference yet, we can at least
make use of the fallback path resolution to resolve paths in const args
in the IDE layer to enable some features for them.
2022-04-06 20:24:24 +02:00
Lukas Wirth
7959c24876
fix: Fix path qualifiers not resolving generic type params when shadowed by trait
2022-04-06 19:38:45 +02:00
bors[bot]
50225fe630
Merge #11869
...
11869: fix: code blocks with tilde also works like code block r=Veykril a=moreal
The `rustdoc` uses the `pulldown_cmark` package to parse *doc_comment* and the package also treat triple `~` characters also as code block fences. So when we run `cargo doc`, they will be placed also.
<img width="965" alt="image" src="https://user-images.githubusercontent.com/26626194/161208072-5a09a209-57fc-4a52-b190-b0a9be9ffcd6.png ">
But `rust-analyzer` doesn't support it so it doesn't have any injected code highlights and any `Run doctest` hint. This pull request tries to allow also them. 🙇🏻♂️
Before:
<img width="224" alt="image" src="https://user-images.githubusercontent.com/26626194/161207405-b1d6cfda-82b1-4f60-8e42-c51d0ed98f38.png ">
After:
<img width="161" alt="image" src="https://user-images.githubusercontent.com/26626194/161207693-8e39997c-9ca6-4e69-8c65-e9b70899f7db.png ">
Co-authored-by: Lee Dogeon <dev.moreal@gmail.com>
2022-04-01 12:40:51 +00:00
Lee Dogeon
e3f32d13e1
Code blocks with tilde also works like code block
2022-04-01 20:29:32 +09:00
Lukas Wirth
75689f2ad8
internal: Enforce Resolver to always have a module scope
2022-03-31 11:12:08 +02:00
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