Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically backtick symbols when renaming #2605

Merged
merged 1 commit into from
Mar 15, 2021

Conversation

tgodzik
Copy link
Contributor

@tgodzik tgodzik commented Mar 14, 2021

In cases where a symbol name is not valid we should automatically wrap it in backticks

@tgodzik tgodzik requested review from ckipp01 and dos65 March 14, 2021 22:10
@tgodzik tgodzik force-pushed the auto-backtick branch 2 times, most recently from 642f2d2 to 70c8f9c Compare March 15, 2021 11:26
@@ -288,7 +288,7 @@ class RenameLspSuite extends BaseRenameLspSuite("rename") {
| "" <<::>> user
|}
|""".stripMargin,
newName = "method:"
newName = "+++:"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was actually a wrongly named method - method: should be wrapped in backticks, which it started doing.

@tgodzik tgodzik force-pushed the auto-backtick branch 2 times, most recently from c069b84 to a717a39 Compare March 15, 2021 13:34
@@ -241,7 +231,7 @@ final class RenameProvider(
realName = rng.inString(semanticDb.text)
if occ.symbol == occurence.symbol &&
withoutBacktick(realName) == withoutBacktick(renameName)
} yield realLocationWithoutBackticks(realName, rng.toLSP)
} yield new Location(uri, rng.toLSP)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If new name is checked to have backticks then this is not needed.

@tgodzik tgodzik requested a review from ckipp01 March 15, 2021 14:57
In cases where a symbol name is not valid we should automatically wrap it in backticks
Copy link
Member

@ckipp01 ckipp01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@tgodzik tgodzik merged commit 3fd3cf5 into scalameta:main Mar 15, 2021
@tgodzik tgodzik deleted the auto-backtick branch March 15, 2021 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants