Skip to content

fix: consider relative offset to fake ident token in expansion for completion#14043

Merged
bors merged 2 commits intorust-lang:masterfrom
lowr:fix/completion-within-str-that-changed
Feb 5, 2023
Merged

fix: consider relative offset to fake ident token in expansion for completion#14043
bors merged 2 commits intorust-lang:masterfrom
lowr:fix/completion-within-str-that-changed

Conversation

@lowr
Copy link
Contributor

@lowr lowr commented Jan 28, 2023

Fixes #13836

When we check if the offset of fake ident token is out of bounds in the "actual expansion" (i.e. expansion without the fake ident token), we should take relative offset to it into account to match how we'd get token after expansion.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 28, 2023
@lowr
Copy link
Contributor Author

lowr commented Jan 28, 2023

We need a proc macro that changes the length of a token and keeps its span to write a test for this. Is it worth adding another in-memory proc macro for tests?

(I did test manually and confirmed the original issue resolves with this patch.)

@Veykril
Copy link
Member

Veykril commented Jan 28, 2023

Adding a proc-macro for this sounds good, proc-macros swapping out tokens/modifying tokens sounds like a good thing to have for tests
@bors delegate+

@bors
Copy link
Contributor

bors commented Jan 28, 2023

✌️ @lowr can now approve this pull request

@lowr lowr added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 3, 2023
@lowr lowr force-pushed the fix/completion-within-str-that-changed branch from dcffbd4 to a4d0b5c Compare February 5, 2023 13:28
@lowr
Copy link
Contributor Author

lowr commented Feb 5, 2023

Rebased, added a super contrived proc macro for test and 2 tests that would cause panic without this PR.

@bors r=Veykril

@bors
Copy link
Contributor

bors commented Feb 5, 2023

📌 Commit a4d0b5c has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Feb 5, 2023

⌛ Testing commit a4d0b5c with merge 0b32b65...

@bors
Copy link
Contributor

bors commented Feb 5, 2023

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 0b32b65 to master...

@bors bors merged commit 0b32b65 into rust-lang:master Feb 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

textDocument/completion failure with indoc literal

4 participants