0

When working on web dev projects, we work with many file formats, some of which aren't recognised by Code, such as .twig.

Is there a way to add support for these?

If not, is there a way to treat all files with that extension as a particular language (eg. HTML)?

2

I really don't know

You should ask in their Github page

https://github.com/elementary/code/issues

Maybe ask for this new feature or some info on where to write the syntax definition...


UPDATE

(time:1543427125)

Thanks for the downvote, you made me learn a new thing. I followed my own suggestion and went to their Github page (as I said could be the best way to get an answer) and looked for people asking for new language support. Normal stuff right?. Found a post of a person asking for "Language Support for Ren'Py"

https://github.com/elementary/code/issues/467

There, a person who has the know-how of 's environment, told him and us that uses gtksourceview

So I went to the old Google, searched for "twig gtksourceview" and found this:

https://twig.symfony.com/doc/2.x/templates.html (I believe this is the Official website of the language?)

If we look for gtksourceview we find

https://twig.symfony.com/doc/2.x/templates.html

,that leads us to:

https://github.com/gabrielcorpse/gedit-twig-template-language


Next

To add support to others just repeat:

  1. Go to the official website and look for their gtksourceview template format file, if they don't have a template made, look for it in Google and if all goes wrong you just can edit/create one yourself. (see below for format definition)

  2. Create it or download it

  3. Save it in your system where it should (see below)

  4. Profit


Where to save it?

User

~/.local/share/gtksourceview-3.0/language-specs/

System-wide

/usr/share/gtksourceview-3.0/language-specs/

Format

https://developer.gnome.org/gtksourceview/stable/lang-reference.html

  • 1
    So to clarify, we're looking for a [languagename].lang file? Thanks for investigating this! – Dane Rossenrode Dec 1 '18 at 13:10
  • Not exactly [languagename].lang. But in some cases it may be that way. Just explore that directory and there you can find the HTML file in case you don't any solution for the other types you talked so you can copy that or add the extension. – Sebastian Dec 2 '18 at 6:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.