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

The plugin does not properly indent XML #137

Closed
rmahroua opened this issue May 17, 2019 · 6 comments · Fixed by #143
Closed

The plugin does not properly indent XML #137

rmahroua opened this issue May 17, 2019 · 6 comments · Fixed by #143
Assignees
Milestone

Comments

@rmahroua
Copy link

Hey,
I am using the version 0.5.1 of the plugin and noticed something really strange.
The indentation upon hitting 'enter' on some text does not work as expected:

I have the following code (the pipe is the cursor)

  <para>
    A disabled service will not be started automatically.|</para>

After hitting enter, here's the result:

  <para>
    A disabled service will not be started automatically
    </para>

Should be:

  <para>
    A disabled service will not be started automatically
  </para>

If I use HTML as the file type in VSCode, indentation works as expected.

@NikolasKomonen
Copy link
Contributor

References to work on this issue:

VSCode-xml code: https://github.com/redhat-developer/vscode-xml/blob/master/src/extension.ts#L213

HTML-ls code: https://github.com/microsoft/vscode/blob/master/extensions/html-language-features/client/src/htmlMain.ts#L112

The difference (that should make it work properly) should be somewhere in there in the HTML code, I might be wrong and it could be somewhere else.

@xorye
Copy link

xorye commented May 21, 2019

I will work on this.

@NikolasKomonen NikolasKomonen added this to the v0.7.0 milestone May 23, 2019
@xorye xorye modified the milestone: v0.7.0 May 23, 2019
This was referenced May 24, 2019
fbricon pushed a commit that referenced this issue May 24, 2019
Fixes #137

Signed-off-by: David Kwon <dakwon@redhat.com>
@rmahroua
Copy link
Author

Reopening(?) as I noticed that the problem reappeared:
Here's the behavior using VSCode version 1.37.1

<para>
  The variable instructs Ansible to ignore the validation of
  the WinRM certificate as the environment uses self-signed
  certificates.(cursor_here)<ENTER>

Leads to:

<para>
  The variable instructs Ansible to ignore the validation of
  the WinRM certificate as the environment uses self-signed
  certificates.
  (cursor_here)</(generates 'para>')
(should_be_here)

@angelozerr
Copy link
Contributor

Reopening(?) as I noticed that the problem reappeared:

Which version of vscode-xml are you using?

@fbricon
Copy link
Collaborator

fbricon commented Aug 20, 2019

I don't think there's a regression here. When you press enter, there's no way to know this is to end the text and the cursor needs to reduce indentation.
The original bug for sure has been fixed.
Now the litigious part is the generation of the closing tag. On the new line, without typing anything, if you press ctrl+space you'll have the option to insert the closing tag, it'll use the proper indentation. If you instead start typing the closing tag, with </ it'll be automatically inserted but won't de-indent on its own.
If anything you probably want to open a new bug to discuss it.

@rmahroua
Copy link
Author

Thanks for getting back to me. @fbricon you are correct about the hitting ctrl+space then selecting End with <para>, the indentation works.
However, by typing </ it does not indent the text back. I will open a new bug to discuss it.

@angelozerr I am using the version 0.8.0 and VSCodium 1.37.1

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 a pull request may close this issue.

5 participants