Coder Social home page Coder Social logo

mechatroner / sublime_rainbow_csv Goto Github PK

View Code? Open in Web Editor NEW
111.0 4.0 7.0 620 KB

🌈Rainbow CSV - Sublime Text Package: Highlight columns in CSV and TSV files and run queeries in SQL-like language

License: MIT License

Python 60.81% JavaScript 39.19%
sublime-text-plugin csv tsv syntax-highlighting sql sql-like

sublime_rainbow_csv's People

Contributors

gregsadetsky avatar mechatroner avatar stoivo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sublime_rainbow_csv's Issues

A way to save query

Hello,

It could be great to habe a way to save some requests like

SELECT a1, a2 ORDER BY parseInt(a2), parseInt(a1.split(".").join(""))

:)

Option to start columns at 0

We have other software at our company that reads CSVs as 0,1,2,3 rather than 1,2,3,4

I love the extension, however, I haven't seen an option to start at 0 rather than 1. Is this possible now? If not can it be added as an option?

I can't tell you how many times I've messed up something just forgetting mentally to -1 from the pop-up.

Thanks for any consideration. :-)

image

Package disappeared after update

Hello,

A few days ago rainbow_csv stopped working on Sublime. The package appears in the package list, but it's no longer visible in the View > Syntax list and csv files are not colored. I imagine the package was updated just before it stopped working since the last version came out in the weekend. I tried removing it and reinstalling it but no luck. Any clues on what might have happened?

I have the following versions:
Rainbow CSV v. 2.0.0
Sublime version: 3.2.2, Build 3211
Mac Catalina v.10.15.5

Thanks!

| 'pipe' separator auto-detection not working

Hello,
first of all, thank you for this FANTASTIC Sublime package, it saves me a great deal of time analysing csv files.
It worked seamless opening files with 'comma' delimiter. When we changed to 'pipe' separator it did not auto-detect it.

I have upgraded Sublime and the package to latest version.
Sublime Text v3.2
sublime_rainbow_csv v1.1.1

I have tried to change user settings with no success. "enable_rainbow_csv_autodetect": true/false. If I manually set separator in menu "Enable standard" or "Enable simple". It highlights the repeated re-open of file. But for every new csv file I have to set it manually again, and I deal with a lot of files.

Could this be somehow defined in settings, or simply changed in application code? If not, could it be fixed?

Issue example
image

Plugin breaks when line is > 16383 characters long

I am working with large JSON dumps and noticed that plugin doesn't work when a line has greater than 16383 characters. The whole line just shows up as a the default text color (white in my case). If I truncate the line, the coloring works again as it should.

This behavior is line-by-line, so it ends up making a striped effect because of lines that are too long being white and lines that are less than the threshold having the correct coloring scheme.

rainbow csv crash on large files

I have constantly used rainbow CSV.
Some of files I am working with are over 100 MB. Rainbow CSV just make sublime crash.
Is there a way to change the config file of Rainbow CSV, such that it will skip to interpret CSV files if it is over a size limit?

Custom delimeters

Hey there!

I would like to improve the project adding a custom delimeter setting to the project. What do you think about the idea?

Spell-check and quote logic.

(These effects were discovered using tab delimited notes, a useful but probably unintended use-case. The problems however persist to comma separated content.)

  • The second column does not receive spell-check, other columns do.
    • spell-chicked,not spell-chicked,spell-chicked
  • Text before or after quoted contents has strange results
    • These are invalid, but I think they should be treated as the same column.
    • "a,b"c
    • d"a,b"

Align columns with spaces adds trailing spaces

The alignment works nicely from the very limited testing I've done, but the final column is also processed for equal width with trailing spaces. This means that if one line is long enough for the final element to trigger a word wrap, every line becomes long enough to trigger a word wrap, which is both annoying and confusing as there doesn't seem to be any reason for it unless the user has whitespace shown

referencing by column name not working..?

Hi,

