openFrameworks icon indicating copy to clipboard operation
openFrameworks copied to clipboard

Tabs or spaces - Added EditorConfig to help fix problems

Open danoli3 opened this issue 1 year ago • 0 comments

The great old question - Tab or Space

Reminder: openFrameworks uses for C++/C - Tabs - with a space width 4 https://github.com/openframeworks/openFrameworks/wiki/oF-code-style

We have .clangformat for C / C++ / all clang editors like Xcode etc. For Xcode, @2bbb has added some values to configure this directly for the core mac/iOS/tvOS Project files

Added some .editorconfig and merged: https://github.com/openframeworks/openFrameworks/pull/6900 EditorConfig I've configured this to have exclusions to YML, JS and other formats where spaces are required.

This will fix format issues when editing source in editors such as:

  • Sublime Text
  • Notepad++
  • Codeblocks
  • Eclipse
  • VSCode etc Screenshot 2024-08-28 at 10 14 28 AM

Essentially:

# EditorConfig https://editorconfig.org
root = true

# Default settings for all files
[*]
indent_style = tab
indent_size = 4
tab_width = 4
insert_final_newline = true
trim_trailing_whitespace = true

[*.{js,py}]
charset = utf-8

[*.sh]
indent_style = tab
indent_size = 4
tab_width = 4
insert_final_newline = true
trim_trailing_whitespace = true

# Override JSON 
[*.json]
indent_style = space
indent_size = 2
tab_width = 2

# Override YAML 
[*.yml]
indent_style = space
indent_size = 2
tab_width = 2

[*.html]
indent_style = space
indent_size = 2

[*.js]
indent_style = space
indent_size = 2

danoli3 avatar Aug 28 '24 00:08 danoli3