vs code expand selection doesn't respect word separators setting - visual-studio-code

When I run the command "Expand Selection" with my cursor in a kebab-case-word-like-this, I want it to select the whole word including the dashes, but it breaks at the dash, even though my configured "Editor: Word Separators" (editor.wordSeparators) does not include dash (it's unchanged from the default). Any way to make it select the entire thing on the first expansion? Kebab case is the convention for clojure and this glitch makes it really tedious. It seems that deleteWordLeft and deleteWordRight also don't respect editor.wordSeparators.

Related

Visual Studio Code configure word break for text editor navigation

We tend to use kebab case for our naming in our FE app, but the ctrl arrow key navigation considers a dash a word break. Is there anyway to configure vscode so that ctrl + right/left behaves the same for both FooBar and foo-bar, i.e. considers both an entire word.
vscode has native support for altering word breaks using the editor.wordSeparators setting.
Characters that will be used as word separators when doing word related navigations or operations
Defaults to: ~!##$%^&*()-=+[{]}\\|;:'\",.<>/?
You can simply remove the -:
"editor.wordSeparators": "`~!##$%^&*()=+[{]}\\|;:'\",.<>/?",
Note: If you are using cursorWordPartRight keybind to navigate words partially, this setting will overrule it, meaning, you won't be able to step through the word partially (at that character), as the name implies.

VSCode will copy full line when only a word is selected (single click)

I'm on OSX and running Version 1.42.0 of Visual Studio Code. I have noticed that when I single click a word it will highlight. But if I copy CMD + c and then paste CMD+v, the full line will be in the clipboard. This causes problems from time to time, when the screen has given me every indication that I have only selected a single word. Is there some setting that I can set that will make the default behavior to select a word on a single quote and never ghost select a full line?
What it looks like when I single click a word:
And what it looks like after I've copied and pasted:
After filing an issue, it turns out that this behavior is by design.
The word the cursor is on (from a single click) is highlighted along with every occurrence of that word. The word is not selected (that would be a deeper blue).
By default copying without a selection copies the current line.
This in my opinion is an Accessibility issue, as there are strong visual clues that a word is selected. I have found that the behavior can be made more intuitive if you set these to settings.
// Controls whether copying without a selection copies the current line.
"editor.emptySelectionClipboard": false,
// Controls whether the editor should highlight semantic symbol occurrences.
"editor.occurrencesHighlight": false
With these two settings the word the cursor is on will not be highlighted (nor any other occurrences of that word). And if you do happen to copy, with an empty selection, the editor will behave similar to how other applications behave and not copy the current line.

How to make VS Code's "Move Line Up" (or down) feature auto-apply appropriate indentation like Atom?

Let's say I have some xml like this:
<foo>
<bar>
Bad indentation here
</bar>
</foo>
You might not be able to tell, but the bad line is indented with tabs (3 of them), whereas the other lines are indented with spaces (3 of them). Frankly, that part doesn't matter -- just understand that the bad line has an inappropriate/inconsistent amount of indentation for this type of code (per my tab-stop settings).
In atom, if I use the move-line feature to move the bad line up and then back down, the indentation gets fixed -- it will change from tabs to the appropriate amount of spaces. (Or if it was already spaces, but just not the right amount per my tabstop settings, then that would have been fixed.)
How can I create a action + key-binding to make VS Code do this too?
In VS Code, extensions provide the necessary per-language logic to do document formatting and for better or worse, VS Code doesn't currently come with an XML formatter extension.
To resolve this:
Make sure the Language Mode (bottom right) is set appropriately (in this case, to XML)
Select the Format Document command from the palette
You should get a popup saying There is no formatter for 'xml-files' installed. (or something else, if you weren't dealing with XML)
Click the "Install Formatter..." button in the popup
Install something near the top with a decent star-rating and a lot of downloads (for XML, the "XML" extension by Red Hat would be a great choice)
Now that you have that, you can go back to your document. Make sure the tab-type and tab-size settings are appropriate. Once you've done that, the standard Move Line Up / Move Line Down commands should reformat indentation as expected.

Customize Expand Selection

Is the behavior of Expand/Collapse Selection customizable? I want quotes to not be selected with an expansion. Also want to use other delimiters like periods, etc.
If a file isn't saved yet Expanding doesn't stop at quotes, but instead selects the entire line. Is this how Expansion is supposed to work with unsaved files?
I doubt the "Expand Select" command is customizable. Shift-Alt-RightArrow It is what it is.
However there is a nice extension that may act the way you want. Look at Expand Region. It will progressively expand or contract the region selected. If within a quoted portion, the first expansion will not select the quotes. It expands by region though, i.e., like scope. So it will not necessarily expand only to the end of the current line if that is what you are looking for.

MS Word Hidden Formatting Marks

There is a problem with the formatting of certain .docx files. I click to show the hidden formatting marks. There are degree symbols ("non-breaking spaces") in between many of the words, instead of a regular space.
To solve the problem: I copy and paste the degree symbol, and then I use the "find and replace" function to replace the degree symbols with a regular space.
How do I prevent this problem from occurring in the first place?
Or, how can I automatically convert these symbols to a regular space.
Non-breaking spaces are used to keep words from breaking across lines.
As Cindy stated above, the simplest way to remove them manually is to record a macro and execute this from a Ribbon button or the Quick Access Toolbar.
According to this link (and this link it refers to), nonbreaking spaces are inserted automatically if your proofing language is set to French and you type certain characters. To prevent this from happening, you have to either use a different proofing language or disable the "Replace straight quotes with smart quotes" option. To do this, see below (and I'm quoting the previous link):
To change the proofing language, select the text and click Language on
the Review tab. In addition to choosing another language, it's a good
idea to uncheck the option to automatically detect the language.
To change the quotes replacement, click File > Options > Proofing >
AutoCorrect Options, choose the AutoFormat As You Type tab of the
dialog (not just AutoFormat), and uncheck the first option.