This repository was archived by the owner on Apr 14, 2022. It is now read-only.
File tree Expand file tree Collapse file tree
LanguageServer/Impl/Implementation Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -390,6 +390,19 @@ public void CommentAfterOperator() {
390390 AssertSingleLineFormat ( "a+# comment\n b" , "a + # comment" ) ;
391391 }
392392
393+ [ DataRow ( "'a''b'" , "'a' 'b'" ) ]
394+ [ DataRow ( "'a' 'b'" , "'a' 'b'" ) ]
395+ [ DataRow ( "'''a''''''b'''" , "'''a''' '''b'''" ) ]
396+ [ DataRow ( "'''a'''r'''b'''" , "'''a''' r'''b'''" ) ]
397+ [ DataRow ( "\" a\" \" b\" " , "\" a\" \" b\" " ) ]
398+ [ DataRow ( "\" a\" \" b\" " , "\" a\" \" b\" " ) ]
399+ [ DataRow ( "\" \" \" a\" \" \" \" \" \" b\" \" \" " , "\" \" \" a\" \" \" \" \" \" b\" \" \" " ) ]
400+ [ DataRow ( "\" \" \" a\" \" \" r\" \" \" b\" \" \" " , "\" \" \" a\" \" \" r\" \" \" b\" \" \" " ) ]
401+ [ DataTestMethod , Priority ( 0 ) ]
402+ public void StringConcat ( string code , string expected ) {
403+ AssertSingleLineFormat ( code , expected ) ;
404+ }
405+
393406
394407 [ TestMethod , Priority ( 0 ) ]
395408 public void GrammarFile ( ) {
Original file line number Diff line number Diff line change @@ -287,8 +287,15 @@ public TextEdit[] FormatLine(int line) {
287287 builder . EnsureEndsWithSpace ( ) ;
288288 break ;
289289
290- case TokenKind . Name :
291290 case TokenKind . Constant :
291+ if ( token . IsString && next != null && next . IsString ) {
292+ builder . Append ( token ) ;
293+ builder . EnsureEndsWithSpace ( ) ;
294+ break ;
295+ }
296+ goto case TokenKind . Name ;
297+
298+ case TokenKind . Name :
292299 case TokenKind . KeywordFalse :
293300 case TokenKind . KeywordTrue :
294301 case TokenKind . Ellipsis : // Ellipsis is a value
@@ -410,19 +417,9 @@ public bool MatchesClose(TokenExt other) {
410417
411418 public bool IsKeyword => ( Kind >= TokenKind . FirstKeyword && Kind <= TokenKind . LastKeyword ) || Kind == TokenKind . KeywordAsync || Kind == TokenKind . KeywordAwait ;
412419
413- public bool IsMultilineString {
414- get {
415- if ( Span . Start . Line == Span . End . Line ) {
416- return false ;
417- }
420+ public bool IsString => Kind == TokenKind . Constant && Token != Tokens . NoneToken && ( Token . Value is string || Token . Value is AsciiString ) ;
418421
419- if ( Kind != TokenKind . Constant || Token == Tokens . NoneToken ) {
420- return false ;
421- }
422-
423- return Token . Value is string || Token . Value is AsciiString ;
424- }
425- }
422+ public bool IsMultilineString => Span . Start . Line != Span . End . Line && IsString ;
426423
427424 public bool IsSimpleSliceToLeft {
428425 get {
You can’t perform that action at this time.
0 commit comments