Commit graph

2746 commits

Author SHA1 Message Date
Chayim Refael Friedman
ce323627c5 Support the new CoercePointee derive 2025-01-04 18:35:53 +02:00
dfireBird
83fcdbf3f6
fix no space insert before and after if value is only spaces 2025-01-02 16:28:25 +05:30
Chayim Refael Friedman
bb400ca121 Fix overflow detection in MIR evaluation
With a bit of higher-order macros everything sorts out well.

And also fix a discovered bug when comparing long strings.
2025-01-02 11:51:12 +02:00
Lukas Wirth
7e639ee3dd
Merge pull request #18179 from ChayimFriedman2/omit-trait-completion
feat: Allow excluding specific traits from completion
2025-01-01 14:34:56 +00:00
Lukas Wirth
e5950cd41d
Merge pull request #18809 from Veykril/push-ktwrzsmzlplw
internal: Do not render closure ids in hover messages
2025-01-01 12:55:37 +00:00
Chayim Refael Friedman
7e6ade117c Allow excluding specific traits from completion
To be accurate, only their methods are excluded, the trait themselves are still available.

I also excluded a bunch of std traits by default. Some less opinionated, like `AsRef`, which should never be used directly except in generic scenarios (and won't be excluded there), some more opinionated, like the ops traits, which I know some users sometimes want to use directly. Either way it's configurable.

It should be pretty easy to extend support to excluding only specific methods, but I didn't do that currently.

Traits configured to be excluded are resolved in each completion request from scratch. If this proves too expensive, it is easy enough to cache them in the DB.
2025-01-01 13:49:35 +01:00
Lukas Wirth
a612fc9a16
Merge pull request #18757 from roife/fix-17812
feat: support updating snapshot tests with codelens/hovering/runnables
2025-01-01 12:44:55 +00:00
Lukas Wirth
721e43e9d3 internal: Do not render closure ids in hover messages
They are not useful
2025-01-01 13:41:07 +01:00
Lukas Wirth
add0963033
Merge pull request #18758 from mgsloan/scip-unique-symbols
Improve SCIP symbols
2024-12-31 09:25:30 +00:00
roife
edaf62e7d9 feat: show go-to-type-def actions for subst when hovering 2024-12-31 13:05:29 +08:00
Michael Sloan
37cee9fdaa Remove erroneous omit of inherent impls
Should have been included in 34dc94bb2d
2024-12-30 13:51:41 -07:00
Michael Sloan
03cb63cc75 Make impl HirDisplay for TraitRef provide just the trait type 2024-12-30 13:34:02 -07:00
roife
7b3dffd657 refactor snapshot-tests detection in runnables 2024-12-30 23:56:31 +08:00
dfireBird
92f8fef527
Fix render of literal to be rendered in codeblock 2024-12-30 20:03:10 +05:30
Lukas Wirth
90b724afad
Merge pull request #18785 from Veykril/push-uvsqposqyvmo
Cleanup toolchain info fetching
2024-12-29 12:57:31 +00:00
Lukas Wirth
5ce14b0439 Enforce a current directory being set for spawned commands 2024-12-29 12:51:13 +01:00
Lukas Wirth
bb921fbe94 Show variance of parameters on hover 2024-12-28 20:31:20 +01:00
Michael Sloan
34dc94bb2d Only include SCIP SymbolInformation for first inherent impl 2024-12-27 18:13:14 -07:00
Michael Sloan
f8ea9cace8
Update crates/ide/src/moniker.rs
Co-authored-by: David Barsky <me@davidbarsky.com>
2024-12-27 15:58:32 -07:00
Michael Sloan
eb4543818d
Update crates/ide/src/moniker.rs
Co-authored-by: David Barsky <me@davidbarsky.com>
2024-12-27 15:58:26 -07:00
roife
bba8d2dc02 move env vars for snapshot tests to UpdateTest 2024-12-26 20:19:26 +08:00
roife
1dcce45f48 optimize snapshot-testing macro detection and add tests 2024-12-26 19:51:14 +08:00
roife
edb61b10ab feat: support UpdateTest in codelens 2024-12-26 19:50:32 +08:00
roife
dd788255b4 feat: Add TestDefs to find usage of Expect, Insta and Snapbox 2024-12-26 19:21:06 +08:00
Michael Sloan
17c90f71bf Improve SCIP symbols
In particular, the symbol generation before this change creates a lot
of symbols with the same name for different definitions. This change
makes progress on symbol uniqueness, but does not fix a couple cases
where it was unclear to me how to fix (see TODOs in `scip.rs`)

Behavior changes:

* `scip` command now reports symbol information omitted due to symbol
collisions. Iterating with this on a large codebase (Zed!) resulted in
the other improvements in this change.

* Generally fixes providing the path to nested definitions in
symbols. Instead of having special cases for a couple limited cases of
nesting, implements `Definition::enclosing_definition` and uses this
to walk definitions.

* Parameter variables are now treated like locals.

    - This fixes a bug where closure captures also received symbols
    scoped to the containing function.  To bring back parameter
    symbols I would want a way to filter these out, since they can
    cause symbol collisions.

    - Having symbols for them seems to be intentional in
    27e2eea54f, but no particular use is
    specified there. For the typical indexing purposes of SCIP I don't see
    why parameter symbols are useful or sensible, as function parameters
    are not referencable by anything but position. I can imagine they
    might be useful in representing diagnostics or something.

* Inherent impls are now represented as `impl#[SelfType]` - a type
named `impl` which takes a single type parameter.

* Trait impls are now represented as `impl#[SelfType][TraitType]` - a
type named `impl` which takes two type parameters.

* Associated types in traits and impls are now treated like types
instead of type parameters, and so are now suffixed with `#` instead
of wrapped with `[]`.  Treating them as type parameters seems to have
been intentional in 73d9c77f2a but it
doesn't make sense to me, so changing it.

* Static variables are now treated as terms instead of `Meta`, and so
receive `.` suffix instead of `:`.

* Attributes are now treated as `Meta` instead of `Macro`, and so
receive `:` suffix instead of `!`.

* `enclosing_symbol` is now provided for labels and generic params,
which are local symbols.

* Fixes a bug where presence of `'` causes a descriptor name to get
double wrapped in backticks, since both `fn new_descriptor` and
`scip::symbol::format_symbol` have logic for wrapping in
backticks. Solution is to simply delete the redundant logic.

* Deletes a couple tests in moniker.rs because the cases are
adequeately covered in scip.rs and the format for identifiers used in
moniker.rs is clunky with the new representation for trait impls
2024-12-25 21:51:58 -07:00
roife
5a3d1a6d0d fix missing name enum when hovering on fields in variants 2024-12-25 07:28:26 +08:00
Lukas Wirth
e30ce42671
Merge pull request #18707 from ChayimFriedman2/subst
feat: Show substitution where hovering over generic things
2024-12-24 14:16:16 +00:00
Lukas Wirth
2f33e85f56
Merge pull request #18739 from Veykril/push-ntpvvqnnovtn
fix: Don't trigger paren wrapping typing handler after idents
2024-12-22 11:22:56 +00:00
Lukas Wirth
a7f3265028 fix: Don't trigger paren wrapping typing handler after idents 2024-12-22 12:08:27 +01:00
roife
693b110e3d fix: remove always! check for file_id in runnables 2024-12-21 07:00:49 +08:00
Chayim Refael Friedman
b5486ffc42 Show substitution where hovering over generic things
There are few things to note in the implementation:

First, this is a best-effort implementation. Mainly, type aliases may not be shown (due to their eager nature it's harder) and partial pathes (aka. hovering over `Struct` in `Struct::method`) are not supported at all.

Second, we only need to show substitutions in expression and pattern position, because in type position all generic arguments always have to be written explicitly.
2024-12-20 11:30:19 +02:00
Lukas Wirth
15239f612d internal: Show mir eval errors on hover with debug env var set 2024-12-15 17:38:37 +01:00
Laurențiu Nicola
405f01ac3f
Merge pull request #18678 from regexident/fix-typos
minor: Fix a few typos
2024-12-13 09:09:33 +00:00
Vincent Esche
3d4f10a856 Fix a few typos 2024-12-13 09:54:35 +01:00
Lukas Wirth
6aadbae022
Merge pull request #18674 from Veykril/push-lrxotqknvxvr
Show expansion errors in expand_macro feature
2024-12-13 08:50:45 +00:00
Lukas Wirth
28fbecff42 Show expansion errors in expand_macro feature 2024-12-13 09:36:03 +01:00
Lukas Wirth
cde07f29c9
Merge pull request #18675 from ShoyuVanilla/issue-18664
fix: Panic when displaying generic params with defaults, again
2024-12-12 16:37:10 +00:00
Shoyu Vanilla
94ec3fe7ed fix: Panic when displaying generic params with defaults, again 2024-12-13 01:15:41 +09:00
Chayim Refael Friedman
0b7a6f38d7 Properly handle different defaults for severity of lints
Previously all lints were assumed to be `#[warn]`, and we had a hand-coded list of `#[allow]` exceptions. Now the severity is autogenerated from rustdoc output.

Also support lints that change status between editions, and the `warnings` lint group.
2024-12-11 20:48:41 +02:00
Lukas Wirth
956ff4d8c5 Rename test fixture crates to ra_test_fixture 2024-12-09 11:40:21 +01:00
Lukas Wirth
bf6547a77e Highlight right angle as part of fat arrow in macro rules arm 2024-12-06 16:28:32 +01:00
Lukas Wirth
54dbf1b446 Add typing handler for param list pipe 2024-12-06 15:49:36 +01:00
Lukas Wirth
5dc5107e9c Improve heuristics for on typing semicolon insertion 2024-12-06 15:00:09 +01:00
Lukas Wirth
630e4ca44a
Merge pull request #18474 from Veykril/push-nvtxykxkwnvs
Make bracket typing handler work on more things
2024-12-06 12:03:52 +00:00
Lukas Wirth
19465b94f5 Add implict unsafety inlay hints for extern blocks 2024-12-06 12:49:03 +01:00
Lukas Wirth
bac0ed579f Make bracket typing handler work on more things 2024-12-06 12:47:32 +01:00
Lukas Wirth
d6b62265b5 fix: Resolve generic parameters within use captures 2024-12-05 19:11:33 +01:00
Shoyu Vanilla
405520150d fix: Panic when displaying generic params with defaults 2024-12-06 01:10:46 +09:00
Lukas Wirth
65c0b29720 Fix parsing of parenthesized type args and RTN 2024-12-04 11:48:47 +01:00
Tarek
9aff46632e chore: deprecate typing.autoClosingAngleBrackets configuration
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-03 22:38:51 +02:00