I don't seem to be able to use the a.col_name notation when making queries. The typical a1 (i.e. a + int) notation works.

I created this test file:

col1,col2,col3,vehicle_price,Vehicle type
test1,test2,test3,20,car
test1,test2,test3,200,plane
test1,test2,test3,2000,boat

and tried running select a.col1 but got this error:

Details:
query execution
At record 1, Details: 'RBQLRecord' object has no attribute 'col1'

I also tried running the select len(a.vehicle_price) / 10, a2 where int(a.vehicle_price) < 500 and a['Vehicle type'] in ["car", "plane", "boat"] limit 20 query from the README (here) and got a similar error (... RBQLRecord has no attribute ...)

I'm running the latest 2.8.0 release of the package.

Thank you!

Not able to activate the plugin

Not able to enable the plugin. the menu is disabled. Do I need node or some other additional stuff installed to make it work?

image

Cannot run query on temporary buffer (i.e. unsaved file)

Hi,

Thank you for the wonderful extension, I use it very frequently and adore it!

I was wondering if the extension is supposed to work on unsaved files?

I sometimes copy and paste bits of CSV into a new Sublime window, and manually set the syntax to "CSV (Rainbow)". The auto coloring works, but I cannot execute queries. Every time I do, I get the following error:

"RBQL Error. Unable to run query for this buffer"

After saving the file to a temporary location, I'm able to execute queries. Is there a way that queries could be run on unsaved files?

Thank you very much!

Issue with importing uuid class?

Hello,
I've had a monthly batch process that I've been using for about a year based on this sublime plugin which has been working great. It uses some UDFs defined in the .rbql_init_source.py file that require the uuid functions. So i've had 'import uuid' at the top of the init file working great for ages. A few weeks ago I started trying to run the process (skipped Feb this year, so I think my last successful run was with 1.5.0) and now it acts like the import uuid statement no longer works, as I get 'undefined global uuid' error when running my function within the query.
At first, I assumed it was something wonky with the sublime embedded python and started rolling back versions of ST3 to no avail. Even confirmed / recompiled the 3.3.6 pyo for the uuid class, etc.
After no luck there, I tried running the same process using VSCode and its corresponding rbql plugin, with the same result. So, I'm guessing some sort of weird conflict has come up with uuid, since I can import sys and use functions there with no problem.

I confirmed I can exec the functions from the python cli on the system level.

Steps for simple repro:

Install any recent version of ST3 and install Rainbow_CSV from package control
.rbql_init_source.py:

import uuid
import sys

def bob():
	return sys.version

def joe():
	return uuid.uuid4()

Open up a csv file in ST3 and run the following:
update set a1 = joe()

query execution, Error at line 1, details: global name 'uuid' is not defined

Now try this:
update set a1 = bob()
File executes and replaces with the expected embedded python version string

I'm going to downgrade to 1.5.0 and see if comes back, but figured I'd post here too in case anyone has run into this and has a quick solution I'm missing.

[updated] - downgraded the st3 package to 1.5.0 by replacing the folder under packages and now it works again.

Thanks!

missing package settings

The settings for the package do not appear inside Preferences -> Package Settings. I need to change the "rainbow_csv_max_file_size_bytes" setting and can't find where to. My Sublime Text is 3.1.1, Build 3176 and I'm using a portable version. Do you know what might be the issue?

RBQL: Support monocolumn policy

Hello @mechatroner

Thank you for this great plugin, I would like to know if there is a possibility to include the header in the new temp tab with sub CSV data, result of the RQBL?

