Use custom grammar for JS files (titanium files)?


#1

I would like to have autocompletion for Titanium files. The problem is that they are normal JS files. How can I create a language-package, that will be used when I open a Titanium JS file? I want to keep the normal JS syntax but add custom properties.


#2

You might want to look into implementing a language package that includes JavaScript like is described here:

There are other examples in the standard language packages too. Like in the following Ruby, the SQL syntax is properly highlighted with UPDATE, SET and WHERE recognized as keywords, among other things:

def up
  add_column :cards, :collectible, :boolean, default: true

  execute <<-SQL
    UPDATE cards SET "collectible" = FALSE WHERE "set" = 'not_collectible'
  SQL
end