editorconfig / editorconfig-vscode

EditorConfig extension for Visual Studio Code
http://editorconfig.org/
MIT License
1.23k stars 118 forks source link

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

Open davidmatson opened 3 years ago

davidmatson commented 3 years ago

Please fill-in this template.

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.

nrayburn-tech commented 3 years ago

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.