-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
syntax: Provide default.yaml as fallback definition #2933
Merged
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
430da61
highlighter: Remove EmptyDef since it's superseeded by a nil check of…
JoeKar 3907942
syntax: Provide default.yaml as fallback definition
JoeKar f265179
buffer: Correct error message in case of failed read
JoeKar 2c53d1f
test: Perform DoEvent() as long as normal or draw events are present
JoeKar 6ffabd6
buffer: Let the user override the default.yaml
JoeKar 87ee41a
buffer: Don't process the default syntax in the user's custom file lo…
JoeKar 4cafa60
syntax: Optimize the patterns and remove the comment region
JoeKar ed993a4
buffer: Precise comment about searching in the internal runtime files
JoeKar 089160a
buffer: Refactor `UpdateRules()` by creating `parseDefFromFile()`
JoeKar 6cd39ef
buffer: Refactor `UpdateRules()` by creating further helper functions
JoeKar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev
Previous commit
buffer: Refactor
UpdateRules()
by creating further helper functions
- `findRealRuntimeSyntaxDef()` - `findRuntimeSyntaxDef()` This will reduce the length of this function again and thus improves the readability.
- Loading branch information
commit 6cd39efddcece5dd0aa7aa993618fbfd71c3b14e
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
How about de-duplicating the code? The size of
UpdateRules()
is getting scary.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 started the refactoring in #3206. This PR will benefit of it too in the moment of necessary rebase.
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.
My work on #3208 made me realize that such refactoring is probably is not an easy thing to do, unfortunately. The logic in
UpdateRules()
is quite subtle, it's not obvious to me how to abstract any important pieces of it into separate functions without loss of functionality and correctness.Perhaps we should approach this from a different direction: instead of trying to restructure the code, just add some helpers to the syntax parser API, e.g.
ParseDefFromFile()
(which would internally just callParseFile()
and thenParseDef()
), maybe alsoFindRuntimeFile()
andFindRealRuntimeFile()
or something like that, to make the code ofUpdateRules()
at least shorter and a bit easier to read.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.
Yep, this will reduce the duplication of load/parses and logs in that way that they aren't spread all over
UpdateRules()
.I will take care of this in the moment #3208 is merged, because then the whole change needs a rebase and I will drop some lines I did.