]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoFix tests
Jonas Schievink [Fri, 13 May 2022 13:27:17 +0000 (15:27 +0200)]
Fix tests

2 years agoRevert "Auto merge of #12149 - jonas-schievink:literally-just-a-literal, r=jonas...
Jonas Schievink [Fri, 13 May 2022 13:08:14 +0000 (15:08 +0200)]
Revert "Auto merge of #12149 - jonas-schievink:literally-just-a-literal, r=jonas-schievink"

This reverts commit cc9ae2b89e01a30e441371b9fd3376c3d03a475f, reversing
changes made to 7dfd1cb572d8d4fd951237361e43ecddd9c9a852.

2 years agoRevert "Skip only the `tt::Literal` when consuming float tokens"
Jonas Schievink [Fri, 13 May 2022 13:06:16 +0000 (15:06 +0200)]
Revert "Skip only the `tt::Literal` when consuming float tokens"

This reverts commit 7db55313a17a488a8e437fbd184290995f04a32d.

2 years agoRevert "Fix conversion of float literals in `TtTreeSink`"
Jonas Schievink [Fri, 13 May 2022 13:05:17 +0000 (15:05 +0200)]
Revert "Fix conversion of float literals in `TtTreeSink`"

This reverts commit 43a066c5a87972b5e42ad41bab56861661c49b18.

2 years agoRevert "fix: Remap float parts as integers when parsed as indices"
Jonas Schievink [Fri, 13 May 2022 13:05:03 +0000 (15:05 +0200)]
Revert "fix: Remap float parts as integers when parsed as indices"

This reverts commit dbb066b99e2e644437ddecb20127bcfdba975614.

2 years agoRevert "Don't remap float tokens to `INT_NUMBER`"
Jonas Schievink [Fri, 13 May 2022 13:04:15 +0000 (15:04 +0200)]
Revert "Don't remap float tokens to `INT_NUMBER`"

This reverts commit cb5e8da88a06be415bd804884284c11c0a709bcf.

2 years agoAuto merge of #12238 - Veykril:publisher, r=Veykril
bors [Fri, 13 May 2022 11:26:43 +0000 (11:26 +0000)]
Auto merge of #12238 - Veykril:publisher, r=Veykril

feat: Change VSCode extension publisher to `rust-lang`

2 years agofeat: Change VSCode extension publisher to `rust-lang`
Lukas Wirth [Fri, 13 May 2022 11:21:52 +0000 (13:21 +0200)]
feat: Change VSCode extension publisher to `rust-lang`

2 years agoAuto merge of #12231 - jonas-schievink:fix-float-macro-panic, r=jonas-schievink
bors [Thu, 12 May 2022 17:03:22 +0000 (17:03 +0000)]
Auto merge of #12231 - jonas-schievink:fix-float-macro-panic, r=jonas-schievink

fix: fix "X is not a valid punct" panic with floats in macros

Should fix https://github.com/rust-lang/rust-analyzer/issues/12211

2 years agoDon't remap float tokens to `INT_NUMBER`
Jonas Schievink [Thu, 12 May 2022 17:01:09 +0000 (19:01 +0200)]
Don't remap float tokens to `INT_NUMBER`

2 years agoAuto merge of #12229 - Veykril:configfix, r=Veykril
bors [Thu, 12 May 2022 16:16:20 +0000 (16:16 +0000)]
Auto merge of #12229 - Veykril:configfix, r=Veykril

fix: Fix vscode config descriptions not recognizing all valid values

2 years agofix: Fix vscode config descriptions not recognizing all valid values
Lukas Wirth [Thu, 12 May 2022 16:15:48 +0000 (18:15 +0200)]
fix: Fix vscode config descriptions not recognizing all valid values

2 years agoAuto merge of #12228 - Veykril:configfix, r=Veykril
bors [Thu, 12 May 2022 15:55:50 +0000 (15:55 +0000)]
Auto merge of #12228 - Veykril:configfix, r=Veykril

fix: Fix old config patching overwriting callable snippet config unconditionally

2 years agofix: Fix old config patching overwriting callable snippet config unconditionally
Lukas Wirth [Thu, 12 May 2022 15:55:25 +0000 (17:55 +0200)]
fix: Fix old config patching overwriting callable snippet config unconditionally

