Display larger indentation for files that are indented with just two spaces - visual-studio-code

I'm working on a project that is using 2 spaces as indentation.
I have a hard time reading code with such small indentation, so my question is:
Question: Can I make vscode show the two spaces as if they were wider (for example double the width)?
(I could of course solve it in a hackish way, by converting each file on checkout, and convert it back before i commit it, but that would be very tedious and error prone. I could also try to convince the project to convert the whole project to tabs, so that everyone can use their own preferred indentation. But I don't want to go into that discussion for every project I work on :) )

I have written the extension Indent Whitespace that decorates each space used in indentation with additional spaces (cursor will skip the decoration).
The decorated spaces are colored with a very transparent red.
With a setting you can change the number of spaces to add, default 1.
If you delete spaces with Delete it looks funny because the selection does not change, use the Arrow keys to update the decorations.
In a later version I will make the decoration color a setting, and also only update the decoration when the file changes (only important for large files, and fix the delete-update rendering).

I think you can't.
There is no such setting in VS Code. As of version 1.13, you can change the kerning, but this changes the spacing between all characters. You cannot do this only for a single character (or a set of characters).
The space width is a property of the font. Microsoft has a guideline that defines what is the ideal space size for a font. But this does not mean you cannot change it yourself when designing one. So I created a version of Roboto Mono which space character is 4x the original one.
This works on Notepad and MS Word, we can see the space is quite big. However, using the exact same font in VS Code, the space is still small, independently of the font being monospaced or not.
Illustration
Somehow, it looks like VS Code ignores space size in the font and decides by itself what is the best value.

Related

How to remove this gray line that causes text to wrap in VS Code?

I've recently noticed that when typing out long lines of code, they split into multiple lines after this threshold and it bothers me. enter image description here
Not sure if it was a formatting extension that I put on here years ago, but I couldn't seem to locate it in the settings.
The grey line isn't what causes the wrapping. You can apply settings to have the grey line and not have wrapping. They grey line is displayed according to the editor.ruler setting.
In general text editor terminology, this wrapping you are observing is called "soft wrapping" (when an editor wraps long lines in its rendering of the text, but doesn't actually insert line-break characters, which is called "hard wrapping").
By default, soft-wrapping can be toggled by Alt+z (The command palette command is named View: Toggle Word Wrap).
The default setting of soft wrapping for VS Code is configurable by the editor.wordWrap setting. It has several values it can take on:
"bounded": lines wrap at the minimum of viewport width and editor.wordWrapColumn,
"off": Lines will never wrap
"on": Lines will wrap at the viewport width
"wordWrapColumn": Lines will wrap at editor.wordWrapColumn
The word wrap column is configurable by the editor.wordWrapColumn setting. See also the editor.wrappingIndent and wrappingStrategy settings.
This is a setting called rulers. Go into Settings and search "rulers". Then you will be able to edit the settings.json file. Under "editor.rulers" remove all values in the array so that it is empty. That should solve it.

Fillable Pdf multi-line, Allow rich text formatting in Acrobat Pro DC: but it ignores line spacing/leading set in More

I'm on Win10, using Acrobat Pro DC 2021.011... to edit and Reader DC (same version) to test.
From experience and from reading forums etc, forms in these apps are maddening... but I have not been able to find any discussion (or solutions) to the following behavior...
The form I'm building for other employees' use has a large edit text box set to Multi-line and Allow Rich Text Formatting. It is set to a default font, Calibri and size 50pt. For most situations this will work for them; provides 2-3 lines for a short product description. But occasionally they want a smaller font and more lines... They know how to get the ctrl+e properties bar. But in my testing of this alternative situation they'll need sometimes, I'm finding it's impossible to get the smaller font size and more lines to work. Here's my process.
tab into text box. Ctrl+E for properties bar.
before typing I set the font size to 24
then I type in my 4 lines of text
then I tab to my next form field...
and kaboom... the field I just filled...it's line height is so large it's pushed some of the content invisible. I assume this is coming from the field's default font size, 50
And if I try to adjust the line height, by selecting all the text and then choosing in More...>Form Field Text Properties>Paragraph>Line Spacing
If I set it to Single and click Close/click into another field I get the very large leading (presumably for 50pt font (same as pic above after point 5)
If I choose Exactly and set to point size slightly larger, click Close/out of field, I get another ridiculous result where the 2/3 line have the height I set, but the space between the 1 & 2 second line is way too much and the space between the last line and 3rd line is way too small...
before tabbing or clicking out of field to another field
Good lord.. what is that! 3 different leading values in the same field; just after applying 1 value to all lines, all text in the field...
It makes no sense... it doesn't look like it regards your input at all, and just comes up with it's own random leading... I've fiddled with Space before/after and combinations of Line Height and nothing comes close to what we need... At this point I'm convinced the Acrobat tools for a stylizing text in a multi-line, allow formatting text field are useless. I'd be better off with my employees they can't format anything, ever. Just type one line and hit Tab or Enter...
What is going on! I'm trying to make a simple fillable form for other employees to use, but this kind of behavior makes that impossible (It's enough of a stretch to teach them to use the ctrl+E and do some styling of their text but this is bonkers and completely unteachable... there's not rhyme or pattern to teach!)
Hope someone can help or has seen this behavior too.

Tab stops are messed up after rarer unicode characters

In vscode, when I open a file containing unicode characters,
I notice that tabs do not always advance to the next tab stop.
For example, the following might be part of an ASCII-flavor table
a<tab>b<tab>c<tab>d<tab>e
α<tab>β<tab>γ<tab>δ<tab>ε
𝔸<tab>𝔹<tab>ℂ<tab>𝔻<tab>𝔼
While sublime text renders it correctly(IMO)
vscdoe has a different idea
As I understand it, vscode renders a tab by
replacing it with a proper number of space characters.
So if there are characters showing using proportional fonts,
no integer number of spaces will make it to the proper stop.
(See this related issue.)
So my question is, how can I fix this?
Is it possible to tell vscode that
"Fine, if you were to assume that those unicode characters
are 2 spaces wide when tabbing,
would you please render them as 2 spaces wide?"

Make spaces act and look like tabs in VS Code

When writing a source file in VS Code that is styled with spaces of a specific width (maybe determined by the .editorconfig file), how can I force VS Code to treat the spaces like tabs without reformatting the file?
For example, the indent width may be 4 spaces, so rather than displaying 4 spaces in my editor, I'd rather see one tab space character with a width of 4 spaces.
The selection aspect of space-tabulated code is supported with VSCode 1.52 (Nov. 2020) and:
Sticky Tab Stops when indenting with Spaces
If you prefer to indent your code with spaces, there is a new setting called editor.stickyTabStops, which makes VS Code treat cursor movements in leading spaces similar to tabs.
Appearance
You said vscode is:
displaying 4 spaces in my editor
I assume that means you're getting those little Interpunct dot characters coming up like this ····
If you want those to go away, so they appear more consistent with tabs, go into VScode settings (JSON) and enter the following:
"editor.renderWhitespace": "selection"
Assuming everything else is default, both tabs and spaces should be rendered as regular whitespace. But that alone it doesn't really help, because it doesn't allow you to distinguish nested structures i.e. you can't tell how many levels of indentation you're at.
To fix that, there's 2 things.
(minimum) Set indent guides explicitly in your user settings, this will render vertical lines at each indentation level, no matter if the file is using tabs or spaces:
"editor.renderIndentGuides": true
(optional extra) If you want to take it further, there are a few extensions you can try, but the one i recommend is indent-rainbow. There are lots of options for it, but i have mine config'd so after a certain level of indentation it becomes more obnoxious, because i treat it as a code smell i.e. i like to minimize how much i nest if possible.
The end result of doing all this is that tabs and spaces are rendered exactly the same way, and you can't tell the difference unless you have part of your code highlighted:
Behavior
To make the behavior of indentation more consistent, the following should be in your settings if it's not already applied by default:
"editor.detectIndentation": true,
"editor.insertSpaces": true,
"editor.useTabStops": true
As for this:
source file in VS Code that is styled with spaces of a specific width (maybe determined by the .editorconfig file)
I don't think this is possible, or at least not natively. You may be able to find/write an extension that can do detection based on tabsize since there is in fact a property called:
"editor.tabSize": 4,
Not sure if this will help, but you can do selective setting overrides based on filetype, for example:
"[yaml]": {
"editor.insertSpaces": true,
"editor.tabSize": 2,
"editor.autoIndent": "advanced"
}

How to insert keyboard key graphic representations into your document?

I'm working on a document describing keyboard shortcuts in GNOME and want to make text better looking than: ALT + TAB. A common way seems to be like in this thread where the buttons appear to be within the text:
https://unix.stackexchange.com/q/465681
Is this possible in LibreOffice in a proper way, or is it just inserting images inline? That doesn't seem like it would work every well with changing font size, etc. later, so I was hoping for a better solution.
You could insert real push buttons that don't do anything by following steps 1 thru 6 outlined at https://help.libreoffice.org/Common/Inserting_and_Editing_Buttons. But that approach, as well as inserting inline images, would be awkward because you'd have to worry at least about sizing, anchoring, and wrapping of surrounding text.
The approach you appear to be trying to avoid seems much more palatable, so long as you're not looking to exactly duplicate to Stack Exchange look.
As an example to demonstrate that it's workable, I did the following by applying the same Character formatting settings to each key word. This involved changing font family and size, setting light gray highlighting, adding a gray border, and changing left and right border padding from 0.02 to 0.06...
To make things easy, the settings could all be done with a single button press by creating a macro that could be applied to selected text. And since the result is just formatted text, there are no sizing, anchoring, or text wrapping issues to worry about.
One other option, as an alternative to significant text formatting, is to acquire and use a keyboard font, such as that discussed at How is the Keyboard font automatically styled as keyboard-like keys for the letters in Alt, Shift, Ctrl, Esc, and Backspace?. That would only require changing to that font to type in key representations.