mirror of
https://github.com/tufanbarisyildirim/gonginx.git
synced 2026-04-27 00:35:51 +03:00
[GH-ISSUE #59] [feature request]Recommended to support the ability to get the line number where the nginx directive is located #29
Labels
No labels
bug
enhancement
good first issue
pull-request
question
v2
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/gonginx#29
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sharelinux on GitHub (Dec 12, 2024).
Original GitHub issue: https://github.com/tufanbarisyildirim/gonginx/issues/59
Description.
It is recommended that the project support getting the location of the nginx directives in the original configuration file.
Scenarios of use.
Currently there is this need to configure constraints for a certain instruction block. Check whether this instruction configuration to meet the rules, check the verification piece by parsing the configuration instructions, enumeration or recursive implementation of the check rule comparison, but if the check does not meet the requirements, now need to return to the original file is located in the line, the front-end needs to highlight this line, and then for the error message or modification suggestions.
Currently found github.com/tufanbarisyildirim/gonginx.parser syntax parser on the line number is there, just missing the token into the parsing object (config.Block) on the missing, increase the set line number and get the line number method can be.
Solution.
Just add the GetLine(), SetLine(int) interface constraints to the IDirective interface and an implementation of that interface.
Test screenshots
Local analog data files
Test Results
Hopefully this suggestion will be taken up.
I will also raise a PR for support of this feature and hopefully adopt the merge.
@amassx commented on GitHub (Dec 13, 2024):
I had a similar need to get the line number of the directive.