From 54e81dd8fb2f433147de57dc34847658414caca0 Mon Sep 17 00:00:00 2001 From: Aseem Kishore Date: Mon, 2 Apr 2012 19:56:28 -0400 Subject: [PATCH] Add ._js & ._coffee extensions for Streamline.js. Streamline.js by Bruno Jouhier (@Sage) is a library/tool that lets you write synchronous-looking JavaScript/CoffeeScript, and have it compile to Node-style asynchronous JavasScript/CoffeeScript. (It's amazing and super elegant.) https://github.com/Sage/streamlinejs From the start, Streamline was designed to be exactly JavaScript/CoffeeScript, so that it works with existing editors and tools. No new keywords or syntax -- it simply reserves `_` as a function parameter name. Streamline files have thus kept `.js` and `.coffee` as extensions, so that no changes need to be made to tools; Streamline has just used the convention of ending file basenames with `_`, like `foo_.js` or `foo_.coffee`. Unfortunately, to get the most optimal Node.js integration, with on-the-fly compilation (like CoffeeScript), files now need to have their own extension. So Bruno has decided to make `._js` and `._coffee` the extensions of choice. The good news is that the language is still exactly JavaScript/CoffeeScript; it's only the extension that's changed. It's simple to add these extensions into our editors, but I'm wondering if we can add this to GitHub too. =) This change is super simple and shouldn't affect any other language, so I hope you guys are open to it. Thanks for your consideration! --- lib/linguist/languages.yml | 2 ++ test/test_language.rb | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index a470f579..61e790ba 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -217,6 +217,7 @@ CoffeeScript: aliases: - coffee extensions: + - ._coffee - .coffee filenames: - Cakefile @@ -586,6 +587,7 @@ JavaScript: - node primary_extension: .js extensions: + - ._js - .bones - .jake - .js diff --git a/test/test_language.rb b/test/test_language.rb index 5186af52..90a5e26a 100644 --- a/test/test_language.rb +++ b/test/test_language.rb @@ -252,6 +252,11 @@ class TestLanguage < Test::Unit::TestCase assert_equal Language['PHP'], Language.find_by_extension('php5') assert_equal Language['PowerShell'], Language.find_by_extension('psm1') assert_equal Language['PowerShell'], Language.find_by_extension('ps1') + + # Aliases for Streamline.js ( https://github.com/Sage/streamlinejs ) + assert_equal Language['JavaScript'], Language.find_by_extension('_js') + assert_equal Language['CoffeeScript'], Language.find_by_extension('_coffee') + assert_nil Language.find_by_extension('.nkt') end