Add Plugin Guidelines for Each Property #295

Closed
jedmao opened this Issue Jan 11, 2017 · 6 comments

Projects

None yet

3 participants

@jedmao
Member
jedmao commented Jan 11, 2017 edited

I propose adding a section to the Plugin-How-To section of the wiki that offers guidelines about how to implement each EditorConfig property.

Some rules are best implemented the moment you open a file, but others may only apply on each file save. We probably need some clarity there.

To kick-off the discussion, let me make a list and we can modify it as the discussion evolves.

indent_style

  1. When opening/switching to a file, apply built-in editor setting.
  2. If no built-in editor setting, do nothing. Do not attempt to fix indent style with manual operations.

indent_size

  1. When opening/switching to a file, apply built-in editor setting.
  2. If no built-in editor setting, do nothing. Do not attempt to fix indent size with manual operations.

tab_width

  1. When opening/switching to a file, apply built-in editor setting.
  2. If no built-in editor setting, do nothing. Manual operations do not apply to this property.

end_of_line

  1. When opening/switching to a file, apply built-in editor setting. In some editors, this will mark the file as dirty.
  2. If no built-in editor setting, apply built-in editor operation on file save.
  3. If no built-in editor operation, apply manual operation on file save or do nothing.

charset

  1. When opening/switching to a file, apply built-in editor setting.
  2. If no built-in editor setting, apply manual operation on file save or do nothing.

trim_trailing_whitespace

  1. Do not attempt to fix trailing whitespace when opening/switching to a file.
  2. Apply built-in editor setting on file save.
  3. If no built-in editor setting, apply manual operation on file save or do nothing.

insert_final_newline

  1. Do not attempt to insert a final new line when opening/switching to a file.
  2. On file save, apply built-in editor setting.
  3. If no built-in editor setting, apply manual operation on file save or do nothing.
@jedmao jedmao changed the title from Add Plugin Guidelines for Each Rule to Add Plugin Guidelines for Each Property Jan 11, 2017
@xuhdev
Member
xuhdev commented Jan 11, 2017

Sure, I'm totally up for it.

@ffes
Member
ffes commented Jan 12, 2017

Just a question.

What if for instance the eol in the file is crlf and the file is opened and .editorconfig sees it should be lf. Should the plugin convert silently, convert and report, just report, offer an option to do the conversion. We should say something about that as well.

@jedmao
Member
jedmao commented Jan 12, 2017 edited

It would be pretty annoying if you get a prompt every time someone opens up a file with mixed line endings. I think the description above is sufficient. The only thing you should do on file open is activate the editor setting. In some editors (e.g., vscode), this will mark the file as dirty. In other editors, it won't, so you wait until they save the file to perform any eol conversion. @ffes, does that make sense?

@jedmao
Member
jedmao commented Jan 12, 2017

Maybe we should say "activate" instead of "apply" editor setting? Would that be more clear?

@jedmao
Member
jedmao commented Jan 18, 2017 edited

I've added a Plugin Guidelines wiki page with a reference to it on the Home wiki page. Feel free to continue any discussion points here, but I'm closing the issue for now.

@jedmao jedmao closed this Jan 18, 2017
@xuhdev
Member
xuhdev commented Jan 18, 2017

@jedmao Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment