beyondgrep / ack2

**ack 2 is no longer being maintained. ack 3 is the latest version.**
https://github.com/beyondgrep/ack3/
Other
1.48k stars 138 forks source link

Add gsp (Groovy Server Pages) to filetypes #469

Closed emallove closed 7 years ago

petdance commented 10 years ago

How widely used is GSP? I think this should be discussed on ack-users before we run with it, as mentioned in the ack FAQ.

n1vux commented 10 years ago

How widely used is GSP?

Google reports 1.2e6 matches for filetype:gsp . Most of those are probably "Groovy Server Pages" (asp/jsp equivalent for Groovy framework), I'd assume; many fewer will be Geometer's SketchPad files. That's not a huge number, compared to 7e6 :pm, 6e7 :pl, 4e8 :asp, 3e9 :jsp, but within an order of magnitude of .pm, so common enough ?

Since asp/gsp/jsp and various perl template files contain a mix of HTML and embedded procedural code in language of choice (or vice versa), our current treatment of asp/jsp is correct: they're separate types, and additionally any such in one of --vb --perl --java --groovy and/or --html being site-specific or user ackrc option, depending how you think of them. So the offered Pull is consistent with our implied philosophy.

However, I'd want ack -l --perl 'use Problematic::Module' to include my T::T template files as DWIMmery; so if I were using one of these embedded extensions like GSP, I'd make it part of Groovy and HTML in my ackrc. I'm thinking FAQ should remind that it's doable but user responsibility to decide if they do want it., and maybe give example of including some or all of

# mixed language templates are defined as --asp etc
# it's ackrc local option to match base types too, as desired.
--type-add=vb:ext:asp
--type-add=java:ext:jsp
--type-add=groovy:ext:gsp
--type-add=perl:ext:templ # or whatever you use for Text::Template or whatever
--type-add=html:ext:asp,aspx,jsp,jhtml,psp,gsp,templ # etc to taste

in [.]ackrc (in home, project, or etc) if one wants wants mixed files to appear as both html and code language. Some folks may want all files with embedded vb, groovy, html etc to appear in such searches.

petdance commented 7 years ago

Thanks. e004ee2