2 years agoAuto merge of #12226 - Veykril:reborrow-inlay-hints, r=Veykril
bors [Thu, 12 May 2022 12:21:06 +0000 (12:21 +0000)]
Auto merge of #12226 - Veykril:reborrow-inlay-hints, r=Veykril

feat: Allow reborrow inlay hints to be restricted to mutable reborrows only

2 years agofeat: Allow reborrow inlay hints to be restricted to mutable reborrows only
Lukas Wirth [Thu, 12 May 2022 11:39:32 +0000 (13:39 +0200)]
feat: Allow reborrow inlay hints to be restricted to mutable reborrows only

2 years agoAuto merge of #12224 - Veykril:anno-redundant, r=Veykril
bors [Thu, 12 May 2022 11:31:11 +0000 (11:31 +0000)]
Auto merge of #12224 - Veykril:anno-redundant, r=Veykril

internal: Remove redundant offset data in annotations

cc https://github.com/rust-lang/rust-analyzer/issues/12221

2 years agoAuto merge of #12225 - Veykril:tmapfloats, r=Veykril
bors [Thu, 12 May 2022 11:18:36 +0000 (11:18 +0000)]
Auto merge of #12225 - Veykril:tmapfloats, r=Veykril

internal: Add token mapping test for float literals

cc https://github.com/rust-lang/rust-analyzer/issues/12216

2 years agointernal: Add token mapping test for float literals
Lukas Wirth [Thu, 12 May 2022 11:17:53 +0000 (13:17 +0200)]
internal: Add token mapping test for float literals

2 years agointernal: Remove redundant offset data in annotations
Lukas Wirth [Thu, 12 May 2022 10:55:25 +0000 (12:55 +0200)]
internal: Remove redundant offset data in annotations

2 years agoAuto merge of #12215 - listochkin:Support-variable-substitution-in-vscode-settings...
bors [Thu, 12 May 2022 11:05:21 +0000 (11:05 +0000)]
Auto merge of #12215 - listochkin:Support-variable-substitution-in-vscode-settings, r=Veykril

feat: Support variable substitution in VSCode settings

