Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

VSCode adding a ruler for python files but not C files. Why?

I’m tring to add custom rulers for C and python files in vscode. Here is my settings.json file

{
    "C_Cpp.updateChannel": "Insiders",
    "editor.inlineSuggest.enabled": true,
    "security.workspace.trust.untrustedFiles": "open",
    "python.defaultInterpreterPath": "C:\\Path\\to\\my\\python.exe",
    "python.formatting.provider": "black",
    "[C_Cpp]": {
        "editor.rulers": [
            80
        ],
    },
    "editor.formatOnSave": true,
    "[python]": {
        "editor.defaultFormatter": "ms-python.black-formatter",
        "editor.rulers": [
            88
        ],
    },
}

Here’s my main.cpp file

#include <iostream>

int main()
{
    return 0;
}

Rulers correctly show up for .py files but .c .C .cpp .Cpp files don’t show the expected ruler.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Try with:

"[cpp]": {
        "editor.rulers": [
            80
        ],
    },

I guess it overrides the config for a language, and not an extension, as when you put the cursor on the word, the following popup appears:enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading