29

I wish to set the following rulers only when viewing *.py files. Is that possible?

{ "editor.rulers": [72, 79] } 

2 Answers 2

57

As of version 1.9, Language specific settings was introduced. This means that you can now use the following configuration to achieve what you want:

"[python]": { "editor.rulers": [72, 79] } 
Sign up to request clarification or add additional context in comments.

3 Comments

How do you set a default to be used if the file type is not of the type specified?
@joe_04_04 I would assume one simply adds "editor.rulers": [72, 79] to settings.json, not inside a language-specific tag.
To get the correct language to put in [<language>], use VS Code's Preferences: Configure Language Specific Settings command and then select the language from the dropdown.
2

It looks they have recently added support to have different settings for notebooks. Adding the following to my settings.json has done the trick of adding the rulers to my .py files, but removing them from .ipynb, for example.

"[python]": { "editor.rulers": [79, 120] }, "notebook.editorOptionsCustomizations":{ "editor.rulers": [] } 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.