- Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Closed
Copy link
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work onarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-refactoringIssues with analysis server refactoringsIssues with analysis server refactoringstype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
Say I have this file:
void main() { bar('whatnot', ''' 0 indents 2 indents 0 indents '''); } void bar(_, String bar) { print(bar); }
it will print
0 indents 2 indents 0 indents
If I then ask - via VSCode in this instance - to extract method for the bar call I end up with
void main() { newMethod(); } void newMethod() { bar('whatnot', ''' 0 indents 2 indents 0 indents '''); } void bar(_, String bar) { print(bar); }
which will print
0 indents 2 indents 0 indents
which is different.
Having recorded the communication via Dart: Capture Analysis Server Logs
I extracted this:
[Analyzer] [Info] <== {"id":3039,"jsonrpc":"2.0","method":"workspace/applyEdit","params":{"edit":{"documentChanges":[{"edits":[{"newText":"newMethod();","range":{"end":{"character":5,"line":5},"start":{"character":2,"line":1}}},{"newText":"\n\nvoid newMethod() {\n bar('whatnot', '''\n 0 indents\n 2 indents\n 0 indents\n ''');\n}","range":{"end":{"character":1,"line":6},"start":{"character":1,"line":6}}}],"textDocument":{"uri":"file:///bath/to/file.dart","version":308}}]},"label":"Perform Refactor"}}
the important part of which seems to be
"\n\nvoid newMethod() {\n bar('whatnot', '''\n 0 indents\n 2 indents\n 0 indents\n ''
which has the inserted spaces, so I'm guessing this is an analyser (server?) bug.
Metadata
Metadata
Assignees
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work onarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-refactoringIssues with analysis server refactoringsIssues with analysis server refactoringstype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)