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

Feature Request: add option to control VS Code hover copy behavior to copy string text value instead of JavaScript string representation #3362

Open
Starcounter-Jack opened this issue Apr 19, 2024 · 1 comment

Comments

@Starcounter-Jack
Copy link

Starcounter-Jack commented Apr 19, 2024

Wallaby 1.0.375
VS Code 1.88.1
MacOS 14.1.1

According to the screenshots in the wallaby documentation, this example of an inspected string value should yield a multiline string rather than a JS string literal.

Screenshot of Code at 19 Apr 2024 at 21_07_48

I.e. String are not represented correctly in the inspectors. Strings should be represented without escape sequences. If I press the copy button, my clipboard will receive the string in JS/JSON notation including the quotes and escape representations rather than the raw string. Is it possible to configure? As a long time wallabyjs user, I am quite sure I didn't use to have it like this.

@Starcounter-Jack Starcounter-Jack changed the title Strings are not represented correctly Strings are not represented correctly in inspectors Apr 19, 2024
@smcenlly
Copy link
Member

According to the screenshots in the wallaby documentation, this example of an inspected string value should yield a multiline string rather than a JS string literal.

This behavior is expected.

Wallaby has heuristics for displaying the string differently depending on its size.

Strings will always will represented with escape sequences (e.g. \n) regardless of the string length.

Shorter strings are displayed in a single line, while longer strings are separated across multiple lines when there is not enough horizontal real-estate. For example:

image

If I press the copy button, my clipboard will receive the string in JS/JSON notation including the quotes and escape representations rather than the raw string. Is it possible to configure? As a long time wallabyjs user, I am quite sure I didn't use to have it like this.

The actions displayed in the hover were added in July 2023. The copy button for the hover has always functioned like this. The behavior is different vs. when you use the Copy Value command, which you may have used in the past (before the hover action was available).

When you use the Copy Value command, the string will be copied to your clipboard without any escape characters.

When you use the copy action on the hover, the string will be copied to your clipboard as it is displayed (i.e. with the escape characters). This was an intentional design choice to make sure that what's being copied is what we are currently displaying.

Right now, we don't have an option to control the behavior of hover copy; we will repurpose this issue as a feature request for this.

@smcenlly smcenlly changed the title Strings are not represented correctly in inspectors Feature Request: add option to control VS Code hover copy behavior to copy string text value instead of JavaScript string representation Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants