Copy/Print auto-generated editor text?

Answered

For named parameters, the editor adds the name in light grey letters even though it's not part of the language. Similarly, for Dart, the editor can add closing labels as comments, but it doesn't add these to the files. So when I copy/paste the code, these labels don't appear in the pasted version. Is there a way that I can copy the code so that this additional text can be pasted elsewhere?

3 comments
Comment actions Permalink

There is no way to do that at the moment, request is welcome at https://youtrack.jetbrains.com/issues/IDEA. Please describe the use case in the ticket. IDE can add editor hints, should they also be copied? Note that such code will not compile if you paste is somewhere.

0
Comment actions Permalink

I'll submit a request. Also, in Dart, I'm looking at the Editor->Code Style options. Is there a way to set it so that I don't get two closing parentheses on the same line as in

drawer: Drawer(
child: Center(child: Text("I'm a drawer.")),
)), // Drawer, Scaffold

as opposed to what I want which is this...

drawer: Drawer(
child: Center(child: Text("I'm a drawer.")),
), // Drawer
), // Scaffold

To be clear, I don't want closing parens to always appear on the next line. For example, I don't want

print("Hello")

to become

print("Hello"
)

Thanks
0
Comment actions Permalink

Do you have [✔] Use the dartfmt tool when formatting the whole file enabled in Settings | Editor | Code style | Dart? When it's enabled (and it's ON by default), IDEA ignores its own code style preferences and uses dartfmt tool from Dart SDK.

Dart language authors believe that there is only one correct way to format Dart apps, so other options are there for historical reasons only, they will be removed in next versions. If you think that the official Dart code style has to be changed, please file a request to Google, https://github.com/dart-lang/dart_style/issues

0

Please sign in to leave a comment.