alefragnani / vscode-copy-word

Copy Word Extension for Visual Studio Code
MIT License
11 stars 4 forks source link

Copy words with hyphen "-" #22

Open LeninZapata opened 3 years ago

LeninZapata commented 3 years ago

Hello, when I put the cursor and press CONTROL+C it copies the whole word without highlighting it which is very good because it saves time, but now I need it to also copy words that have Example script

<div class="my_name" .... > // this works fine

but

<div class="my-name" ..... > // here I don't copy the entire class name, it just copies 'my' or 'name', but I need it to copy 'my-name'

I hope you have been able to explain me well

alefragnani commented 3 years ago

Hi @LeninZapata ,

The extension’s idea is to select words, and to do so, it uses the document.getWordRangeAtPosition API (from VS Code) to determine the word to be copied. That’s why it only copies my or name, because - is recognized as a word separator, like., spaces and so on.

I agree that sometimes it should copy the compound word or the expression inside quotes (I miss those sometimes). So yes, I guess it could be added, but not by default. Probably enabled via setting.

Thanks for the suggestion

LeninZapata commented 3 years ago

Yes, to copy the compound word separated by a hyphen "-" inside single or double quotes, with this one would save pointing to the text and using the mouse less.

I will be waiting for this feature