Commit Graph

2362 Commits

Author SHA1 Message Date
Lukas Wirth
e1c67485bf fix: Differentiate between vfs config load and file changed events 2024-01-09 10:30:16 +01:00
Laurențiu Nicola
4413aeb9e8 Temporarily disable resolve_proc_macro test 2024-01-09 10:27:36 +02:00
Laurențiu Nicola
f52f2f9c3c Merge branch 'master' into sync-from-rust 2024-01-09 08:46:16 +02:00
Lukas Wirth
1c40ac79c8 VFS no longer stores all source files in memory 2024-01-08 12:51:16 +01:00
Laurențiu Nicola
3afeb24198 Merge commit 'af40101841c45aa75b56f4e9ca745369da8fb4ba' into sync-from-ra 2024-01-08 11:29:25 +02:00
riverbl
3c378b9c70 Add inlay hint for exclusive ranges
Adds an inlay hint containing a '<' character to exclusive range expressions and patterns that specify an upper bound.
2024-01-07 09:33:56 +00:00
Lukas Wirth
2666349392 Remove limit from symbol_index::Query 2024-01-04 19:20:10 +01:00
Lukas Wirth
d480525ce8 Add extern crate rustc_driver to proc-macro-srv-cli 2024-01-04 11:02:23 +01:00
Nicolas Guichard
73d9c77f2a scip: Populate SymbolInformation::kind
SymbolInformation::kind is finer-grained than the SCIP symbol suffix.
This also fixes a bug where all type aliases where treated like type
parameters.

```
trait SomeTrait {
  type AssociatedType; // ← this is SomeTrait#[AssociatedType]
}

type MyTypeAlias = u8; // ← this used to be [MyTypeAlias]
                       //   and now is MyTypeAlias#
```
2024-01-03 13:05:36 +01:00
Nicolas Guichard
566bb77f91 scip: Populate SymbolInformation::signature_documentation 2024-01-03 10:56:12 +01:00
Nicolas Guichard
495a55689b scip: Populate SymbolInformation::enclosing_symbol
For local variables, this gets the moniker from the enclosing
definition and stores it into the TokenStaticData.
Then it builds the scip symbol for that moniker when building the
SymbolInformation.
2024-01-03 10:54:57 +01:00
Nicolas Guichard
62663e6d4b scip: Refactor token_to_symbol to moniker_to_symbol
This is meant to implement SymbolInformation::enclosing_symbol, so we
can build the enclosing symbol from the enclosing moniker without
having the full enclosing token's TokenStaticData.
2024-01-03 10:54:57 +01:00
Nicolas Guichard
375f1cca4f scip: Populate SymbolInformation::display_name 2024-01-03 10:54:57 +01:00
Laurențiu Nicola
932d85b529 Merge commit '426d2842c1f0e5cc5e34bb37c7ac3ee0945f9746' into sync-from-ra2 2024-01-03 11:35:07 +02:00
bors
86e559bf3f Auto merge of #16211 - tetsuharuohzeki:update-lint, r=Veykril
Use Cargo's [workspace.lints.*] to config clippy

