platers / obsidian-linter

An Obsidian plugin that formats and styles your notes with a focus on configurability and extensibility.
https://platers.github.io/obsidian-linter/
MIT License
1.19k stars 80 forks source link

Bug: Duplication. `.. Linter | Spacings | Tabsize` already defined in `Obsidian | Settings | Options | Editor | tab size` #1150

Open businessBoris opened 1 month ago

businessBoris commented 1 month ago

[I love the plugin. Please don't take this as criticism.]

Describe the Bug

Obsidian collects tabs-to-spaces figure which shouldn't be incongruous to the linters spaces-to-tabs figure. Linter provides no default, which should be collected from the system tabs-to-spaces figure.

How to Reproduce

Steps to reproduce the behaviour:

  1. Go to Obsidian | Settings | Options | Editor | tab size ("Number of spaces a tab is equivalent to")
  2. Observe slider indicating figure.
  3. Go to Third-party plugin | Linter | Spacings | Tabsize ("Number of spaces that will be converted to a tab")
  4. Observe no default.
  5. Observe that this figure is unneeded and is already provided in the host application. It doesn't make sense that the tabs-to-spaces and spaces-to-tabs would be different.
pjkaufman commented 1 month ago

Hey @businessBoris . Thank you for the feedback. I am not 100% sure how to best handle this scenario. I could default the value to be whatever is present in the Obsidian setting, but my biggest concern is that once it is set it would not reflect the Obsidian setting anymore if it changes. Would that be the expected behavior? Or do you think there is a better way to handle that?

businessBoris commented 1 month ago

Hi @pjkaufman!

Can you think of a situation where the tabs-to-spaces conversion is x and the spaces-to-tabs conversion should be y, where (x != y)?

May I suggest that you:

  1. Remove the box completely and refer the user to the main application conversion setting, in some form: eg."Conversion back to tabs uses the same ratio as the editor tabs-to-spaces.".
  2. Use the main application conversion setting when you convert back to tabs, being careful to act according to the switch Use tabs switch in Obsidian's editor settings.

To be clear, converting multiple spaces back to tabs if the Editor | Behaviour | Use tabs switch is off is the right linting thing to do. I don't know what you'd do if the Use tabs switch is on, and this linter switch is on too. Presumably the user will forever be wondering why their carefully inserted spaces always become tabs.

I think you can probably see the fun to be had!