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

Select word w/o copying it #11

Closed
wasker opened this issue Mar 10, 2020 · 9 comments
Closed

Select word w/o copying it #11

wasker opened this issue Mar 10, 2020 · 9 comments
Labels

Comments

@wasker
Copy link

wasker commented Mar 10, 2020

That'd be great to be able to just select the word, without copying it.

@alefragnani
Copy link
Owner

Hi @wasker ,

Do you know the native Add Selection to Next Find Match command does exactly this?

Just hit Cmd + D (on Mac) / Ctrl + D (on Win/Linux) and it will select the word in the cursor position. BTW, if you hit the same command again and again, it will select the other occurrences of the same word.

Hope this helps

@wasker
Copy link
Author

wasker commented Mar 10, 2020

I would never know by the name of it... Thanks for pointing me there!

@alefragnani
Copy link
Owner

Me neither, but this keyboard shortcut was one of the first productivity features I’ve learned in VSCode, so I use it a lot 😁 .

@wasker
Copy link
Author

wasker commented Mar 10, 2020

I wonder if you'd reconsider reopening this issue. Ctrl-D is better than nothing, but it doesn't behave like Ctrl-Shift-W in Visual Studio 2019. :( It doesn't really select words, and it looks like behavior in general depends on the language in the editor. E.g., if I Ctrl-D on "workbench" in the file below, the whole string with double-quotes gets selected. And this behavior is a bit different in e.g. if PowerShell script is opened in the editor.

{ "key": "ctrl+shift+s",       "command": "workbench.action.files.saveAll" }

@wasker
Copy link
Author

wasker commented Mar 10, 2020

Also, sorry to bug you - it's just you're the person who already has extension for operations on words, and simple word selection seem to be logical to have there too. :)

@alefragnani
Copy link
Owner

No problem, you are not bugging me 😁 .

I'm not familiar with VS2019, so I don't know how it works. I made a search and found this documentation, which says different things about the commands. Maybe you used a different release or has some plugin installed.

Command Shortcut
Edit.SelectCurrentWord Ctrl + W
File.ViewInBrowser Ctrl + Shift + W

Also, my extension has the same selection behaviour as Ctrl + D, while copying/cutting the example you provided, so it will not work for you either.

What you need, in fact, is a new Select Word algorithm (probably extracted from VS2019), which appears to recognise only letters, numbers and underscore as valid word characters. Maybe a few other symbols/combinations...

Hope this helps

@alefragnani
Copy link
Owner

alefragnani commented Mar 11, 2020

It appears your request has also been made in VS Code itself. I think these issues can help a bit more, using the wordSeparator setting...

@wasker
Copy link
Author

wasker commented Mar 18, 2020

Thanks for the pointers!

I was referring to Edit.SelectCurrentWord behavior. It does look like VSCode needs to have separate functionality. I'll file an issue there.

@wasker
Copy link
Author

wasker commented Apr 9, 2020

Available for all in 1.44.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants