Skip to content

Introduce character escaping for "extract strings" code action #25

@MatejKastak

Description

@MatejKastak

Related to this feature https://github.com/avast/yls/blob/master/yls/code_actions.py#L38

When extracting strings we don't check/convert the string if it contains characters that needs escaping.

Thinking about this and after discussion with users, we should treat the input strings as un-escaped by default. This means that every " should be changed to \" and also for every \ we should add another one \\.

Some examples (good test cases):

this "is" a test   -> $s00 = "this\"is\" a test"
"this "is" a test" -> $s00 = "this\"is\" a test"
test\              -> $s00 = "test\\"
C:\\Program\       -> $s00 = "C:\\\\Program\\"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions