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

Fix string interpolation autocomplete and location #748

Merged

Conversation

Kampfkarren
Copy link
Contributor

String interpolation autocomplete was not working and was just using default autocomplete. This fixes it so that inside a string it is treated as normal, and inside an expression it suggests expression level autocomplete.

Also fixes the range, which was previously just the first lexeme.

@Kampfkarren
Copy link
Contributor Author

One thing I want to test first is that something like collectgarbage(`"a" {"b"}@1 doesn't suggest "count", since it is the beginning of another section, and might be treated independently.

@Kampfkarren Kampfkarren marked this pull request as draft November 15, 2022 21:16
@Kampfkarren Kampfkarren marked this pull request as ready for review November 15, 2022 21:50
@@ -2706,14 +2728,18 @@ AstExpr* Parser::parseInterpString()
break;
case Lexeme::BrokenInterpDoubleBrace:
nextLexeme();
return reportExprError(location, {}, ERROR_INVALID_INTERP_DOUBLE_BRACE);
return reportExprError(endLocation, {}, ERROR_INVALID_INTERP_DOUBLE_BRACE);
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: note for some future clean-up PR, constant should have been a static const char* kErrorInvalidInterpDoubleBrace = ; instead of a define.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For whatever reason, that didn't work when I tried it.

https://github.com/Roblox/luau/pull/614/files#r931152226

Copy link
Collaborator

Choose a reason for hiding this comment

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

Another work-around would be reportExprError(endLocation, {}, "%s", kErrorInvalidInterpDoubleBrace); but doesn't matter any more.

@Kampfkarren
Copy link
Contributor Author

Should be ready for merge 🙂

@vegorov-rbx vegorov-rbx merged commit aa7c645 into luau-lang:master Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants