Adding custom file types in Pulsar IDE

Unrecognized file types are treated as plain text in Pulsar. I followed these steps to add a custom file type, so syntax highlighting etc. works.

The problem:
In Sphinx, it is possible to use Jinja 2 templates for CSS and HTML. These file types have css_t and html_t extensions respectively.

For example, here is a sample CSS template: custom.css_t:

Static CSS template - custom.css_t

This file includes some Jinja 2 specific variables and syntax, but otherwise is valid CSS.

When the file is opened in Pulsar, it is treated as plain text and therefore has no syntax highlighting, as it does not recognize the .css_t file type.

To fix this, you can configure Pulsar to treat .css_t as a .css file. Follow the steps below.

Open custom.css_t (or any file with that extension) in Pulsar. In the status bar, click on the file type that is detected i.e. Plain Text in this case:

Click on Plain Text in Pulsar status bar

In the dialog that opens, search for the desired file type. Since I wanted this file to be treated as CSS, I did search for css:

Search for css

This will highlight the “scope” the CSS file belongs to — source.css in this case. Note this down.

Now open the Pulsar configuration folder. Click on PackagesSettings viewOpen.

Then click on the Open Config folder button:

Open Pulsar configuration folder

This will open a new window containing the Pulsar configuration files.

Double-click on config.cson to open it in editor. In the core section, add or update the customFileTypes key, like so:

    "source.css": [

The file should appear like this:

customFileTypes added to config.cson

Now, close and re-open the custom.css_t file. It should now be detected as a CSS file and have syntax highlighting.

custom.css_t now recognized in Pulsar