This change begin to use [`[workspace.lints.*]`](https://doc.rust-lang.org/cargo/reference/workspaces.html#the-lints-table) that is stabilized since [Rust 1.74](https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html).

By this change, we make the configure more readable and simplify `xargo lint` more.
2024-01-02 14:53:22 +00:00
bors
1a0b772a43 Auto merge of #16153 - Veykril:err-msg, r=Veykril
fix: Notify user that linkedProjects is set when failing to discover projects

Fixes https://github.com/rust-lang/rust-analyzer/issues/15171
2024-01-02 14:42:03 +00:00
Lukas Wirth
8136e739f5 fix: Notify user that linkedProjects is set when failing to discover projects 2024-01-02 15:24:21 +01:00
bors
9f46ff501d Auto merge of #16062 - davidbarsky:david/fix-references-to-removed-settings, r=Veykril
fix: Correct references from `rust-analyzer.cargo.check` to `rust-analyzer.check`

When reading the manual, I noticed that the documentation referenced configurations that have since been renamed. This PR updates those references to their new names.
2024-01-02 09:57:48 +00:00
bors
f1de7d7273 Auto merge of #16011 - ClSlaid:feat/settings/proc-macro/rebuild-on-save, r=Veykril
feat: add proc-macro rebuild on save option

Related: #15033

I need some advice on how to test it.
2024-01-02 09:46:21 +00:00
Lukas Wirth
c99089c2b3
Update crates/rust-analyzer/src/handlers/notification.rs 2024-01-02 10:27:41 +01:00
Lukas Wirth
3c8dd9e89e Expose whether a channel has been dropped in lsp-server errors 2024-01-01 14:10:46 +01:00
Martin Huschenbett
b9933fdaaa minor: Simplify implementation of apply_document_changes
While reading through the code base, I stumbled across a piece of code that I found hard to read despite its simple purpose. This is my attempt at making the code easier to understand for future readers.

I won't be offended if this is too minor and not worth your time.
2023-12-30 19:21:35 +01:00
Tetsuharu Ohzeki
efc87092b3 Use Cargo's [workspace.lints.*] to config clippy 2023-12-29 23:51:32 +09:00
Lukas Wirth
2a5b60b186 internal: Update world symbols request definiton, prefer focus range for macros 2023-12-22 11:42:08 +01:00
Lukas Wirth
2e52aa1615 Clean up 2023-12-21 17:24:00 +01:00
Lukas Wirth
7b804552a5 Remove Delimiter::DUMMY_INVISIBLE 2023-12-20 14:00:14 +01:00
Lukas Wirth
f49a2fed3f internal: Move out WithFixture into dev-dep only crate 2023-12-18 15:24:08 +01:00
Lukas Wirth
35620306a6 internal: Move proc-macro knowledge out of base-db 2023-12-18 12:37:18 +01:00
Laurențiu Nicola
e37cf75791 Merge commit '21b06c1beb9bb59369ffd652f5d617bcf6952e05' into sync-from-ra 2023-12-18 09:21:55 +02:00
Lukas Wirth
4c45d23948 fix: Syntax fixup now removes subtrees with fake spans 2023-12-15 13:52:49 +01:00
hkalbasi
7b9595a5ab Run rust-analyzer on rustc tests in metrics 2023-12-15 02:10:25 +03:30
Lukas Wirth
7cc6b0f2e9 Partially revert #16101 2023-12-12 22:53:40 +01:00
Lukas Wirth
ca995d765d fix: Fix import_map::search_dependencies getting confused by assoc and non assoc items with the same name 2023-12-12 15:45:42 +01:00
Kirill Bulatov
8ae42b55e7 Search for parent blocks and items when resolving inlay hints 2023-12-11 15:16:55 +02:00
Kirill Bulatov
be6d34b810 Query for nearest parent block around the hint to resolve
This way, parameter hints will be found for resolution
2023-12-11 14:53:51 +02:00
Laurențiu Nicola
f532576ac5 Merge commit '457b966b171b09a7e57acb710fbca29a4b3526f0' into sync-from-ra 2023-12-11 11:16:01 +02:00
Lukas Wirth
cf083fefc4 fix: Fix completion failing in format_args! with invalid template 2023-12-08 20:35:33 +01:00
David Barsky
f556c79db8 fix: Correct references from rust-analyzer.cargo.check to rust-analyzer.check 2023-12-08 14:26:58 -05:00
蔡略
ad27b6e053 patch: only rerun build scripts when saved.
Signed-off-by: 蔡略 <cailue@bupt.edu.cn>
2023-12-08 11:31:56 +08:00
Lukas Wirth
5544f4fa3d Bump and unlock some dependencies 2023-12-07 11:48:58 +01:00
David Barsky
c17dcc8d90 internal: switch to Arc::from_iter 2023-12-06 13:08:45 -05:00
Lukas Wirth
ba01ff4f88 Fix diagnostics panicking when resolving to different files due to macros 2023-12-06 14:39:26 +01:00
Lukas Wirth
9cb13b6efb Allow navigation targets to be duplicated when the focus range lies in the macro definition site 2023-12-06 12:38:19 +01:00
Igor Matuszewski
a7224c998d Don't explicitly warn against semicolon_in_expressions_from_macros
This has been warn-by-default for two years now and has already been
added to the future-incompat lints in 1.68.
2023-12-05 11:35:09 +01:00
bors
e91fdf7860 Auto merge of #15959 - Veykril:macro-shower3, r=lnicola
TokenMap -> SpanMap rewrite

Opening early so I can have an overview over the full diff more easily, still very unfinished and lots of work to be done.

The gist of what this PR does is move away from assigning IDs to tokens in arguments and expansions and instead gives the subtrees the text ranges they are sourced from (made relative to some item for incrementality). This means we now only have a single map per expension, opposed to map for expansion and arguments.

A few of the things that are not done yet (in arbitrary order):
- [x] generally clean up the current mess
- [x] proc-macros, have been completely ignored so far
- [x] syntax fixups, has been commented out for the time being needs to be rewritten on top of some marker SyntaxContextId
- [x] macro invocation syntax contexts are not properly passed around yet, so $crate hygiene does not work in all cases (but most)
  - [x] builtin macros do not set spans properly, $crate basically does not work with them rn (which we use)
~~- [ ] remove all uses of dummy spans (or if that does not work, change the dummy entries for dummy spans so that tests will not silently pass due to havin a file id for the dummy file)~~
  - [x] de-queryfy `macro_expand`, the sole caller of it is `parse_macro_expansion`, and both of these are lru-cached with the same limit so having it be a query is pointless
- [x] docs and more docs
- [x] fix eager macro spans and other stuff
  - [x] simplify include! handling
- [x] Figure out how to undo the sudden `()` expression wrapping in expansions / alternatively prioritize getting invisible delimiters working again
- [x] Simplify InFile stuff and HirFIleId extensions
~~- [ ] span crate containing all the file ids, span stuff, ast ids. Then remove the dependency injection generics from tt and mbe~~

Fixes https://github.com/rust-lang/rust-analyzer/issues/10300
Fixes https://github.com/rust-lang/rust-analyzer/issues/15685
2023-12-04 19:59:53 +00:00
ClSlaid
b21d68cd2a
feat: add proc-macro rebuild on save option
Signed-off-by: ClSlaid <cailue@bupt.edu.cn>
2023-12-04 21:08:29 +08:00
Laurențiu Nicola
30fc9329d1 Merge commit 'e402c494b7c7d94a37c6d789a216187aaf9ccd3e' into sync-from-ra 2023-12-04 09:19:15 +02:00
Lukas Wirth
5edf7bddc6 Fix mod item in included file resolving incorrectly 2023-12-02 13:49:09 +01:00
hkalbasi
4d55cac466 Initial support for implicit drop inlay hint 2023-12-01 16:16:46 +03:30
Lukas Wirth
b98597f06d Re-enable proc-macros 2023-11-28 16:28:56 +01:00