porcupine icon indicating copy to clipboard operation
porcupine copied to clipboard

detect indentation from file

Open Akuli opened this issue 2 years ago • 1 comments

Today I edited my ~/.ssh/config with porcupine. It ended up having a few spaces-indented lines, even though most of it is indented with tabs.

Ideally Porcupine would automatically detect whether the file is indented with tabs or spaces, and if spaces, how many spaces. This should have lower priority than editorconfig, but perhaps higher priority than filetypes.toml: even if you usually indent python files with spaces, for example, you might want to use tabs when editing a tab-indented script you downloaded from somewhere.

Akuli avatar May 26 '22 20:05 Akuli

It would also be cool if it marked the indentation with white lines to show indentation better as done in VS Code

Moosems avatar Jul 24 '22 17:07 Moosems

Not quite sure how you'd do that. If just add an item to the status bar allowing you to easily change the indentation type and size.

Moosems avatar Jun 29 '23 10:06 Moosems

By detecting, I meant something like this:

  • Prefer editorconfig if exists
  • Otherwise, if file contains "\n\t" then tabs
  • Otherwise, if file contains "\n ", take the first such line and it's most likely how many spaces that line starts with
  • Otherwise use filetypes.toml

Akuli avatar Jun 29 '23 22:06 Akuli

I like this sam I am.

Moosems avatar Jun 29 '23 22:06 Moosems