Commit Graph

23929 Commits

Author SHA1 Message Date
Roland Fredenhagen
ec06313a6d
fix test for required_hashes 2023-01-16 19:25:30 +01:00
Roland Fredenhagen
5e66e49c73
move required_hashes into utils 2023-01-16 18:39:16 +01:00
Roland Fredenhagen
03bc46f96b
Convert pub to pub(crate) 2023-01-12 09:54:48 +01:00
Roland Fredenhagen
6f201cfc56
Assist: desugar doc-comment 2023-01-12 02:28:13 +01:00
bors
09aceea36d Auto merge of #13933 - Veykril:assoc-search, r=Veykril
Refine search for const and function assoc items

This changes our searching behavior, before we always associated all usages and definitions of associated items with all implementations of a trait and the trait itself. Now, when searching for references of a an associated trait item, we still do the same and consider all implementations, but when searching for an associated item of an implementation we now only consider the uses of that specific implementations associated item.

This does not affect associated type aliases as we unfortunately are missing information in the IDE layer here still.
2023-01-11 16:21:11 +00:00
Lukas Wirth
bb4e272d8a Refine search for const and function assoc items 2023-01-11 17:10:04 +01:00
bors
f32f64bffc Auto merge of #13929 - danieleades:simplify, r=lnicola
internal: a number of code simplifications
2023-01-11 09:38:34 +00:00
bors
75877d78d9 Auto merge of #13897 - bvanjoi:nearest-block-search, r=Veykril
fix(ty): should query impls in nearest block

fix https://github.com/rust-lang/rust-analyzer/issues/13895
2023-01-10 22:44:29 +00:00
Daniel Eades
d218b237fd collapse some nested blocks 2023-01-10 20:40:08 +00:00
Daniel Eades
95fc3ba41c fixup 2023-01-10 19:51:21 +00:00
Daniel Eades
5b1cd8245f fixup 2023-01-10 19:44:19 +00:00
Daniel Eades
ac3844a0bb a number of code simplifications 2023-01-10 18:48:51 +00:00
bors
6dabdefa2e Auto merge of #13928 - danieleades:clone-on-copy, r=lnicola
internal: avoid 'cloning' types that implement 'Copy'
2023-01-10 18:48:10 +00:00
Daniel Eades
95d14c393c avoid 'cloning' types that implement 'Copy' 2023-01-10 18:20:12 +00:00
bors
a97cbb1ee9 Auto merge of #13927 - lnicola:rm-blank-issue, r=lnicola
minor: tweak wording and remove blank issue template

There's already a "blank issue" link at the bottom, and some users seem to pick this one because it's the first.
2023-01-10 18:01:48 +00:00
bors
3987c835f2 Auto merge of #13919 - danieleades:derive-hash, r=lnicola
derive 'Hash'
2023-01-10 17:48:46 +00:00
bors
c3b78f440e Auto merge of #13917 - Veykril:raw-attrs, r=Veykril
Split out hir-def attribute handling parts into hir-expand

This should help with `cfg_attr` handling for macro inputs
2023-01-10 17:35:37 +00:00
bors
674b52aaaa Auto merge of #13862 - danieleades:logic-bug, r=lnicola
comment out disabled code
2023-01-10 17:22:39 +00:00
bors
6e89e7787c Auto merge of #13923 - rust-lang:revert-13886-inlay-ligatures, r=lnicola
Revert "Use ZWNJ to prevent VSCode from forming ligatures between hints and code"

Doesn't actually seem to fix the bug, it seems to be theme dependent and I am not sure what causes it
Reverts rust-lang/rust-analyzer#13886
2023-01-10 17:07:06 +00:00
bors
8eb75220b0 Auto merge of #13924 - lnicola:sync-from-rust, r=Veykril
internal: sync from downstream
2023-01-10 16:47:46 +00:00
Laurențiu Nicola
220996c5c1 Tweak wording and remove blank issue template 2023-01-10 17:25:02 +02:00
Laurențiu Nicola
13aa7a2ca2 Merge branch 'master' into sync-from-rust 2023-01-10 16:08:39 +02:00
Lukas Wirth
4267b11c40
Revert "Use ZWNJ to prevent VSCode from forming ligatures between hints and code" 2023-01-10 09:43:08 +01:00
Daniel Eades
56ffe63c3c derive 'Hash' 2023-01-10 07:18:17 +00:00
Daniel Eades
db41e6b408 remove 'deny_clippy' test 2023-01-10 07:16:27 +00:00
Daniel Eades
b971b5b64f suppress lint 2023-01-10 07:06:26 +00:00
Daniel Eades
ef4debc8b1 comment out disabled code 2023-01-10 07:02:04 +00:00
bvanjoi
9a15cc81b4 fix(ty): should query impls in nearest block 2023-01-10 10:28:17 +08:00
Lukas Wirth
621e96bd6a Encode one level of cfg_attr in attr_id 2023-01-09 21:06:13 +01:00
arcnmx
25242fe93f ⬆️ rust-analyzer
Merge commit '368e0bb32f1178cf162c2ce5f7e10b7ae211eb26'
2023-01-09 10:36:22 -08:00
Lukas Wirth
68723043db Split out hir-def attribute handling parts into hir-expand 2023-01-09 19:29:28 +01:00
bors
368e0bb32f Auto merge of #13848 - ian-h-chamberlain:feature/color-compiler-diagnostics, r=ian-h-chamberlain
Colorize `cargo check` diagnostics in VSCode via text decorations

Fixes #13648

