1

I have my ruler settings in Sublime Text 3 and VS Code at 80. In my sublime image I separate my functions using "#---#" which is as wide as the 80 character ruler. When I open the same file in VS code the ruler is nowhere near the 80 character limit, its somewhere in the hundreds. Does anybody know what's going on?

Below is a screenshot from Sublime Text 3 enter image description here

Below is a screenshot from VS Code: enter image description here

Notice the different placement of the 80 character ruler.

Hiebs915
  • 666
  • 1
  • 7
  • 22

1 Answers1

4

It looks as though you're not using the same font in both cases, and in fact the font in Sublime is Fixed Width while the font in VSC is Proportional.

This is visible not only in the rulers, but in the code itself. For example, presuming it's the same file in both screen shots, the indent looks to be 4 characters in Sublime and 3 in VSC.

Both things are a symptom of a Proportional font; a font in which the width of each character is potentially distinct, unlike a Fixed Width font in which every character is the same width.

In a Fixed Width font, an X and a dash are the same width (for example), but in a Proportional font a dash is usually narrower (and a space much more so). As a result the ruler being at character position 80 doesn't line up with the actual character at position 80 because the text isn't long enough.

OdatNurd
  • 21,371
  • 3
  • 50
  • 68
  • I think you're right, the fonts between sublime and VS do look different (I like Sublime's more). Couple questions: 1.) Can I make VS code's font "Fixed Width" and make it the same as Sublime's? 2.) What is the purpose of the ruler in VS Code if it doesn't actually show the real character limits? – Hiebs915 Nov 06 '20 at 17:37
  • 1
    I don't use VSC, but I would imagine that it's font is indeed configurable as it is in Sublime. If you didn't try to set one yourself, it may be trying to use a default that you don't have and falling back to something else. Much like Sublime, VSC is a code editor so it presumes that you will used a fixed width font but still lets you use whatever you like (Sublime will also allow a proportional font and display the same "weirdness" for example). – OdatNurd Nov 06 '20 at 18:40
  • 1
    1) Font's are either fixed width or not, it's a choice made by the font's designer. Almost all fonts designed for coding are fixed width. Note that another name for a fixed width font is a monospaced font. Source Code Pro, Fira Code, and Inconsolata are all popular monospaced fonts that are free, download one or more of them from the web and install them on your computer or do a web search for "best programming fonts" and you'll find plenty of suggestions. To use a monospaced font in VS simply change the font to one you know is monospaced, do a web search to find out how to change the font. – mattst Nov 06 '20 at 19:13
  • 2) There is no point in using a ruler in a code editor unless you are also using a fixed width font. – mattst Nov 06 '20 at 19:13
  • I like the fixed-width and font from Sublime Text 3. I'll have to figure out if there's a way to get these in VS Code. – Hiebs915 Nov 06 '20 at 19:52
  • 1
    The default font for Sublime Text varies by platform. See [this answer](https://stackoverflow.com/a/25858722/1426065) I wrote some years ago that lists what the defaults are. – MattDMo Nov 06 '20 at 22:07
  • @MattDMo Thanks! I was able to get Consolas in VS code and it looks the same now, rulers also work. – Hiebs915 Nov 07 '20 at 15:57