'How to specify programming language for 'Fastfile' in Android Studio?

I use Fastlane in my Android Project. And when I open 'fastlfile' file, Android Studio doesn't recognize this file as ruby code. And the code is not colorful. How can I specify programming language for the file?



Solution 1:[1]

As of Android Studio Bumblebee, the solution below is obsolete as Ruby syntax highlighting was added for Fastfile (and many other extensionless files).

I'll keep the old solution here, for reference.


I discovered that Android Studio Arctic Fox (latest at time of writing) already includes the ruby syntax from TextMate. All that was needed was to associate Fastfile with it.

To do it, I edited the embedded bundle configuration file (this is the path on MacOS, adapt for other platforms):

"/Applications/Android Studio.app/Contents/plugins/textmate/lib/bundles/ruby/package.json"

In the file, I added Fastfile to the list of files:

            ...
            "filenames": [ "rakefile", "gemfile", "guardfile", "podfile", "capfile", "Vagrantfile", ".simplecov", "Fastfile" ],
            ...

I didn't search much, but couldn't find a way of doing it in the preferences.

Solution 2:[2]

If you're working with file types that are not recognized by Android studio (for example, if it's a proprietary file type developed in-house), or if you need to code in an unsupported language, you can create a custom file type.

https://www.jetbrains.com/help/ruby/creating-and-registering-file-types.html

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 davedega