question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add IDExxx rule for converting multiline string to raw string

See original GitHub issue

Currently there is only “Convert to raw string” code refactoring with fix-all support (weird. How can a refactoring has fix all? I doesn’t fix anything). Using this fix-all is not much helpful as it converts all strings to raw form, even simple single-line onse, e.g. "a" -> """a""". It would be a lot more helpful if there is an IDExxx rule for converting only multiline strings to raw form, .e.g

@"First line
Second line
"

to

"""
First line
Second line
"""

Such rule should check for language version and probably be suggestion by default.

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
DoctorKroliccommented, Nov 14, 2022

lots of refactorings could be converted to analyzer/codefix

I don’t suggest to convert this refactoring to codefix entirely. My proposal is to leave refactoring for singleline strings (probably without fix all as it would probably have very limited scope of usages) and make IDExxx rule only for multiline cases

0reactions
CyrusNajmabadicommented, Nov 14, 2022

Refactoring doesn’t fix anything, so it cannot have fix all scopes)

Sure it can. It’s the scopes that the code fixup is applied to. ‘fix’ doesn’t mean “broken”. It’s akin to “fixing lunch” 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiline String to raw string Python
I have a multiline string. I need to convert that string to raw string without using r' ' while declaring the variable. My...
Read more >
Multiline string literal tips and tricks
A few features that make Swift's multiline string literals really useful. ... You can use it to: - Convert images into animations.
Read more >
C# 11.0 new features: raw string literals
C# 11.0 adds various improvements to string literals. In this post, Ian explains how raw string literals can make your code more readable....
Read more >
Raw string literals
The following rules govern the interpretation of a multi-line raw string literal: Both opening and closing quote characters must be on their own ......
Read more >
Raw Strings, UTF-8 Strings, and Multiline Interpolations
This second post will walk you through raw strings, multiline string interpolation, and the new UTF-8 string literals.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found