-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
feat: add xml type for response formatting and highlight #181
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
Your free trial has expired. To keep using Ellipsis, sign up at https://app.ellipsis.dev for $20/seat/month or reach us at [email protected] |
|
WalkthroughThe changes enhance the XML formatting capabilities in the Neovim plugin setup using Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Neovim
participant Plugin as hurl.nvim
participant Formatter as tidy
User->>Neovim: Open XML file
Neovim->>Plugin: Request to format XML
Plugin->>Formatter: Execute tidy with -xml, -i, -q
Formatter->>Plugin: Formatted XML
Plugin->>Neovim: Display formatted XML
Neovim->>User: Show formatted XML
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
for more information, see https://pre-commit.ci
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.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (8)
- README.md (3 hunks)
- doc/hurl.nvim.txt (3 hunks)
- lua/hurl/history.lua (1 hunks)
- lua/hurl/init.lua (1 hunks)
- lua/hurl/main.lua (1 hunks)
- lua/hurl/popup.lua (1 hunks)
- lua/hurl/split.lua (1 hunks)
- lua/hurl/utils.lua (2 hunks)
Files skipped from review due to trivial changes (1)
- lua/hurl/init.lua
Additional context used
LanguageTool
doc/hurl.nvim.txt
[grammar] ~69-~69: The verb form ‘install’ does not seem to be suitable in this context.
Context: ... 'tidy', -- Make sure you have install prettier in your system, e.g: npm insta...(HAVE_VB)
Additional comments not posted (8)
lua/hurl/history.lua (1)
29-33
: LGTM! Verify XML content type handling.The addition of XML content type handling is correct.
Ensure that the
utils.is_xml_response
function accurately identifies XML content types.lua/hurl/split.lua (1)
18-18
: LGTM! Verify XML type handling.The addition of the
xml
type parameter is correct.Ensure that the logic for handling different content types, including
xml
, is consistent and accurate.lua/hurl/popup.lua (1)
38-38
: LGTM! Verify XML type handling.The addition of the
xml
type parameter is correct.Ensure that the logic for handling different content types, including
xml
, is consistent and accurate.lua/hurl/utils.lua (2)
104-112
: LGTM! Verify XML formatting logic.The addition of XML formatting logic is correct.
Ensure that the logic for formatting different content types, including
xml
, is consistent and accurate.
177-180
: LGTM! Verify XML content type identification.The addition of the
util.is_xml_response
function is correct.Ensure that the function accurately identifies XML content types.
lua/hurl/main.lua (1)
186-190
: LGTM! Verify theutils.is_xml_response
function.The changes correctly add support for handling XML responses.
Ensure that the
utils.is_xml_response
function is properly implemented and tested.README.md (2)
53-57
: LGTM!The XML formatter configuration using the
tidy
command is correctly added.
261-265
: LGTM!The XML formatter configuration using the
tidy
command is correctly added.
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- doc/hurl.nvim.txt (3 hunks)
Additional comments not posted (2)
doc/hurl.nvim.txt (2)
68-73
: LGTM! The XML formatter configuration is correct.The added configuration for XML formatting using
tidy
is consistent with other formatters and includes a helpful comment about installingtidy
.
335-340
: LGTM! The XML formatter configuration is correct.The added configuration for XML formatting using
tidy
is consistent with other formatters and includes a helpful comment about usingtidy
to format XML responses.
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.
Thanks @javoscript LGTM!
@all-contributors add @javoscript for code. |
I've put up a pull request to add @javoscript! 🎉 |
WHAT
Add support for XML response content types.
WHY
Though not as common as HTML or JSON APIs, XML is still widely used.
Handling it as generic
text
works currently, but no response formatting or syntax highlighting is being done.HOW
Adding the relevant function
utils.is_xml_response(content_type)
and type handling for formatting (withtidy
command) and syntax highlighting the response.Probably a more generic and extensible way of allowing plugin users to configure custom formatting commands for different response types would be better. But, in this case I didn't want to change too much the internal logic of the plugin, just add support for XML.
Screenshots (if appropriate):
A formatted and syntax highlighted response example:
Types of changes
Checklist:
Summary by CodeRabbit
New Features
tidy
for improved XML parsing and display.Improvements
show
function to support displaying XML responses alongside existing JSON, HTML, and text formats.