Skip to content
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

Add Splunk Query Language highlighting #1280

Closed
wants to merge 1 commit into from
Closed

Add Splunk Query Language highlighting #1280

wants to merge 1 commit into from

Conversation

nervous-inhuman
Copy link

This PR adds support for Splunk Query Language highlighting for .spl and .splunk files

Example:
image

It's still missing the test files, but I'm not sure whether that's required.

@keith-hall
Copy link
Collaborator

Hi, thanks for your contribution. I have a couple of questions. Is this syntax definition your own work? The advice in the documentation is generally to link to a submodule where possible. Also, I don't see a syntax request issue for this, so I was wondering whether you are aware you can customize bat to use this syntax definition without it needing to be included by default?

@eth-p
Copy link
Collaborator

eth-p commented Oct 7, 2020

Additionally, does Splunk meet the requirements for adding new built-in syntaxes to bat? The combined total of Atom and Packagecontrol is roughly 5k installs:

https://packagecontrol.io/packages/Splunk%20Syntax

https://atom.io/packages/language-splunk

@nervous-inhuman
Copy link
Author

nervous-inhuman commented Oct 7, 2020

Hello @keith-hall and @eth-p, please see my answers below.


Hi, thanks for your contribution. I have a couple of questions. Is this syntax definition your own work?

No, right now, the .sublime-syntax I have commited was taken from aarongraham/splunk-syntax-sublime, and converted from the .tmLanguage format to syntect-compatible .sublime-sytnax.

After going through other projects, I'd like to use the Splunk syntax highlighting from the VS Code extension arcsector/vscode-splunk-search-syntax instead, as it is more complete than the previous project.

The project has VS Code specific files too, so I'm not sure how loading it as a submodule could work.
It also uses the .tmLanguage fileformat, so it'd need to be converted to .sublime-syntax too.


Also, I don't see a syntax request issue for this, so I was wondering whether you are aware you can customize bat to use this syntax definition without it needing to be included by default.

Yes, I am aware (see the screenshot).


Additionally, does Splunk meet the requirements for adding new built-in syntaxes to bat?

There are multiple packages for various editors (vim, Sublime, VS Code, and so one) that add support for syntax highlighting Splunk Queries. I'm not sure whether the sum of total installs is a valid metric.

I am not aware of any written minimum requirements for adding new syntaxes to bat, if there are any, I'd be glad if you linked me to them. Thanks.

I think supporting SPL would be a nice addition for teams who deal with Splunk, as using syntax highlighting in bat makes the Splunk queries way more readable. Especially the long ones with field manipulations and sub-searches.

Thanks.

@eth-p
Copy link
Collaborator

eth-p commented Oct 7, 2020

Additionally, does Splunk meet the requirements for adding new built-in syntaxes to bat?

There are multiple packages for various editors (vim, Sublime, VS Code, and so one) that add support for syntax highlighting Splunk Queries. I'm not sure whether the sum of total installs is a valid metric.

It's something we're discussing in #1262, but the the current criteria is actually 10k PackageControl downloads. When I link to metrics in my comments, it's mostly to give a better picture of how popular the language is. We're open to discussing languages that don't strictly meet the criteria, but having extra numbers to back things up helps :)

I am not aware of any written minimum requirements for adding new syntaxes to bat, if there are any, I'd be glad if you linked me to them. Thanks.

Sorry about that. They're a bit hard to find and only exist as comments inside the syntax request issue template right now, but I'll probably be adding them to a CONTRIBUTING.MD file after #1262 is closed.

I think supporting SPL would be a nice addition for teams who deal with Splunk, as using syntax highlighting in bat makes the Splunk queries way more readable. Especially the long ones with field manipulations and sub-searches.

For sure. I'm not saying we shouldn't add it, but we have the requirements in place to help balance adding new syntaxes with the maintenance and performance overhead that comes with them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants