A standard extension for VSCode! Introducing the RainBow Query Language for CSV
Hello.
I'm Mandai, in charge of Wild on the development team.
For transferring data, CSV and TSV, which can be easily edited with a text editor, are easy to handle and convenient, but as the size increases, inconveniences become noticeable.
In such cases, we would like to introduce you to the divine extension of VSCode, RainBow Query Language (RBQL).
What kind of extension is it?
Generally, RBQL is often introduced as a tool that makes CSV and TSV easier to view on VSCode.
I also tried touching it at first because of that touch.
First of all, the visibility when opening a CSV file changes completely, and as the name suggests, the data color changes for each column.
I feel so hopeless when I open this kind of data in a text editor, where each row has a different data length...!
It seems like it's worth introducing just to be freed from that.
But this is just the beginning.
Surprisingly convenient function 1: Select all specified columns in all rows
Next, we will move on to the editing function, which will select all data in the same column position in all records using the multi-cursor.
Did things get a little too sudden?
I think this is a function that should be assigned a shortcut, but unfortunately it is not assigned by default, so you can assign a shortcut that suits you.
Of course, even if the data length varies and the starting position of the column is shifted, or even shifted, it will quickly select it without any problems.
If you want to use this function, you can use it by typing "edit select" in the command palette and selecting "Rainbow CSV: Column edit select" that appears.
Other similar features
- A function that sets the cursor at the beginning of each column instead of the selected state (Rainbow CSV: Column edit before)
- A function that sets the cursor at the end of each column instead of the selected state (Rainbow CSV: Column edit after)
There are also similar features such as
You can now select the most suitable function according to the scene, and it seems that you can edit data smarter than ever before.
Please note that this feature is not available for files with more than 1000 lines.
Incredibly useful feature 2: Display the number of columns and header as a tool tip when hovering over the cursor
"How many pieces of data is this...? 1...2...3..."
"Are you okay now?"
"Yes, it's okay (I don't understand anymore)"
Have you ever experienced something like this?
With RBQL, you no longer need to count columns!
Just by hovering over the data in the editor, the number of columns and header information will be displayed immediately.
Regarding header information, the information on the first line is treated as a header, so for CSV files where the data section starts from the first line, only the data on the first line will be visible.
Surprisingly useful function 3: Adjust column width to align vertical starting positions
A convenient function that adjusts the data start position of each row and aligns the vertical start positions for easier viewing.
This may be a useful feature when you want to check data in full screen.
However, since it is a function that makes changes to the data itself, it is better to confirm whether you want to save before closing.
If you want to use this feature, search for "align" in the command palette and select "Rainbow CSV: Align CSV Columns".
Truly useful feature RBQL
We have introduced various useful features, but the truly useful feature is the SQL-like query engine called RBQL, which is also the name of the extension.
When you enter "RBQL" in the command palette, the command "Rainbow CSV: RBQL" will appear, so select it.
This will open another editor with some tables and input forms as shown below.
The table displayed at the top is a table of the CSV that was created by executing the RBQL command.
The table can be scrolled with the left arrow, but unfortunately not with the mouse wheel.
The input form below the table is the key to this screen: the form for entering queries.
The CSV used in this sample has 15 columns, so the columns are named in SQL terms from a1 to a15.
NR is the line number automatically generated by RBQL.
SELECT a1
If you do this, a new editor will open with the information extracted from the first line written in it.
SELECT a1, a2
If you do this, it will be displayed as a CSV with the first and second rows extracted.
At this point, if you have a taste for SQL, you should be fine.
You can even change the order and concatenate strings using "+", so I think it can be used in a variety of ways.
Although I will not introduce it in detail here, there is also a JOIN function that uses another CSV file, making it possible to perform complex data combinations.
The select box below the query input form is an optional setting.
- Selecting the format of output information (csv/tsv)
- Character code in the query (select UTF-8 when using Japanese for search)
- Programming language to run RBQL
You will be able to choose.
In particular, the output format is useful because it allows you to easily convert between csv and tsv when combined with the "select *" query.
Furthermore, since it supports not only SELECT but also UPDATE, it is also possible to edit data on rows narrowed down by the WHERE clause.
summary
This time, we introduced RBQL, a divine extension that makes CSV/TSV dramatically easier to handle.
It's a good extension that has a wide range of useful functions, whether you're making small edits in the editor, checking data, or rewriting the entire data. I think so.
We have introduced some of the features, but there are also other features that we have not been able to introduce, so please try installing RBQL as a companion to VSCode.
That's it.