TextMate Bundles in PhpStorm

Projects may contain file types unknown to PhpStorm. While PhpStorm comes with built-in support for many programming and scripting languages, you may want to have syntax highlighting for project-specific languages. For example, a project may contain a shell script, or Perl. When doing infrastructure automation for your project using Puppet, a configuration file may exist in a project. TextMate, a text editor for Mac, offers syntax highlighting bundles for many languages. The good news is we can import them and use them in PhpStorm!

This functionality is available in IntelliJ Idea, PyCharm, WebStorm, PhpStorm, RubyMine, and AppCode.

Once a TextMate bundle is added, PhpStorm will provide syntax highlighting for the file types registered with the bundle. Here’s an example of a shell script opened in PhpStorm after installing the ShellScript TextMate bundle:

Shell script syntax highlighting in PhpStorm

Have a look at our tutorials page for more information how to configure TextMate bundles with PhpStorm!

As always, we appreciate your feedback in the comments below or in our forums!

Develop with pleasure!
– JetBrains PhpStorm Team

This entry was posted in Cool Feature and tagged , , , , . Bookmark the permalink.
  • Henry Garcia

    Hi

    Does not really work when adding Laravel-Blade textmate bundle. (https://github.com/Medalink/laravel-blade)

    I am not sure why? The bundle does account for .blade or .blade.php extensions but you still get not syntax highlighting or maybe is just the bundle itself.

    • Maarten Balliauw

      Can you verify the File Types settings and ensure .bundle.php is handled by TextMate plugin?

      • Henry Garcia

        If the bundle handles the .blade.php extension in the File Type settings I lose all highlighting in PHP/HTML code.

    • http://www.codexc.com hany

      it is works now with phpstorm7 , but i lose html and css autocomplete

  • K

    It doesn’t highlighting all other html code? ( https://github.com/drnic/Handlebars.tmbundle )

  • Peter Geil

    You tmBundle “importer” always chokes on this bundle: https://github.com/peta/turtle.tmbundle

    Can anybody reproduce this problem?

    • Maarten Balliauw

      Are you seeing any specific error messages?

      • Peter Geil

        No, once I selected the bundle folder, an according entry is added to the bundle list with a marked checkbox, but as soon as I click “Apply” or “OK” both, PHPStorm and RubyMine (each being the latest version) freeze and only a hard termination (via the quit now window on MacOS; CMD+ALT+ESC) helps. After I restarted the application, it works UNTIL I open up the application preferences and switch to the “TextMate Bundles” dialog pane (I’m doing nothing in there) — then the same game begins again. The only solution is to edit ~/Library/Preferences/WebIde60/options/textmate.xml and to remove the according BundleConfigBean.

        Maarten, before I file an issue, would you mind to download a ZIP of the bundle project from GitHub and try if it works for you? This would be very helpful for me as it might be a quick indication for whether the problem is specific to my setup or the bundle itself (so I can start to track down what makes the tmBundle importer choke) .

        • Maarten Balliauw

          Worst reply ever, but… it works on my machine. I di notice a small error during cloning but the bundle works.

          • Peter Geil

            “Worst reply ever” — why?

          • Maarten Balliauw

            Well from my side I thought it was the worst reply ever as “works on my machine” means I have no good explanation why it works on my side and not on yours. I see Alexander filed an issue for it, let me know if there’s anything else we can help you with.

          • pbyrne84

            For those not in the joke “it works on my machine” is a statement made by developers who do not know their environment or how different environments can change how things work. Basically a person who says this == keyboard banging environment unaware monkeyCoder.

            So popular is the term you can buy t-shirts
            https://www.google.co.uk/search?hl=en&q=it+works+on+my+machine+t+shirt&meta=

            Basically Maarten is self deprectating himself and not you Peter .

      • Peter Geil

        Eeem … just to avoid confusion: “… After I restarted the application, it works …” doesn’t mean that the bundle-related functionality is available; I even didn’t try to open e.g. a *.ttl file.

        While re-reading my answer, another important question crossed my mind: How does your tmBundle importer apply the TextMate language grammar? There are several specifics TM bundle authors must be aware of (e.g. a document is matched line by line, meaning that true multiline regex patterns are not supported by TM) and that also coerce them to kind of workarounds in order to make a grammar work like they want it to do.

        Could you please elaborate a little bit on the internals of your tmBundle importer? That way authors (like me) whose bundles currently are broken could optimize their grammar to make it perfectly work with IntelliJ-based products.

        Some concrete questions:

        + How do you apply patterns? (single or multiline)
        + How do you map scopes?
        + What RE dialect do you support? (TM uses Oniguruma)
        + Is there (undocumented) functionality a language grammar can make use of that otherwise isn’t available in TM?

        Thanks in advance!

        Peter

        • Alexander Zolotov

          Hi Peter,

          I’ve filed an issue for you: http://youtrack.jetbrains.com/issue/RUBY-13711

          We can discuss all questions you may have there.

          in brief:
          1. multiline
          2. exactly as said in the TextMate bundles documentation
          3. oniguruma
          4. no

  • Pingback: Laravel Blade Highlighter - Sublime Text | Laravel News