-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugin Idea: Shebang lines to auto-detect language #2174
Comments
If there was value I'd suggesting adding it as a feature in general... such that you had a
Or get more complex... and the parser itself would check the very first like for |
@egor-rogov Any objections to the idea if we find someone to work on it? Just a relevance boost if there is a matching shebang line that starts the content... if not I'll promote to "help welcome". If you're super opposed for some reason this can just die. I just thought it was a helpful idea for snippet that DID actually contain a shebang. |
Can't this be emulated using regex? What is the probability to find "false shebang" below the first line? |
Maybe (although I'm not sure a rule can match only the first line), but the idea here would be to abstract the concept and encourage grammars to support it - if we thought it was a good idea. Hence making it easy with some smart defaults like:
And we could build a smart regex to detect many common shebang patterns. This could also be a plugin too though... I'll start a thread on hooks (which we'd need for useful plugins). |
Have you ever seen something that can be mistaken to shebang in the middle of code? Is it worth to stick to the first line at all?
Why the core should be concerned with language specifics (say, |
I meant that the key distinguishing part: Closing this for now. This is the kind of thing a plug-in could/should handle. |
Agree. |
The languages might still need to SUPPORT that plugin though by providing a |
Ie if starts with:
Python relevancy +100, etc. Or would this not be that useful in practice? Was just at hough I had reading a LOT of Python samples. :) I guess the trick is we're not always given full samples, but seems like when we are this would be a dead giveaway a lot of the time?
The text was updated successfully, but these errors were encountered: