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

"Join CDATA Lines" option not working on Format #719

Closed
VeteraNovis opened this issue Jun 9, 2022 · 9 comments
Closed

"Join CDATA Lines" option not working on Format #719

VeteraNovis opened this issue Jun 9, 2022 · 9 comments
Labels
bug Something isn't working formatting
Milestone

Comments

@VeteraNovis
Copy link

VeteraNovis commented Jun 9, 2022

I have built the extension VSIX from source, using the master branch for version 0.21.0 which includes the new changes to show the closing tag on code folding. I'm interested in this feature to be able to more easily collapse and comment out large blocks of the XML. This new behaviour doesn't work however when nodes with CDATA are present with line breaks, causing the new lines within the CDATA tag to be completely un-indented.

I turned on the "Join CDATA Lines" option and attempted to format the XML, but the CDATA lines did not join.

I have confirmed that the formatter is working by removing some tabs from a line and watching the formatter fix the tab spacing, however nothing appears to work regarding CDATA line joining.

Steps to reproduce

  1. Clone vscode-xml repo using master branch
  2. Run command npm ci
  3. EDIT: See edit section below for missing step
  4. Install vsce package if needed with npm install --location=global vsce (My version is 2.9.1)
  5. Build package with command vsce package inside vscode-xml directory
  6. Manually install package to VSCode using newly created VSIX file vscode-xml-0.21.0.vsix
  7. Set xml.format.joinCDATALines equal to true in VS Code settings
  8. Open an XML file containing CDATA tags spread across multiple lines
  9. Use Ctrl + Shift + P and select XML Tools: Format as XML
  10. Witness nothing change

EDIT:
I had run the npm build-server command after I had already packaged the vsix file (Thank you @fbricon). This ensured that the language server was working locally as expected, but did not resolve the inability to join CDATA lines.

Settings

    "xml.codeLens.enabled": true,
    "xml.format.joinCDATALines": true,
    "xml.format.joinContentLines": true,
    "xml.format.joinCommentLines": true,
    "xml.foldings.includeClosingTagInFold": true,
    "xml.trace.server": "verbose",
    "xml.symbols.maxItemsComputed": 10000,
    "xml.server.vmargs": "-Xmx1G",
    "xml.java.home": "/usr/lib/jvm/java-8-openjdk-amd64/bin/",
@VeteraNovis
Copy link
Author

I have a feeling that this may be to do with the XML Language server being updated, and therefore I would need clone and build the Language server locally including the new updates. I have followed the steps in the "Contribution" section and have built the server, however VS Code still appears to be attempting to download the Language server when launched.

@fbricon
Copy link
Collaborator

fbricon commented Jun 9, 2022

you need to clone lemminx first
between steps 2 and 3, run npm run build-server, so the vsix embeds it

@VeteraNovis
Copy link
Author

you need to clone lemminx first between steps 2 and 3, run npm run build-server, so the vsix embeds it

Ah yep, that makes sense. Thank you for pointing me in the right direction.

This now enables me to display the closing tag of a collapsed section, which also spans across multiline / unindented tags as expected.

Interestingly, the "Join CDATA Lines" option still doesn't appear to work. I no longer need that option, due to the code collapsing working correctly when I packaged the server into the VSIX file, but I'm not sure why it wouldn't be formatting correctly regardless.

@fbricon
Copy link
Collaborator

fbricon commented Jun 9, 2022

looks like a regression that managed to creep through our test suite. I'm sure @angelozerr will figure it out

@VeteraNovis
Copy link
Author

No dramas. Thank you again for the assistance.

@angelozerr
Copy link
Contributor

@VeteraNovis you mean that join cdata formatting worked in old version?

@JessicaJHee
Copy link
Contributor

This issue is fixed by enabling the experimental formatter. The current behaviour can be seen here:
Peek 2022-09-09 11-58

@angelozerr
Copy link
Contributor

@VeteraNovis could you give us an XML snippet which cannot format correctly please in order to we can try it with experimental formatter and check if it works correctly. Thanks!

@angelozerr angelozerr added bug Something isn't working formatting labels Sep 21, 2022
@angelozerr
Copy link
Contributor

I close this issue since experimental formatter fixes this issue

@VeteraNovis please try with experimental formatter and reopen the issue if you have again the same issue.

@angelozerr angelozerr added this to the 0.22.0 milestone Nov 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working formatting
Projects
None yet
Development

No branches or pull requests

4 participants