Currently support a subset of [variables provided by VSCode](https://code.visualstudio.com/docs/editor/variables-reference) in `server.extraEnv` section of Rust-Analyzer settings:

  * `workspaceFolder`
  * `workspaceFolderBasename`
  * `cwd`
  * `execPath`
  * `pathSeparator`

Also, this PR adds support for general environment variables resolution. You can declare environment variables and reference them from other variables like this:

```JSON
"rust-analyzer.server.extraEnv": {
    "RUSTFLAGS": "-L${env:OPEN_XR_SDK_PATH}",
    "OPEN_XR_SDK_PATH": "${workspaceFolder}\\..\\OpenXR-SDK\\build\\src\\loader\\Release"
},
```
The order of variable declaration doesn't matter, you can reference variables before defining them. If the variable is not present in `extraEnv` section, VSCode will search for them in your environment. Missing variables will be replaced with empty string. Circular references won't be resolved and will be passed to rust-analyzer server process as is.

Closes #9626, but doesn't address use cases where people want to use values provided by `rustc` or `cargo`, such as `${targetTriple}` proposal #11649

2 years agoAuto merge of #12223 - Veykril:config-stuff, r=Veykril
bors [Thu, 12 May 2022 10:30:37 +0000 (10:30 +0000)]
Auto merge of #12223 - Veykril:config-stuff, r=Veykril

internal: Rename primeCaches config keys

2 years agointernal: Rename primeCaches config keys
Lukas Wirth [Thu, 12 May 2022 10:29:40 +0000 (12:29 +0200)]
internal: Rename primeCaches config keys

2 years agoAuto merge of #12220 - arzg:fix-character-semantic-token, r=arzg
bors [Thu, 12 May 2022 08:16:46 +0000 (08:16 +0000)]
Auto merge of #12220 - arzg:fix-character-semantic-token, r=arzg

Fix `character` semantic token type definition

The semantic token type for character literals is called `character`:

https://github.com/rust-lang/rust-analyzer/blob/94fa8a6534cf93276ad7e205026402f24d41a0b2/crates/rust-analyzer/src/semantic_tokens.rs#L51

and yet the definition in `package.json` uses `char`. In practice this means trying to highlight `char` doesn’t have any effect, while `character` doesn’t have any hover documentation and doesn’t appear in autocomplete. The definition also defines the fallback semantic token type as `type`; luckily since it currently references the non-existent `char` this doesn’t have any effect, since it doesn’t really make sense to highlight character literals as types.

This PR fixes the definition in `package.json` to correctly reference `character`, and also defines the fallback type as `number`. I’d say character literals are closer to a shorthand for writing a number than a string, though this is debatable and I’d be happy to change it to `string`, or anything else.

2 years agoFix `character` semantic token type definition
Luna Razzaghipour [Thu, 12 May 2022 07:19:41 +0000 (17:19 +1000)]
Fix `character` semantic token type definition

2 years agoEnable variable substitutions before passing them over to R-A server
Andrei Listochkin [Wed, 11 May 2022 12:37:40 +0000 (13:37 +0100)]
Enable variable substitutions before passing them over to R-A server

2 years agoVSCode variables support for substitutions
Andrei Listochkin [Wed, 11 May 2022 12:34:43 +0000 (13:34 +0100)]
VSCode variables support for substitutions

Tests now open Rust-Analyzer extension code in order to populate
VSCode variables.

2 years agohandle references to external environment variables
Andrei Listochkin [Wed, 11 May 2022 12:28:08 +0000 (13:28 +0100)]
handle references to external environment variables

use cross-env to enable env variables on Windows

2 years agoiterative dependency solver
Andrei Listochkin [Wed, 11 May 2022 12:22:58 +0000 (13:22 +0100)]
iterative dependency solver

First, we go through every environment variable key and record all cases
where there are reference to other variables / dependencies.

We track two sets of variables - resolved and yet-to-be-resolved.
We pass over a list of variables over and over again and when all
variable's dependencies were resolved during previous passes we perform
a replacement for that variable, too.

Over time the size of `toResolve` set should go down to zero, however
circular dependencies may prevent that. We track the size of `toResolve`
between iterations to avoid infinite looping.

At the end we produce an object of the same size and shape as
the original, but with the values replace with resolved versions.

2 years agosearch for test files instead of explicitly name them
Andrei Listochkin [Wed, 11 May 2022 11:01:34 +0000 (12:01 +0100)]
search for test files instead of explicitly name them

2 years agoAuto merge of #12213 - Veykril:config-fix, r=Veykril
bors [Wed, 11 May 2022 10:38:56 +0000 (10:38 +0000)]
Auto merge of #12213 - Veykril:config-fix, r=Veykril

fix: Fix incorrect config patching for runBuildScripts

2 years agofix: Fix incorrect config patching for runBuildScripts
Lukas Wirth [Wed, 11 May 2022 10:33:56 +0000 (12:33 +0200)]
fix: Fix incorrect config patching for runBuildScripts

2 years agoAuto merge of #12212 - Elliot-Roberts:hint_typo, r=lnicola
bors [Wed, 11 May 2022 07:26:28 +0000 (07:26 +0000)]
Auto merge of #12212 - Elliot-Roberts:hint_typo, r=lnicola

Fix a typo in the `inlayHints.renderColons` option description

The description said the same thing twice: "trailing colons for parameter hints, and trailing colons for parameter hints".
I'm assuming one of those is supposed to be about the leading colon for type hints.

Also, I wasn't sure how to regenerate the generated file(s?) so I just manually updated them. Hopefully that isn't a problem. If how to do that is in the documentation somewhere I'd love to know.

2 years agofix typo in `inlayHints.renderColons` option description
Elliot Roberts [Wed, 11 May 2022 02:15:07 +0000 (19:15 -0700)]
fix typo in `inlayHints.renderColons` option description

2 years agoAuto merge of #12209 - Veykril:config-fix, r=Veykril
bors [Tue, 10 May 2022 19:15:06 +0000 (19:15 +0000)]
Auto merge of #12209 - Veykril:config-fix, r=Veykril

fix: Fix config patching failing when appending suffixes

2 years agofix: Fix config patching failing when appending suffixes
Lukas Wirth [Tue, 10 May 2022 19:14:22 +0000 (21:14 +0200)]
fix: Fix config patching failing when appending suffixes

2 years agoAuto merge of #12208 - jonas-schievink:assoc-ty-signature-info, r=jonas-schievink
bors [Tue, 10 May 2022 14:55:59 +0000 (14:55 +0000)]
Auto merge of #12208 - jonas-schievink:assoc-ty-signature-info, r=jonas-schievink

feat: include associated types in trait signature help

Fixes https://github.com/rust-lang/rust-analyzer/issues/12141

![screenshot-2022-05-10-16:55:19](https://user-images.githubusercontent.com/1786438/167658642-8df42fba-523a-46fe-a0f6-e0e041b3659d.png)

2 years agoInclude assoc. types in trait signature help
Jonas Schievink [Tue, 10 May 2022 14:54:31 +0000 (16:54 +0200)]
Include assoc. types in trait signature help

2 years agoFix inverted signature help setting
Jonas Schievink [Tue, 10 May 2022 14:54:13 +0000 (16:54 +0200)]
Fix inverted signature help setting

2 years agoAuto merge of #12204 - Veykril:completions, r=Veykril
bors [Tue, 10 May 2022 13:08:27 +0000 (13:08 +0000)]
Auto merge of #12204 - Veykril:completions, r=Veykril

internal: Move keyword expressions to expr completions module

2 years agoMove keyword expressions to expr completions module
Lukas Wirth [Tue, 10 May 2022 13:00:58 +0000 (15:00 +0200)]
Move keyword expressions to expr completions module

2 years agoAuto merge of #12203 - Veykril:completions, r=Veykril
bors [Tue, 10 May 2022 12:36:46 +0000 (12:36 +0000)]
Auto merge of #12203 - Veykril:completions, r=Veykril

internal: Simplify

2 years agoDon't parse files in module completion
Lukas Wirth [Tue, 10 May 2022 12:31:43 +0000 (14:31 +0200)]
Don't parse files in module completion

2 years agoSimplify
Lukas Wirth [Tue, 10 May 2022 12:31:28 +0000 (14:31 +0200)]
Simplify

2 years agoAuto merge of #12202 - iDawer:ide.sig_help-fix, r=lnicola
bors [Tue, 10 May 2022 12:28:34 +0000 (12:28 +0000)]
Auto merge of #12202 - iDawer:ide.sig_help-fix, r=lnicola

fix: don't panic at fully qualified call syntax in signature help

Closes  #12200
Regressed from #12082

2 years ago`signature_help`: detect fully qualified call syntax for parameter fallback
iDawer [Tue, 10 May 2022 12:18:42 +0000 (17:18 +0500)]
`signature_help`: detect fully qualified call syntax for parameter fallback

2 years agoAuto merge of #12010 - Veykril:r-a-config, r=Veykril
bors [Tue, 10 May 2022 12:07:24 +0000 (12:07 +0000)]
Auto merge of #12010 - Veykril:r-a-config, r=Veykril

Config revamp

Fixes https://github.com/rust-lang/rust-analyzer/issues/11790
Fixes https://github.com/rust-lang/rust-analyzer/issues/12115

This PR changes a lot of config names, and a few ones are being merged or split apart. The reason for this is that our configuration names currently are rather inconsistent and some where poorly chosen in regards to extensability. This PR plans to fix that.

We still allow the old config names by patching them to the new ones before deserializing to keep backwards compatability with other clients (the VSCode client will auto update the config) but ideally we will get rid of that layer in the future.

Here is a list of the changes:

These are simple renames `old_name | alias1 | alias2 ... -> new_name` (the vscode client will fix these up automagically):
```
assist_allowMergingIntoGlobImports -> imports_merge_glob
assist_exprFillDefault -> assist_expressionFillDefault
assist_importEnforceGranularity -> imports_granularity_enforce
assist_importGranularity | assist_importMergeBehavior | assist_importMergeBehaviour -> imports_granularity_group
assist_importGroup -> imports_group_enable
assist_importPrefix -> imports_prefix

cache_warmup -> primeCaches_enable

cargo_loadOutDirsFromCheck -> cargo_buildScripts_enable
cargo_runBuildScripts | cargo_runBuildScriptsCommand -> cargo_runBuildScripts_overrideCommand
cargo_useRustcWrapperForBuildScripts -> cargo_runBuildScripts_useRustcWrapper

completion_snippets -> completion_snippets_custom

diagnostics_enableExperimental -> diagnostics_experimental_enable

experimental_procAttrMacros -> procMacro_attributes_enable

highlighting_strings -> semanticHighlighting_strings_enable

highlightRelated_breakPoints -> semanticHighlighting_breakPoints_enable
highlightRelated_exitPoints -> semanticHighlighting_exitPoints_enable
highlightRelated_yieldPoints -> semanticHighlighting_yieldPoints_enable
highlightRelated_references -> semanticHighlighting_references_enable

hover_documentation -> hover_documentation_enable
hover_linksInHover | hoverActions_linksInHover -> hover_links_enable
hoverActions_debug -> hoverActions_debug_enable
hoverActions_enable -> hoverActions_enable_enable
hoverActions_gotoTypeDef -> hoverActions_gotoTypeDef_enable
hoverActions_implementations -> hoverActions_implementations_enable
hoverActions_references -> hoverActions_references_enable
hoverActions_run -> hoverActions_run_enable

inlayHints_chainingHints -> inlayHints_chainingHints_enable
inlayHints_closureReturnTypeHints -> inlayHints_closureReturnTypeHints_enable
inlayHints_hideNamedConstructorHints -> inlayHints_typeHints_hideNamedConstructorHints
inlayHints_parameterHints -> inlayHints_parameterHints_enable
inlayHints_reborrowHints -> inlayHints_reborrowHints_enable
inlayHints_typeHints -> inlayHints_typeHints_enable

lruCapacity -> lru_capacity

runnables_cargoExtraArgs -> runnables_extraArgs
runnables_overrideCargo -> runnables_command

rustcSource -> rustc_source

rustfmt_enableRangeFormatting -> rustfmt_rangeFormatting_enable
```

These are configs that have been merged or split apart, which have to be manually updated by the user:

```
callInfo_full -> signatureInfo_detail, signatureInfo_documentation_enable

cargo_allFeatures, cargo_features -> cargo_features
checkOnSave_allFeatures, checkOnSave_features -> checkOnSave_features
completion_addCallArgumentSnippets completion_addCallParenthesis -> completion_callable_snippets
```

2 years agoAuto merge of #12201 - Veykril:inlay-hide, r=Veykril
bors [Tue, 10 May 2022 11:44:06 +0000 (11:44 +0000)]
Auto merge of #12201 - Veykril:inlay-hide, r=Veykril

fix: Add cast expressions to param name inlay hint heuristics

2 years agofix: Add cast expressions to param name inlay hint heuristics
Lukas Wirth [Tue, 10 May 2022 11:43:43 +0000 (13:43 +0200)]
fix: Add cast expressions to param name inlay hint heuristics

2 years agoAuto merge of #12199 - jonas-schievink:no-invalid-assoc-ty-completions, r=jonas-schievink
bors [Mon, 9 May 2022 16:12:47 +0000 (16:12 +0000)]
Auto merge of #12199 - jonas-schievink:no-invalid-assoc-ty-completions, r=jonas-schievink

fix: Don't show assoc. type binding completions when invalid

Fixes https://github.com/rust-lang/rust-analyzer/issues/12165

2 years agoDon't show assoc. type binding completions when invalid
Jonas Schievink [Mon, 9 May 2022 16:12:12 +0000 (18:12 +0200)]
Don't show assoc. type binding completions when invalid

2 years agoAuto merge of #12198 - jonas-schievink:ide-resolve-supertrait-assoc-types, r=jonas...
bors [Mon, 9 May 2022 15:40:45 +0000 (15:40 +0000)]
Auto merge of #12198 - jonas-schievink:ide-resolve-supertrait-assoc-types, r=jonas-schievink

fix: Resolve assoc. types of supertraits in the IDE layer

Fixes https://github.com/rust-lang/rust-analyzer/issues/12166

2 years agoMake completion work too
Jonas Schievink [Mon, 9 May 2022 15:39:13 +0000 (17:39 +0200)]
Make completion work too

2 years agoResolve assoc. types of supertraits in the IDE layer
Jonas Schievink [Mon, 9 May 2022 15:30:49 +0000 (17:30 +0200)]
Resolve assoc. types of supertraits in the IDE layer

2 years agoAuto merge of #12197 - Veykril:insert-use-fix, r=Veykril
bors [Mon, 9 May 2022 10:13:08 +0000 (10:13 +0000)]
Auto merge of #12197 - Veykril:insert-use-fix, r=Veykril

fix: Fix import insertion inserting after last comment in a file

2 years agofix: Fix import insertion inserting after last comment in a file
Lukas Wirth [Mon, 9 May 2022 09:52:49 +0000 (11:52 +0200)]
fix: Fix import insertion inserting after last comment in a file

2 years agoAuto merge of #11983 - jhpratt:remove-rustc_deprecated, r=lnicola
bors [Mon, 9 May 2022 08:33:18 +0000 (08:33 +0000)]
Auto merge of #11983 - jhpratt:remove-rustc_deprecated, r=lnicola

Remove handling of `#[rustc_deprecated]`

This should be merged along with rust-lang/rust#95960.

Because the attribute still exists in rustc, I've left the definition here. With that said, any use of it is an error, so I've removed any handling of `#[rustc_deprecated]`.

2 years agoAuto merge of #12187 - Veykril:completion-rev, r=Veykril
bors [Sat, 7 May 2022 14:25:12 +0000 (14:25 +0000)]
Auto merge of #12187 - Veykril:completion-rev, r=Veykril

internal: More completion context refactoring

2 years agoAuto merge of #12188 - Veykril:auto-import, r=Veykril
bors [Sat, 7 May 2022 14:16:00 +0000 (14:16 +0000)]
Auto merge of #12188 - Veykril:auto-import, r=Veykril

fix: Allow auto importing starting segments of use items

2 years agofix: Allow auto importing starting segments of use items
Lukas Wirth [Sat, 7 May 2022 13:23:25 +0000 (15:23 +0200)]
fix: Allow auto importing starting segments of use items

2 years agofix unreachable pub
Lukas Wirth [Sat, 7 May 2022 13:08:33 +0000 (15:08 +0200)]
fix unreachable pub

2 years agoMerge the different identifier contexts into one enum
Lukas Wirth [Sat, 7 May 2022 13:05:43 +0000 (15:05 +0200)]
Merge the different identifier contexts into one enum

2 years agoSplit namelike into the corresponding completion contexts
Lukas Wirth [Sat, 7 May 2022 12:16:03 +0000 (14:16 +0200)]
Split namelike into the corresponding completion contexts

2 years agoIntroduce NameRefContext
Lukas Wirth [Sat, 7 May 2022 11:46:43 +0000 (13:46 +0200)]
Introduce NameRefContext

2 years agoAuto merge of #12186 - Veykril:completion-rev, r=Veykril
bors [Sat, 7 May 2022 11:00:29 +0000 (11:00 +0000)]
Auto merge of #12186 - Veykril:completion-rev, r=Veykril

minor: Move inferred type completions

2 years agominor: Move inferred type completions
Lukas Wirth [Sat, 7 May 2022 10:59:26 +0000 (12:59 +0200)]
minor: Move inferred type completions

2 years agoAuto merge of #12185 - Veykril:parse-fix, r=Veykril
bors [Sat, 7 May 2022 10:53:37 +0000 (10:53 +0000)]
Auto merge of #12185 - Veykril:parse-fix, r=Veykril

fix: Remap float parts as integers when parsed as indices

cc https://github.com/rust-lang/rust-analyzer/pull/12149

2 years agofix: Remap float parts as integers when parsed as indices
Lukas Wirth [Sat, 7 May 2022 10:52:15 +0000 (12:52 +0200)]
fix: Remap float parts as integers when parsed as indices

2 years agoAuto merge of #12178 - jonas-schievink:fix-tt-conv-panic, r=jonas-schievink
bors [Fri, 6 May 2022 16:39:43 +0000 (16:39 +0000)]
Auto merge of #12178 - jonas-schievink:fix-tt-conv-panic, r=jonas-schievink

fix: Fix panic when a macro passes a float token to another macro

Fixes https://github.com/rust-lang/rust-analyzer/issues/12170 (num-traits no longer causes a panic)

2 years agoFix conversion of float literals in `TtTreeSink`
Jonas Schievink [Fri, 6 May 2022 16:29:43 +0000 (18:29 +0200)]
Fix conversion of float literals in `TtTreeSink`

2 years agoAuto merge of #12177 - jonas-schievink:mbe-output-float-literals, r=jonas-schievink
bors [Fri, 6 May 2022 14:12:29 +0000 (14:12 +0000)]
Auto merge of #12177 - jonas-schievink:mbe-output-float-literals, r=jonas-schievink

fix: fix macro expansion with float tokens

Fixes https://github.com/rust-lang/rust-analyzer/issues/12170

The parser tells us to consume up to 3 tokens, but on the MBE side all float literals are a single `tt::Literal`, so make sure to only consume a single MBE leaf.

2 years agoSkip only the `tt::Literal` when consuming float tokens
Jonas Schievink [Fri, 6 May 2022 14:10:54 +0000 (16:10 +0200)]
Skip only the `tt::Literal` when consuming float tokens

2 years agoAuto merge of #12175 - Veykril:completion-rev, r=Veykril
bors [Fri, 6 May 2022 13:45:12 +0000 (13:45 +0000)]
Auto merge of #12175 - Veykril:completion-rev, r=Veykril

fix: Fix snippets triggering where they shouldn't

Fixes https://github.com/rust-lang/rust-analyzer/issues/12169

2 years agofix: Fix snippets triggering where they shouldn't
Lukas Wirth [Fri, 6 May 2022 13:44:41 +0000 (15:44 +0200)]
fix: Fix snippets triggering where they shouldn't

2 years agoAuto merge of #12174 - Veykril:completion-rev, r=Veykril
bors [Fri, 6 May 2022 11:12:29 +0000 (11:12 +0000)]
Auto merge of #12174 - Veykril:completion-rev, r=Veykril

internal: Improve completion tests by checking that the offset is included in the source_range of items

2 years agointernal: Improve completion tests by checking that the offset is included in the...
Lukas Wirth [Fri, 6 May 2022 11:11:50 +0000 (13:11 +0200)]
internal: Improve completion tests by checking that the offset is included in the source_range of items

2 years agoAuto merge of #12171 - lnicola:proc-macros-dont-invalidate-state, r=Veykril
bors [Fri, 6 May 2022 10:14:05 +0000 (10:14 +0000)]
Auto merge of #12171 - lnicola:proc-macros-dont-invalidate-state, r=Veykril

fix: Try not to invalidate state when the proc macro preference didn't change

This appears to fix #12027, but I'm not sure.

2 years agoAuto merge of #12173 - Veykril:completion-rev, r=Veykril
bors [Fri, 6 May 2022 10:06:06 +0000 (10:06 +0000)]
Auto merge of #12173 - Veykril:completion-rev, r=Veykril

internal: completion PathKind is not optional

2 years agointernal: completion PathKind is not optional
Lukas Wirth [Fri, 6 May 2022 10:04:41 +0000 (12:04 +0200)]
internal: completion PathKind is not optional

2 years agoTry not to invalidate our state when the proc macro preference didn't change
Laurențiu Nicola [Fri, 6 May 2022 06:46:02 +0000 (09:46 +0300)]
Try not to invalidate our state when the proc macro preference didn't change

2 years agoAuto merge of #12168 - Veykril:completion-rev, r=Veykril
bors [Thu, 5 May 2022 20:22:30 +0000 (20:22 +0000)]
Auto merge of #12168 - Veykril:completion-rev, r=Veykril

internal: Remove unqualified_path completions module

2 years agointernal: Remove unqualified_path completions module
Lukas Wirth [Thu, 5 May 2022 20:21:42 +0000 (22:21 +0200)]
internal: Remove unqualified_path completions module

2 years agoAuto merge of #12149 - jonas-schievink:literally-just-a-literal, r=jonas-schievink
bors [Thu, 5 May 2022 15:35:10 +0000 (15:35 +0000)]
Auto merge of #12149 - jonas-schievink:literally-just-a-literal, r=jonas-schievink

fix: split float literal tokens at `.` to fix parsing of tuple field accesses

This introduces an `ast::FloatLiteral` node, changes the `FLOAT_LITERAL` token to `FLOAT_LITERAL_PART`, and splits any float literal at the `.` character, into a `FLOAT_LITERAL_PART`, and optional `DOT` and trailing `FLOAT_LITERAL_PART` token. The tokens are reassembled when passing them to a macro as a `tt::Literal`.

~~A slight regression is introduced in how float literals are highlighted: the `.` is now highlighted as an operator. I've tried to fix this but couldn't figure out how to highlight the whole `ast::FloatLiteral` node as a unit.~~ This is fixed

Fixes https://github.com/rust-lang/rust-analyzer/issues/1109
Fixes https://github.com/rust-lang/rust-analyzer/issues/10492
Fixes https://github.com/rust-lang/rust-analyzer/issues/12107
Fixes https://github.com/rust-lang/rust-analyzer/issues/10560
Fixes https://github.com/rust-lang/rust-analyzer/issues/11487

2 years agoFix rebase fallout
Jonas Schievink [Thu, 5 May 2022 14:35:07 +0000 (16:35 +0200)]
Fix rebase fallout

2 years agoMaybe everything else *should* have to deal with it
Jonas Schievink [Thu, 5 May 2022 14:26:16 +0000 (16:26 +0200)]
Maybe everything else *should* have to deal with it

2 years agoIndicate the number of float tokens in the first token
Jonas Schievink [Thu, 5 May 2022 14:06:44 +0000 (16:06 +0200)]
Indicate the number of float tokens in the first token

2 years agoWrap floats in token trees in `FLOAT_LITERAL` node
Jonas Schievink [Wed, 4 May 2022 17:25:32 +0000 (19:25 +0200)]
Wrap floats in token trees in `FLOAT_LITERAL` node

2 years agoAdd completion test
Jonas Schievink [Wed, 4 May 2022 15:10:53 +0000 (17:10 +0200)]
Add completion test

2 years agoAdd tests
Jonas Schievink [Wed, 4 May 2022 14:58:02 +0000 (16:58 +0200)]
Add tests

2 years agoSplit float literal tokens at the `.`
Jonas Schievink [Wed, 4 May 2022 14:51:05 +0000 (16:51 +0200)]
Split float literal tokens at the `.`

2 years agoWrap float literals in their own node
Jonas Schievink [Tue, 3 May 2022 17:56:10 +0000 (19:56 +0200)]
Wrap float literals in their own node

2 years agoRemove `ast::Literal::token`
Jonas Schievink [Tue, 3 May 2022 14:47:33 +0000 (16:47 +0200)]
Remove `ast::Literal::token`

2 years agoAuto merge of #12164 - Veykril:completion-rev, r=Veykril
bors [Thu, 5 May 2022 13:51:22 +0000 (13:51 +0000)]
Auto merge of #12164 - Veykril:completion-rev, r=Veykril

internal: Remove `unqualified_path` completions module

cc https://github.com/rust-lang/rust-analyzer/issues/12144

2 years agointernal: Remove unqualified_path completions module
Lukas Wirth [Thu, 5 May 2022 13:49:03 +0000 (15:49 +0200)]
internal: Remove unqualified_path completions module

2 years agoAuto merge of #12161 - Veykril:completion-rev, r=Veykril
bors [Thu, 5 May 2022 10:20:30 +0000 (10:20 +0000)]
Auto merge of #12161 - Veykril:completion-rev, r=Veykril

internal: Lift out item list path completions from (un)qualified_path

cc https://github.com/rust-lang/rust-analyzer/issues/12144

2 years agointernal: Lift out item list path completions from (un)qualified_path
Lukas Wirth [Thu, 5 May 2022 10:08:40 +0000 (12:08 +0200)]
internal: Lift out item list path completions from (un)qualified_path

2 years agoAuto merge of #12160 - Veykril:completions-rev, r=Veykril
bors [Thu, 5 May 2022 09:03:23 +0000 (09:03 +0000)]
Auto merge of #12160 - Veykril:completions-rev, r=Veykril

minor: Sort ide-completions test outputs for less disruptive diffs

2 years agominor: Sort ide-completions test outputs for less disruptive diffs
Lukas Wirth [Thu, 5 May 2022 08:49:43 +0000 (10:49 +0200)]
minor: Sort ide-completions test outputs for less disruptive diffs

2 years agoAuto merge of #12159 - Veykril:completions-rev, r=Veykril
bors [Thu, 5 May 2022 08:51:18 +0000 (08:51 +0000)]
Auto merge of #12159 - Veykril:completions-rev, r=Veykril

internal: Lift out macro bang property from completion PathKind enum

2 years agointernal: Lift out macro bang property from PathKind enum
Lukas Wirth [Thu, 5 May 2022 08:34:57 +0000 (10:34 +0200)]
internal: Lift out macro bang property from PathKind enum