![colored-rustc-diagnostics](https://user-images.githubusercontent.com/11131775/209479884-10eef8ca-37b4-4aae-88f7-3591ac01b25e.gif)

Use ANSI control characters to display text decorations matching the VScode terminal theme, and strip them out when providing text content for rustc diagnostics.

This adds the small [`anser`](https://www.npmjs.com/package/anser) library (MIT license, no dependencies) to parse the control codes, and it also supports HTML output so it should be fairly easy to switch to a rendered HTML/webview implementation in the future

I also updated the default `cargo check` command to use the rendered ANSI diagnostics, although I'm not sure if it makes sense to put this kind of thing behind a feature flag, or whether it might have any issues on Windows (as I believe ANSI codes are not used for colorization there)?
2023-01-09 17:07:35 +00:00
Ian Chamberlain
283dfc45dd
Add docs for colorDiagnosticOutput capability 2023-01-09 11:50:37 -05:00
Ian Chamberlain
65cf7abbe2
Use experimental capability to enable color codes 2023-01-09 11:50:35 -05:00
Ian Chamberlain
738ce83d85
Strip colors before matching preview diagnostics 2023-01-09 11:49:59 -05:00
Ian Chamberlain
c3e4bc3136
Update docs to include note about ANSI diagnostics 2023-01-09 11:49:58 -05:00
Ian Chamberlain
40207906f4
Default to use colored ANSI diagnostics 2023-01-09 11:46:29 -05:00
Ian Chamberlain
1b8141b54c
Parse + decorate rendered ANSI cargo output
Use ANSI control characters to display text decorations matching the
VScode terminal theme, and strip them out when providing text content
for rustc diagnostics.

This adds the small `anser` library to parse the control codes, and it
also supports HTML output so it should be fairly easy to switch to a
rendered HTML/webview implementation if desired.
2023-01-09 11:46:29 -05:00
bors
f32e20edb9 Auto merge of #13915 - Veykril:lsp-server-msg, r=Veykril
Make it clearer when the server expects an initialized notification
2023-01-09 16:04:04 +00:00
Lukas Wirth
9eb50d3cde Make it clearer when the server expects an initialized notification 2023-01-09 17:03:36 +01:00
bors
fd300eebc9 Auto merge of #13799 - Veykril:flycheck, r=Veykril
Rename `checkOnSave` settings to `check`

Now that flychecks can be triggered without saving the setting name doesn't make that much sense anymore. This PR renames it to just `check`, but keeps `checkOnSave` as the enabling setting.
2023-01-09 15:35:38 +00:00
bors
f920b03c6c Auto merge of #13914 - WaffleLapkin:qualify_method_call_rewrite, r=lnicola
minor: Make `qualify_method_call` `RefactorRewrite`

See https://github.com/rust-lang/rust-analyzer/pull/13825#issuecomment-1363289767
2023-01-09 15:22:51 +00:00
bors
e125bee055 Auto merge of #13890 - lowr:fix/unescape-inline-mod-name, r=Veykril
fix: unescape inline module names in module resolution

Fixes #13884
2023-01-09 15:07:06 +00:00
bors
ba204ef07b Auto merge of #13863 - danieleades:approx-constant, r=Veykril
minor: suppress 'clippy::approx_constant' lint in test case

suppresses a false positive clippy lint
2023-01-09 14:53:46 +00:00
bors
d33fa38cc9 Auto merge of #13825 - WaffleLapkin:ufcs_to_method_call_and_back, r=Veykril
feat: Add `unqualify_method_call` assist

...which is the inverse of `qualify_method_call` assist.

![Peek 2022-12-22 22-47](https://user-images.githubusercontent.com/38225716/209206554-8f067206-6fa6-48f8-849e-f6d36ee2e5a1.gif)

Optional future work:
- import the trait if needed
- remove excess references when auto-ref is possible
2023-01-09 14:37:40 +00:00
Maybe Waffle
bdaad9eb15 Make qualify_method_call RefactorRewrite 2023-01-09 14:26:48 +00:00
bors
336608aa92 Auto merge of #13810 - tfpk:tfpk/macro-inline, r=Veykril
Add action to expand a declarative macro once, inline. Fixes #13598

This commit adds a new r-a method, `expandMacroInline`, which expands the macro that's currently selected. See  #13598 for the most applicable issue; though I suspect it'll resolve part of #5949 and make #11888 significantly easier).

The macro works like this:

![rust-analyser-feature](https://user-images.githubusercontent.com/10906982/208813167-3123e379-8fd5-4206-a4f4-5af1129565f9.gif)

I have 2 questions before this PR can be merged:

1. **Should we rustfmt the output?** The advantage of doing this is neater code. The disadvantages are we'd have to format the whole expr/stmt/block (since there's no point just formatting one part, especially over multiple lines), and maybe it moves the code around more in weird ways. My suggestion here is to start off by not doing any formatting; and if it appears useful we can decide to do formatting in a later release.
2.   **Is it worth solving the `$crate` hygiene issue now?** -- I think this PR is usable as of right now for some use-cases; but it is annoying that many common macros (i.e. `println!()`, `format!()`) can't be expanded further unless the user guesses the correct `$crate` value. The trouble with solving that issue is that I think it's complicated and imperfect. If we do solve it; we'd also need to either change the existing `expandMacro`/`expandMacroInline` commands; provide some option to allow/disallow `$crate` expanding; or come to some other compromise.
2023-01-09 14:24:41 +00:00
Maybe Waffle
c782353a90 Rename assist: convert_ufcs_to_method => unqualify_method_call 2023-01-09 14:23:30 +00:00
bors
938a39ab89 Auto merge of #13891 - bvanjoi:reverse-whitespace-in-assists, r=Veykril
fix: keep whitespace in extract function handler

Fixed #13874
2023-01-09 14:11:40 +00:00
Tom Kunc
769273ca4c Simplify code with @Veykril's suggestion. 2023-01-09 07:01:41 -07:00