editorconfig-vscode icon indicating copy to clipboard operation
editorconfig-vscode copied to clipboard

.editorconfig settings not passed to VS Code Language Server in Format Document request

Open davidmatson opened this issue 3 years ago • 1 comments

Please fill-in this template.

  • [x] I have a question that is specific to this extension; thus, inappropriate for the main EditorConfig issue tracker.
  • [n/a] I tried running code --disable-extensions and the issue did NOT present itself.

Issue

Visual Studio Code editorconfig-vscode
Version 1.5.82 0.16.4

Root .editorconfig File

root = true

[*]
indent_style = tab
indent_size = 5
trim_trailing_whitespace = true
insert_final_newline = true

Are there any other relevant .editorconfig files in your project? No

Expected behavior

When issuing a Format Document command, the settings above all translate into FormattingOptions passed to a Language Server in VS Code.

Actual behavior

Only the following settings are passed through:

    "options": {
        "tabSize": 5,
        "insertSpaces": false
    }

Additional comments or steps to reproduce

See microsoft/vscode-languageserver-node#795 for additional context.

davidmatson avatar Aug 04 '21 17:08 davidmatson

I think that the primary issue is how this extension implements the formatting. The extension uses pre-save transformations, instead of being implemented as a formatter. The pre-save transformations do not communicate the additional FormattingOptions, which is why only the two that are part of the TextEditorOptions work.

I am not sure of the implications or feasibility of converting the extension to be used as a formatter instead of the current pre-save transformations. I am going to look into it some more, but I am not sure if it is possible or how long it would take to make the changes.

nrayburn-tech avatar Aug 17 '21 00:08 nrayburn-tech