code icon indicating copy to clipboard operation
code copied to clipboard

EditorConfig plugin overrides global settings for indent width and style

Open jeremypw opened this issue 3 years ago • 3 comments

Fixes #1203

  • [x] Specify name of editorconfig file so that plugin actually works
  • [x] Link editorconfig plugin and format bar
  • [x] Expose functions to change indent width and style of current document.
  • [x] Make format bar aware if indent width and/or style set by plugin
  • [x] If editorconfig plugin sets indent width and/or style, make the formatbar indent button insensitive.
  • [x] Amend tab button text and tooltip text accordingly
  • [x] Prevent FormatBar changing global settings (this is done via Preferences)
  • [x] Amend .editorconfig file so that it does not duplicate/conflict with global setting of indent width and style.

It was noticed that although indent-width and tab-width are separate properties of SourceView, there is no facility in the existing code for these to be set separately so these are treated the same by the plugin (and only one specified in the config file). If both were specified in a config file then the last one would have priority. If there are situations where these need to be set separately additional code will be required.

There is no facility to update the .editorconfig file through the UI (except by manual editing). That could be added as a future PR if required.

Input required on the user facing copy.

jeremypw avatar Aug 13 '22 12:08 jeremypw

@danrabbit It works for me under those circumstances. You have to have

[{*.xml,*.xml.in,*.yml}]
tab_width = 2

in the editor-config file (after the [*] setting)

jeremypw avatar Sep 02 '22 10:09 jeremypw

Also you have to install the PR in order to update the plugin - or use the Flatpak version

jeremypw avatar Sep 02 '22 10:09 jeremypw

Maybe this is another candidate for moving into the main code?

jeremypw avatar Sep 02 '22 10:09 jeremypw