-
Notifications
You must be signed in to change notification settings - Fork 383
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
String interpolation #614
String interpolation #614
Conversation
…on {{ parse failure
Also reminding myself I need a should have a test for something like f`` within an interpolation expression |
Without changing anything about Autocomplete.cpp, this test passed, and properly didn't pass when I put TEST_CASE_FIXTURE(ACFixture, "autocomplete_interpolated_string")
{
check(R"(f(`expression = {@1}`))");
auto ac = autocomplete('1');
CHECK(ac.entryMap.count("table"));
CHECK_EQ(ac.context, AutocompleteContext::Expression);
} Not sure why immediately. Do I also need to handle making sure that pressing one backtick creates the other? |
Ah, my bad. It worked out for free in our case, because autocomplete will look up for the best scope given a location in the document, which is what happened in the test above.
I don't think so, this sounds like a script editor feature. I don't think there's any extra special behavior we'd want autocompleter to do here, so if it works let's call it a day for that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. This is fantastic work!
Co-authored-by: Alexander McCord <11488393+alexmccord@users.noreply.github.com>
Thanks for working through this! Just a heads up that I submitted a couple commits to this PR to make it merge-ready, most significantly outlawing the function calls without parentheses yet again - this will be added back to the RFC: #648. We may add this in the future but there are some exciting possibilities for how string interpolation interacts with DSLs and I'd like to keep this road open even if we end up not taking it for now. No action necessary since I've updated both the RFC and this PR accordingly, but third party implementations like full-moon may need to get updated. |
Doesn't look like there's anything I filed left :) |
Implements the string interpolation RFC (#165).
TODOs are commented as "INTERP TODO:", things I want highlighted in code review as "INTERP CODE REVIEW:"
This is going to diverge from RFC a bit in making
{{
a syntax error, as you never want to format a table you just created, and it is likely to be a common error from those coming from Rust or Python when escaping braces.Big TODOs:
%*
string.format specifier)string
f`x`