Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MatejKastak opened this issue Oct 18, 2022 · 0 comments
Open

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

MatejKastak opened this issue Oct 18, 2022 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@MatejKastak
Copy link
Member

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\\"
@MatejKastak MatejKastak added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed labels Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Development

No branches or pull requests

1 participant