Introduce character escaping for "extract strings" code action
- Dominant language
- Python
- Stars
- 75
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
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\\"
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in yls/code_actions.py around line 38, where the extract-strings code action is implemented. Use the issue's quoted-string and backslash examples as test cases, and consider the work complete when extracted strings escape every double quote and backslash as shown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100