Skip to content
rhinopotamus edited this page Jul 10, 2023 · 1 revision

This is a very informal page with some vscode notes.

Syntax highlighting in sage files

sage code is basically python, but with a bunch of extra methods and functions and such. Here's how to get syntax highlighting to work correctly in .sage files.

In your vscode settings.json (does the web codespaces version have this?), you should say:

    "files.associations": {
        "*.sage": "python"
    }

This tells vscode that .sage files are actually python, basically, and therefore that they can be read correctly by the python linter / highlighter.

Then at the top of every generator.sage file, you should say these magic words: from sage.all import *. This allows the linter to know the names of sage default methods etc.

Clone this wiki locally