FireZenk / language-lua

Lua language support in Atom
https://atom.io/packages/language-lua
MIT License
66 stars 33 forks source link

Doesn't detect files with shebang #23

Open DanielPower opened 8 years ago

DanielPower commented 8 years ago

Atom won't detect files that don't have the extension '.lua' even if the file begins with a lua shebang.

If a file begins with #!/usr/bin/lua5 #!/usr/bin/lua5.1 #!/usr/bin/lua5.2 etc., Atom should detect it and provide syntax highlighting, the same way it does for a Python file with the shebang #!/usr/bin/python3

Rochet2 commented 8 years ago

I created a new file, named it warnings2.lua and saved this to it: #!/usr/bin/python Upon opening it in atom was recogniced as lua file. The file was made with notepad because atom remembers last language setting for a file.

Same happens when I create an unique file without extensions with #!/usr/bin/lua in it. The language is recognized.

The only issue is with #!/usr/bin/lua5.1 and #!/usr/bin/lua5.2 and similar. #!/usr/bin/python2.7 seems to be recognized as python even if there is no file extension.

pablomayobre commented 7 years ago

The problem is this line the regex is saying that it only matches files with a shebang that ends with lua so lua5.1 or any other thing doesn't match.

The fix would be to replace that regex with \\A#!.*?\\blua(-?(\\d.?\\d)|jit)?\\b