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

EntityNotDeclared codeAction (quick fix) not using proper indentation settings #267

Closed
xorye opened this issue Jun 2, 2020 · 1 comment · Fixed by #337
Closed

EntityNotDeclared codeAction (quick fix) not using proper indentation settings #267

xorye opened this issue Jun 2, 2020 · 1 comment · Fixed by #337
Assignees
Labels
bug Something isn't working formatting
Milestone

Comments

@xorye
Copy link

xorye commented Jun 2, 2020

(Copy-paste from eclipse/lemminx#759)

If editor.insertSpaces is set to false, the EntityNotDeclared code action does not insert new content with tabs. Instead, the code action inserts new content with spaces.

Example xml:

<?xml version="1.0" standalone="no"?>
<root-element>
&undeclared;
</root-element>

Before quick fix:
image

Hover over the error message and invoke the quick fix.

After quick fix:
image

This is because codeAction requests do not receive formatting settings like formatting requests do.
LSP spec: https://microsoft.github.io/language-server-protocol/specification#textDocument_formatting
Related issue: microsoft/language-server-protocol#780

The codeAction is inserting two spaces instead of a single tab, because in the lemminx side, the defaults settings are insertSpaces: true and tabSize: 2: https://github.com/eclipse/lemminx/blob/84d268957060b53aee211bd75a34b4536e9dab1e/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/settings/XMLFormattingOptions.java#L117-L118

Currently, VS Code is not sending lemminx its values for editor.insertSpaces and editor.tabSize.

@fbricon
Copy link
Collaborator

fbricon commented Oct 7, 2020

Need to implement workspace/configuration requests from the server. See redhat-developer/vscode-java#1081 (comment)

@fbricon fbricon added bug Something isn't working formatting labels Oct 7, 2020
datho7561 added a commit to datho7561/vscode-xml that referenced this issue Oct 7, 2020
Uses requests to the preferences `xml.format.insertSpaces`
and `xml.format.tabSize` to provide the indentation of the current file

Copied from:
https://github.com/redhat-developer/vscode-java/pull/1081/files

Along with redhat-developer#903, closes redhat-developer#267

Signed-off-by: David Thompson <davthomp@redhat.com>
@fbricon fbricon added this to the 0.14.0 milestone Oct 13, 2020
angelozerr pushed a commit that referenced this issue Oct 13, 2020
Uses requests to the preferences `xml.format.insertSpaces`
and `xml.format.tabSize` to provide the indentation of the current file

Copied from:
https://github.com/redhat-developer/vscode-java/pull/1081/files

Along with #903, closes #267

Signed-off-by: David Thompson <davthomp@redhat.com>
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

Successfully merging a pull request may close this issue.

3 participants