janisdd / vscode-edit-csv

vs code extension to edit csv files with an excel like table ui
MIT License
220 stars 32 forks source link

Add a "View only mode" #66

Closed Tosh0kan closed 3 years ago

Tosh0kan commented 3 years ago

Version?

Feature

Add a strictly "viewing" mode, where all the options at the top are hidden. I like to edit my csv on Notepad++, but Excel Viewer sucks because it can't organize the rows by the source row order. Yours can.

janisdd commented 3 years ago

There are some questions:

What options at the top should be hidden? The only thing that makes sense to me is are the write options (and some buttons e.g. apply changes, add row…).

Tosh0kan commented 3 years ago
* Should the view directly load into readonly mode? Then we need a configuration option

  * If not, we need a new button in the option sections (so one can toggle readonly while viewing the table)

Honestly, whatever it's easiest for you to implement. Personally, I'm partial to a new option on the drop down menu when clicking with the right mouse button.

What options at the top should be hidden? The only thing that makes sense to me is are the write options (and some buttons e.g. apply changes, add row…).

These: https://i.imgur.com/pytl2tw.jpeg

janisdd commented 3 years ago

Personally, I'm partial to a new option on the drop down menu when clicking with the right mouse button.

The context menu? Hm I don't think this suited for that as all actions in are meant to be applied to one cell/row/column.

As for the options to hide (the 2 "rows"):

Hiding these will introduce too much extra conditions, disabling is probably the way to go. Disabling also allows to add a new toggle button to switch from readonly to edit mode and vice versa.

I'll also add a config option to always start in readonly (or edit) mode.

Tosh0kan commented 3 years ago

I see. I actually was going to suggest you add an option by default, but I thought that was harder than adding a new option to the context menu.

Also, another good idea is to add a checkbox option that reads the first row as a header by default.

janisdd commented 3 years ago

Also, another good idea is to add a checkbox option that reads the first row as a header by default.

This is already an option: csv-edit.readOption_hasHeader

janisdd commented 3 years ago

There are some still some things I'm not 100% sure about:

Docs: There are also some things to keep in mind even if readonly mod is enabled:

Tosh0kan commented 3 years ago

should column/row reordering be allowed? I think this is ok to keep it

Sorry, I don't quite get what you mean. Could you rephrase it?

generally everything that is done before the table is create is done

Sounds fine to me.

changes to the source file from outside the extension are not prevented (only the table is readonly)

You mean, for example, I edited the csv outside VSCode with Notepad++, it wouldn't prevent that? If so, then it is as it should, in my opinion, as long as the read-only view automatically reloads if changes are made to the file, whether the changes are done with VSCode or some other software.

janisdd commented 3 years ago

should column/row reordering be allowed? I think this is ok to keep it

Sorry, I don't quite get what you mean. Could you rephrase it?

Currently you can drag'n'drop columns/rows to reorder them (when you click on the headers).

When the file is changed outside of the extension a dialog is displayed where you can decide to reload the file or not.

Tosh0kan commented 3 years ago

Ah okay. In that case, in Read-only, column reordering shouldn't be allowed in my opinion.

janisdd commented 3 years ago

Think this is finished now and will be shipped in the next update.

I also disabled