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

xmllint fixer must read from stdin - not buffer filename #4884

Merged
merged 1 commit into from
Jan 10, 2025

Conversation

cyberang3l
Copy link
Contributor

The current xmllint fixer reads and formats the file that a buffer is associated with from disk instead of accepting input from stdin. This has the side effect that if the filename is changed in the buffer, but not saved yet, the fixer discards all the pending changes and replaces the buffer contents with the formatted text from the file contents on disk.

https://gnome.pages.gitlab.gnome.org/libxml2/xmllint.html

@hsanson
Copy link
Contributor

hsanson commented Dec 29, 2024

Tests must be also updated to match this change:

Starting Vader: C:\testplugin\test\fixers\test_xmllint_fixer_callback.vader
    (1/4) [EXECUTE] The xmllint callback should return the correct default command with unpersisted buffer
    (1/4) [EXECUTE] (X) {'command': '/path/to/xmllint --format -'} should be equal to {'command': '/path/to/xmllint --format %t'}
    (2/4) [EXECUTE] The xmllint callback should return the correct default command
    (2/4) [EXECUTE] (X) {'command': '/path/to/xmllint --format -'} should be equal to {'command': '/path/to/xmllint --format C:\testplugin\test\fixers\dummy.txt'}
    (3/4) [EXECUTE] The xmllint callback should include the XMLLINT_INDENT variable
    (3/4) [EXECUTE] (X) {'command': 'set "XMLLINT_INDENT=  " && /path/to/xmllint --format -'} should be equal to {'command': 'set "XMLLINT_INDENT=  " && /path/to/xmllint --format C:\testplugin\test\fixers\dummy.txt'}
    (4/4) [EXECUTE] The xmllint callback should include additional options
    (4/4) [EXECUTE] (X) {'command': '/path/to/xmllint --format - --nonet'} should be equal to {'command': '/path/to/xmllint --format C:\testplugin\test\fixers\dummy.txt --nonet'}

The current xmllint fixer reads and formats the file that a buffer is
associated with from disk instead of accepting input from stdin. This
has the side effect that if the filename is changed in the buffer, but
not saved yet, the fixer discards all the pending changes and replaces
the buffer contents with the formatted text from the file contents on
disk.
@cyberang3l
Copy link
Contributor Author

Thank you @hsanson. Tests updated. Do I need to do something to re-trigger the CI?

Copy link
Contributor

@hsanson hsanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution.

@hsanson hsanson merged commit 83ec182 into dense-analysis:master Jan 10, 2025
7 checks passed
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.

2 participants