atom / language-shellscript

ShellScript package for Atom
Other
39 stars 84 forks source link

.profile is not being recognized as a shellscript file #69

Closed cbcoutinho closed 7 years ago

cbcoutinho commented 7 years ago

My .bashrc file is correctly recognized as a shell script, but my .profile file is not - no syntax highlighting or filename recognition whatsoever.

I looked at shell-unix-bash.cson, lines 3-26 and see that .profile is a supported filetype along with .bashrc, so I'm not sure what the issue is. A missing period somewhere in a parser maybe? Anyways, I hope you have an easier time finding the problem that I am.

Thanks in advance!

50Wliu commented 7 years ago

Just tried it out - it's getting recognized as PHP instead 😞. Can you verify this @cbcoutinho? https://github.com/atom/language-php/blob/master/grammars/php.cson#L16

cbcoutinho commented 7 years ago

Hi @50Wliu - yes I just noticed now that you mentioned it, it is indeed being caught up in PHP syntax.

On Mon, Jan 30, 2017 at 5:40 PM Wliu notifications@github.com wrote:

Just tried it out - it's getting recognized as PHP instead 😞. Can you verify this @cbcoutinho https://github.com/cbcoutinho? https://github.com/atom/language-php/blob/master/grammars/php.cson#L16

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/atom/language-shellscript/issues/69#issuecomment-276113877, or mute the thread https://github.com/notifications/unsubscribe-auth/AMTd7Lt1Rqi2I-ts1l4cUVKhVyHgudWQks5rXhJjgaJpZM4LxXU- .

cbcoutinho commented 7 years ago

And what's worse - I'm not even getting a PHP icon. If PHP is in fact correct about the file extension, then they have a file-icon issue on their hands as well.

What does atom allow you to do when two languages have identical file extensions?

Another one that comes to mind is Matlab .m files and Objective-C .m files. I just know I'm working with Matlab, but the grammar and syntax think otherwise

50Wliu commented 7 years ago

You can set custom filetype associations: https://discuss.atom.io/t/how-do-i-make-atom-recognize-a-file-with-extension-x-as-language-y/26539

For MATLAB, try searching for a language package for it. Community packages have higher precedence than core packages.

cbcoutinho commented 7 years ago

Wonderful, thanks for the link. I was able to fix the issue by overriding the file associations as described in your link.

Specifically, I solve the issue by adding the following snippet to my config.cson:

core:
  customFileTypes:
    'source.shell': ['profile']
    'source.matlab': ['m']

Thanks again for the quick reply!