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
:
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:
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
:
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 Packages → Settings view → Open.
Then click on the Open Config folder button:
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:
core:
customFileTypes:
"source.css": [
"css_t"
]
The file should appear like this:
Now, close and re-open the custom.css_t
file. It should now be detected as a CSS file and have syntax highlighting.
Comments