-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Use existing analyzer module for language detection for highlighting #13522
Use existing analyzer module for language detection for highlighting #13522
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guess it will help a little even thought most of the detectable file types are binary.
this doesn't seem particularly helpful as most of the mimetypes appear to be binary in the attached library. |
It's for many script languages that are common to not have extensions php/perl/ruby/node/lua etc... Most people don't use extensions when writing programs in scripting languages. None of these are highlighted now |
Here's what that library gives us. I see it's rather incomplete thought. For example I can't find any shells in it, bash, zsh etc which are prime canidates for extensionless files. Still I guess it's a tiny improvement over the previous state. I guess shell support could be hacked in by checking the first line of the file against a regexp like |
Thanks @lafriks for pointing out we can reuse existing code for more reliable language detection here.
518bbcd
to
9a1cef6
Compare
Changed per @lafriks pointing out we already have an existing module to detect language |
Codecov Report
@@ Coverage Diff @@
## master #13522 +/- ##
==========================================
+ Coverage 42.15% 42.17% +0.01%
==========================================
Files 695 695
Lines 76395 76394 -1
==========================================
+ Hits 32207 32219 +12
+ Misses 38903 38889 -14
- Partials 5285 5286 +1
Continue to review full report at Codecov.
|
🚀 |
@mrsdizzie please send backport :) |
…o-gitea#13522) * Use existing analyzer module for language detction for highlighting Thanks @lafriks for pointing out we can reuse existing code for more reliable language detection here. * Update modules/highlight/highlight.go Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
…13522) (#13551) * Use existing analyzer module for language detction for highlighting Thanks @lafriks for pointing out we can reuse existing code for more reliable language detection here. * Update modules/highlight/highlight.go Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Thanks @lafriks for pointing out we can reuse existing code for more reliable language detection here.