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

[C#] use standard unclosed-string behavior #867

Merged
merged 2 commits into from
Mar 31, 2017

Conversation

keith-hall
Copy link
Collaborator

This PR changes the unclosed string behavior in the C# syntax to match that of the other syntaxes, like Python, which scopes the new line character as invalid, which is less jarring than having the whole string appear as invalid.

@michaelblyons
Copy link
Collaborator

Great! I do not think this should get in the way of merging, but there are some rules about newlines in interpolation that we can work on at some point.

string good1 = $"bar { baz }";
string good2 = $@"bar { baz }";
string good3 = $@"bar {
    baz }";
string good4 = $@"bar {
    baz
    }";
string good5 = $@"bar
                { baz }";

string bad1 = $"bar {
    baz }"; // Interpolation must be single line without $@"..."

This would be pretty easy if you can with_prototype into an include instruction, but I suspect it's more likely that the string_interpolation construct will have to be broken up.

@keith-hall
Copy link
Collaborator Author

I've improved it a tiny bit, but something like string unclosed_interpolation = $"inner {new[] { 12, 24 won't be detected as invalid atm. I can't use with_prototype here because we hit this issue: sublimehq/sublime_text#1288

@michaelblyons
Copy link
Collaborator

Excellent, this is much more elegant than I had expected. =)

@wbond
Copy link
Member

wbond commented Mar 31, 2017

Thanks!

@wbond wbond merged commit d15cd7f into sublimehq:master Mar 31, 2017
@keith-hall keith-hall deleted the cs_string branch March 31, 2017 14:34
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.

3 participants