language-lua icon indicating copy to clipboard operation
language-lua copied to clipboard

Doesn't detect files with shebang

Open DanielPower opened this issue 9 years ago • 2 comments

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

DanielPower avatar Feb 09 '16 16:02 DanielPower

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.

Rochet2 avatar Jun 26 '16 16:06 Rochet2

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

pablomayobre avatar Apr 23 '17 03:04 pablomayobre