CsvEdit icon indicating copy to clipboard operation
CsvEdit copied to clipboard

Allow to configure separator and quote characters per-file and/or per-project

Open digulla opened this issue 7 years ago • 3 comments

I have a mix of CSV files (some with comma, some with semi colon).

It would be great if there was a per-file and per-project preferences where I can specify the defaults.

Right now, I can just do this globally.

Related to #7

digulla avatar Dec 20 '17 10:12 digulla

First, it is logical problem: where to store information about delimiter (comma vs semicolon )

Option A: support more than one (any of delimiters in list.)
Option B: use different filename extension, e.g. .csv, .ssv and so on.
Option C: per project settings (I think it less favorable)

paulvi avatar Dec 21 '17 06:12 paulvi

Many plug-ins allows to save per-file preferences.

I'm not sure whether Eclipse now has built-in support for this but what I saw is that other plug-ins create a file in /project/.settings/plug.in.id.prefs and inside they save per-file options.

The resource plugin uses this format:

encoding/path=UTF-8

The path is relative to the project root:

encoding//src/main/java=UTF-8

which is good enough for simple stuff.

Other plugins use

path=encoded options

where "encoded options" is all the options somehow compressed into a single string.

In this case, since we only have a few options, I think this approach might work:

separator=,
quote="
file/separator//src/main/resources/data/demo.csv=;

The first two lines set the defaults for the project, the third line overrides just the separator char for a certain file.

See also:

  • Tutorial on preferences: http://www.vogella.com/tutorials/EclipsePreferences/article.html

digulla avatar Dec 22 '17 10:12 digulla

Hi,

you could use some "hidden" file

for file some/path/my.csv it could be some/path/.my.csv.cec

charset=UTF8
separator=,
quote="

quazardous avatar Aug 06 '21 09:08 quazardous