When it only contains few columns, it is still OK, but it's not always easy to read with a lot of rows/columns, without the header... ='(

Thank you in adavance for your reply

Cheers,

I have tried to append 2 RBQL but it does not us allow to do that

SELECT TOP 1 * UNION SELECT * WHERE re.match('GP001189', a2)

The first part will grab the header etc...

use_custom_rainbow_colors has no effect

Trying to change the colors manually inside RainbowCSV.sublime-color-scheme after setting use_custom_rainbow_colors to true but it does not seem to have any effect, am i missing something?

The order of colors and a bug with a comma

It seems to me that the order of colors is somewhat random. I don't know is it a bug or by intent, but I would prefer a more predictable order. For example: red, green, blue, violet, red, green, blue, violet, red, green, blue, violet, and so on.

image

Also, it seems there is a bug with a comma: notice that a comma before 8, 11, 18, and 21 should be white.

Tested with Mariana default color scheme.

RBQL not working

Rainbow coloring of csv/tsv files works fine. However, I get this error message during loading and none of the right-click accessible items, including RBQL queries, from 'Rainbow CSV' are available:

Traceback (most recent call last):
  File "/opt/sublime_text/sublime_plugin.py", line 109, in reload_plugin
    m = importlib.import_module(modulename)
  File "./python3.3/importlib/__init__.py", line 90, in import_module
  File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "/opt/sublime_text/sublime_plugin.py", line 915, in load_module
    exec(compile(source, source_path, 'exec'), mod.__dict__)
  File "sublime_rbql in /home/username/.config/sublime-text-3/Installed Packages/rainbow_csv.sublime-package", line 10, in <module>
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "/opt/sublime_text/sublime_plugin.py", line 915, in load_module
    exec(compile(source, source_path, 'exec'), mod.__dict__)
  File "rbql_core.rbql in /home/username/.config/sublime-text-3/Installed Packages/rainbow_csv.sublime-package", line 52, in <module>
  File "./python3.3/codecs.py", line 896, in open
NotADirectoryError: [Errno 20] Not a directory: '/home/username/.config/sublime-text-3/Installed Packages/rainbow_csv.sublime-package/rbql_core/template.js.raw'

I am using ST version 3 build 3143 and rainbow_csv v0.2.0

I tried to uninstall/reinstall but didn't help. Any suggestions how to fix this issue is really appreciated. Thanks.

Keybinding

Sublime maps F5 to sort. But so does this plugin, and somehow now both are happening.

.../Sublime Text 3/Packages/Default/Default (OSX).sublime-keymap

	{ "keys": ["f5"], "command": "sort_lines", "args": {"case_sensitive": false} },
	{ "keys": ["ctrl+f5"], "command": "sort_lines", "args": {"case_sensitive": true} },

Can you pick a different key?

Make generated syntaxes a sub-flavor of `text.csv`

scope: text.{}

scope: text.{}

Can these lines add a csv. so that the format of the root scope property in the generated .sublime-syntax is text.csv.XXXX? Then text.csv will match all variants, and specific variants can still be targeted with text.csv.XXXX.

I believe this would allow the package I use for sidebar icons to recognize the variants as text.csv and apply the correct icon to them.

Add csv and tsv content-based autodetection

Some csv and tsv files do not have *.csv or *.tsv extensions, but we still want to highlight them. In order to do this we need to run a table auto-detection function when a new file is being opened (unless some syntax was already assigned to it). The same logic is used in Vim version of the plugin.

Light background

Is there any way to leave a light background when the .csv file is opened?

PSV support

Can you add support for PSV (pipe-separated) too? Or is it possible to have setting where we can list custom extensions to apply rainbow color scheme?
Currently I have PSV and I want to automatic apply rainbow mode on file open.

Typos in default user settings file

The default user settings file (copied below) has an erroneous , & missing -settings in the file name.

// Settings in here override those in "RainbowCSV.sublime",

{
	
}

Does this plugin support multiline column?

Does this plugin support multiline within a column?

I have a csv looks like this, which col_B contains multiline content enclosed by quote:

col_A, col_B, col_C
apple,"normal text", 12.5
banana, "This is
multi-line
content", 14
watermelon,text,20

When parsed by this plugin, it shows me "This line has quoting error"

Long data problem

screen shot 2018-06-01 at 13 43 42

If data string is long plugin does not work good – no syntax highlight

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.