Skip to content

Commit

Permalink
#8 add config option to disable Rainbow CSV for very big files
Browse files Browse the repository at this point in the history
  • Loading branch information
mechatroner committed Sep 8, 2018
1 parent 090f3a5 commit cb38bed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ Default: _True_

Enable content-based separator autodetection

#### "rainbow_csv_max_file_size_bytes"
Type: _int_

Disable Rainbow CSV for files bigger than the specified size. This can be helpful to prevent poor performance and sublime crashes on very large files.
Manual separator selection will override this setting for the current file.
E.g. to disable on files larger than 100 MB, set `"rainbow_csv_max_file_size_bytes": 100000000`

#### "rbql_backend_language"
Type: _string_
Expand Down
3 changes: 3 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,9 @@ def autodetect_content_based(view):
def run_rainbow_init(view):
if view.settings().get('rainbow_inited') is not None:
return
max_file_size = view.settings().get('rainbow_csv_max_file_size_bytes', None)
if max_file_size is not None and view.size() > max_file_size:
return
view.settings().set('rainbow_inited', True)
file_path = view.file_name()
if file_path is not None:
Expand Down

0 comments on commit cb38bed

Please sign in to comment.