DEVSENSE / phptools-docs

PHP Tools public content
Apache License 2.0
84 stars 10 forks source link

codestyle saving on line completion conflicts with .editorconfig settings / plugins #103

Open addshore opened 3 years ago

addshore commented 3 years ago

Split out from https://github.com/DEVSENSE/phptools-docs/issues/101

whether to use tabs or spaces for indentation (vscode setting editor.insertSpaces)

One thing I noticed here is that this ignored .editorconfig files. Thus i had to turn off the phptools code style stuff fro this. The IDE would use tabs for example per .editorconfig, but then on line save phptools would replace the tabs with spaces.

indentation size (editor.tabSize)

This can also be defined in .editorconfig files

Another thing to note is there are other plugins to manage code in relation to these .editorconfig files But phptools seems to conflict with that.

jakubmisek commented 3 years ago

This is actually (or should be) a feature of VSCode itself. Extensions like PHPTools just use settings that VSCode tells it to use, and how the editor is currently behaving when you press tab or so.

I believe there is an extension that overwrites editor settings based on .editorconfig (https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig ?)

I think we could process .editorconfig by ourselves and ignore the VSCode settings, but it wouldn't be consistent with what you get when typing in the editor window.

addshore commented 3 years ago

but it wouldn't be consistent with what you get when typing in the editor window.

Seemingly when using a .editorconfig plugin the editor window behaves and respects the .editorconfig, however seemingly the values that phptools is getting (directly from the IDE) don't reflect the .editorconfig? But the editor behaviour is consistent with the .editorconfig settings.

Then phptools changes the behaviour of the editor window (incorrectly).

This is the one that I use:

Name: EditorConfig for VS Code
Id: editorconfig.editorconfig
Description: EditorConfig Support for Visual Studio Code
Version: 0.16.4
Publisher: EditorConfig
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig
jakubmisek commented 3 years ago

Ok, code formatting should respect the values used in the editor's code window. We'll take a look at it.