-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Create Pipeline Rules syntax highlighting mode for Ace #5957
Conversation
Errors currently in master
After adding in the syntax highlighting, an additional error is added to the mix, even though the mode actually loads fine and renders appropriately
I could use an additional set of eyes to help me figure out what's causing this 404 even though it actually works. |
graylog2-web-interface/src/components/common/SourceCodeEditor.jsx
Outdated
Show resolved
Hide resolved
a83c08f
to
fd4ead0
Compare
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.
I have played with the PR today and it is a good improvement!
Some suggestions:
-
The mode should be named
pipeline
/pipeline_rule
, notgraylog
to make it more specific. -
The mode file can be reduced in size dramatically. While playing with it, I removed the JavaScript mode and let the
graylog
mode inherit fromTextMode
. Also, the folding is not required. -
The mode contains a number of keywords (
match|pipeline|all|either
) which are not used in the rule language. I think you got them from the internal representation of pipelines, which is different from pipeline rules. While we might support editing them at some point, it would be a different mode than the pipeline rules. -
rule|when|then|end
should be keywords, not constants. This way the highlighting lets you differentiate visually between the outer framing of the rule and the used functions:
-
Instead of maintaining a huge list of functions, we should try to fetch them again from the backend. (Maybe by using an instance of the mode again, which is passed to
react-ace
, so it is not evaluated in its scope, but ours) -
If that is not possible, we should replace the static list with a regex. IMO it is confusing if a function that is in the list has a different color than a function that is supplied by a plugin (but is still correct). Validating that a function is defined is done by the editor anyway.
graylog2-web-interface/src/components/common/SourceCodeEditor.jsx
Outdated
Show resolved
Hide resolved
Linting
rename file use already registered mode revert webpack config to master
Linting
rename file use already registered mode revert webpack config to master
babb9b8
to
5e9b8f8
Compare
5e9b8f8
to
4f67b2c
Compare
Description
Created custom Mode for Ace Editor to introduce syntax highlighting for Pipeline Rules
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Before:
After:
Types of changes
Checklist: