Commit Graph

236 Commits

Author SHA1 Message Date
Paolo Tranquilli
b4af5a61d1 Rust: more advanced toString 2024-11-20 16:21:23 +01:00
Paolo Tranquilli
99494dd540 Merge pull request #18012 from github/revert-18011-revert-17937-redsun82/rust-cargo-options
Revert "Revert "Rust: allow to specify more cargo configuration options""
2024-11-19 09:03:52 +01:00
Paolo Tranquilli
8377ee545f Rust: fix reading lists from options.yml 2024-11-18 17:22:23 +01:00
Paolo Tranquilli
abd73e16d4 Revert "Revert "Rust: allow to specify more cargo configuration options"" 2024-11-18 15:52:03 +01:00
Paolo Tranquilli
04072591c4 Revert "Rust: allow to specify more cargo configuration options" 2024-11-18 15:36:06 +01:00
Paolo Tranquilli
fa52d03194 Merge pull request #17937 from github/redsun82/rust-cargo-options
Rust: allow to specify more cargo configuration options
2024-11-18 13:24:39 +01:00
Paolo Tranquilli
8137419d93 Rust: only accept options.yml in QL tests 2024-11-18 10:40:29 +01:00
Paolo Tranquilli
75375be7ac Rust: add optional dependencies to ql tests
Also accept `options.yml` and `options.yaml` files as well for test options,
to get YAML syntax highlighting. In a follow up PR we might make the extension
mandatory.
2024-11-18 09:42:01 +01:00
Paolo Tranquilli
94ba6473dd Merge branch 'main' into redsun82/rust-cargo-options 2024-11-08 17:54:59 +01:00
Paolo Tranquilli
f77f2b7ff0 Rust: turn off the test cfg by default 2024-11-08 17:07:03 +01:00
Paolo Tranquilli
9cea631399 Merge pull request #17931 from github/redsun82/rust-target-dir
Rust: allow to specify the target directory
2024-11-08 13:34:03 +01:00
Paolo Tranquilli
26839f5e15 Merge pull request #17882 from github/redsun82/rust-resolve
Rust: extract some resolved paths
2024-11-08 13:33:41 +01:00
Paolo Tranquilli
be45e3deed Rust: allow to specify more cargo configuration options
This allows to tweak via extractor options some aspects of the cargo
configuration:
* the target architecture
* features (including `*` for all, which we must understand whether to
  set by default)
* cfg overrides

Integration tests will be added in a follow-up commit.
2024-11-08 12:23:16 +01:00
Paolo Tranquilli
083394073a Rust: rename target_dir to cargo_target_dir, add to extraction options
Also removed the now unused `extract_dependencies` one.
2024-11-08 09:53:50 +01:00
Paolo Tranquilli
4f6fda0100 Rust: allow to specify the target directory 2024-11-07 12:45:20 +01:00
Paolo Tranquilli
64d522e447 Rust: address review 2024-11-07 09:39:44 +01:00
Paolo Tranquilli
200715773f Rust: fix no_semantics_reason 2024-11-06 17:19:06 +01:00
Paolo Tranquilli
2987743e44 Rust: exclude uncompiled files from semantics and surface semanticless reason 2024-11-06 15:22:28 +01:00
Paolo Tranquilli
6848a22c65 Rust: fix semantic merge conflict about semantics 2024-11-04 10:04:40 +01:00
Paolo Tranquilli
bde517fcb1 Merge pull request #17849 from github/aibaars/single-semantics
Rust: try to speed things up a bit
2024-11-04 09:24:26 +01:00
Paolo Tranquilli
cee2ed0ec4 Rust: extract some resolved paths 2024-10-31 14:19:15 +01:00
Arthur Baars
0e511d640b Rust: avoid panics
If:
* the text for a file_id is not found (likely non-utf data in file)
* path does not appear in Vfs, in which case we fall back on loading the file from disk with no "semantics" available
2024-10-30 13:18:36 +01:00
Arthur Baars
c87f2c4eb1 Rust: remove unnecessary field 2024-10-28 18:56:20 +01:00
Arthur Baars
b6c26debef Rust: create single Semantics object for each workspace 2024-10-28 13:29:04 +01:00
Arthur Baars
57cdda3405 Rust: no longer reload files into the RootDatabase
Files were reloaded to handle cases were there was no content
for a file_id, causing a panic. Missing contents was caused by
files that did not contain valid UTF-8 data. These are skipped
by rust-analyzer when it is loading data into the RootDatabase.
2024-10-28 13:29:03 +01:00
Paolo Tranquilli
9c95a17882 Rust: add block ids to canonical paths, making them "extended" 2024-10-28 12:41:05 +01:00
Paolo Tranquilli
652e47177f Rust: format 2024-10-25 17:44:16 +02:00
Paolo Tranquilli
9789059e9f Rust: add more thourough canonical path testing 2024-10-25 16:58:05 +02:00
Paolo Tranquilli
194e0daa8c Rust: add canonical_path and crate_origin to Item 2024-10-25 16:58:04 +02:00
Paolo Tranquilli
a760b89895 Rust: small tweaks 2024-10-25 14:13:27 +02:00
Paolo Tranquilli
5230b7b041 Rust: reduce log spam and skip debug diagnostics in the DB 2024-10-25 13:47:13 +02:00
Arthur Baars
9dc5e2fa36 Merge pull request #17791 from github/aibaars/rust-format-templates
Rust: parse formatting templates
2024-10-25 12:42:35 +02:00
Paolo Tranquilli
41d0085918 Rust: address review 2024-10-24 17:54:18 +02:00
Arthur Baars
ca469f6d5c Rust: introduce PathExprBase class 2024-10-24 15:14:07 +02:00
Paolo Tranquilli
3f8d438851 Rust: move qltest to rust code, add options with cargo check 2024-10-24 12:55:23 +02:00
Paolo Tranquilli
248eb7f00c Merge branch 'main' into rust/callable-base 2024-10-15 11:03:11 +02:00
Arthur Baars
b4bb24aa43 Merge remote-tracking branch 'upstream/main' into aibaars/rust-macros 2024-10-11 13:33:50 +02:00
Arthur Baars
6ade2a8054 Rust: address comments 2024-10-11 13:11:12 +02:00
Tom Hvitved
8cc349e85f Rust: Run codegen 2024-10-11 12:01:16 +02:00
Paolo Tranquilli
f3bf347bd6 Merge branch 'main' into redsun82/codegen-annotate 2024-10-11 10:38:02 +02:00
Paolo Tranquilli
c66bd72620 Rust: rename to CallExprBase 2024-10-11 09:52:30 +02:00
Arthur Baars
f97a159163 Rust: clippy fixes 2024-10-10 15:53:16 +02:00
Arthur Baars
88e5ce3cf8 Rust: lower default verbosity to WARN 2024-10-10 15:53:15 +02:00
Arthur Baars
ca27785ace Rust: extract files on a per-project basis
This way we have only one "project" database in-memory at a time. This
should avoid running out of memory when analyzing large mono-repos.
2024-10-10 15:53:14 +02:00
Arthur Baars
db28f1b29e Rust: use macro to inject extraction functions for detached properties 2024-10-10 15:53:13 +02:00
Arthur Baars
8372a2e562 Rust: ensure error and token locations are valid
The locations are "clipped" to the ranges of the parent node of a token,
and the root node of the parse tree for errors.
2024-10-10 15:53:12 +02:00
Arthur Baars
58d2c71c20 Rust: load files from disk ourselves
This avoids problems with files containing invalid utf-8 data, which may cause
panic's like:
```
 thread 'main' panicked at external/rules_rust~~_crate~ql~~r~r__ra_ap_salsa-0.0.232/src/input.rs:91:32:
   no value set for CompressedFileTextQuery(FileId(2429))
   stack backtrace:
      0: rust_begin_unwind
                at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:665:5
      1: core::panicking::panic_fmt
                at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:74:14
      2: <salsa::input::InputStorage<Q> as salsa::plumbing::QueryStorageOps<Q>>::fetch
      3: <DB as ra_ap_base_db::SourceDatabase>::compressed_file_text::__shim
      4: <ra_ap_base_db::FileTextQuery as salsa::plumbing::QueryFunction>::execute
      5: salsa::Cycle::catch
      6: salsa::derived_lru::slot::Slot<Q,MP>::execute
      7: salsa::derived_lru::slot::Slot<Q,MP>::read
      8: <salsa::derived_lru::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
      9: <DB as ra_ap_base_db::SourceDatabase>::file_text::__shim
     10: <DB as ra_ap_base_db::SourceDatabase>::file_text
     11: <ra_ap_base_db::ParseQuery as salsa::plumbing::QueryFunction>::execute
     12: salsa::Cycle::catch
     13: salsa::derived_lru::slot::Slot<Q,MP>::execute
     14: salsa::derived_lru::slot::Slot<Q,MP>::read
     15: <salsa::derived_lru::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
     16: <DB as ra_ap_base_db::SourceDatabase>::parse::__shim
     17: <DB as ra_ap_base_db::SourceDatabase>::parse
     18: ra_ap_hir::semantics::SemanticsImpl::parse
     19: single_arch_extractor::main
```
2024-10-10 15:53:11 +02:00
Arthur Baars
3e877ffaac Rust: do not fail on bad Cargo.toml files 2024-10-10 15:53:08 +02:00
Arthur Baars
ae19b2fd89 Rust: check that TextRanges are for the correct file 2024-10-10 15:53:07 +02:00
Arthur Baars
faa168993c Rust: reduce log output 2024-10-10 15:53:06 +02:00