Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coloring doesn't work properly #105

Closed
kanlukasz opened this issue Jan 21, 2022 · 5 comments
Closed

Coloring doesn't work properly #105

kanlukasz opened this issue Jan 21, 2022 · 5 comments

Comments

@kanlukasz
Copy link

kanlukasz commented Jan 21, 2022

From what I can see the coloring is not working properly

Screenshot:

image

Delimiter used in the CSV file:

;

CSV to test:

SYMBOL;NAME;EAN;CENAHURT;CENADETAL;WEIGHT;OBJ;SYMBOL;NAME;EAN;CENAHURT;CENADETAL;WEIGHT;OBJ;SYMBOL;NAME;EAN;CENAHURT;CENADETAL;WEIGHT;OBJ
1102;toaletka1102antycz;5901477200014;5;6;9;<imgsrc="https://server.com/sssss.jpg">;1102;toaletka1102antycz;5901477200014;5;6;9;<imgsrc="https://server.com/sssss.jpg">;1102;toaletka1102antycz;5901477200014;5;6;9;<imgsrc="https://server.com/sssss.jpg">
1102bb;toaletka1102biało-biała;5901477231186;540,35;6;663,33;66;1102bb;toaletka1102biało-biała;5901477231186;540,35;6;663,33;66;1102bb;toaletka1102biało-biała;5901477231186;540,35;6;663,33;66
acoma160szd;łóżkoacoma160x200kolorszary/dąbt.ap;69,6;5;jjj;5;6;acoma160szd;łóżkoacoma160x200kolorszary/dąbt.ap;69,6;5;jjj;5;6;acoma160szd;łóżkoacoma160x200kolorszary/dąbt.ap;69,6;5;jjj;5;6

Tested in the environment:

Version: 1.63.2
Commit: 899d46d82c4c95423fb7e10e68eba52050e30ba3
Date: 2021-12-15T09:40:02.816Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19044
@kanlukasz
Copy link
Author

Oh, looks like string delimiters needs to be used too.
Can we get around this somehow?
I have a large database where string delimiters for " or > are not included

@mechatroner
Copy link
Owner

Looks like you just need to switch filetype to CSV (semicolon) or select the semicolon character -> right click -> Set as Rainbow Separator.

looks like string delimiters needs to be used too.

Do you mean that " have no special meaning in your case? Yeah, this is one of the current limitations, there is only one csv dialect with string escape characters. I could create another dialect and name it e.g. csv simple but this might add some confusion by being present in the filetype list, unlike some other editors VSCode currently doesn't support dynamic syntax generation.
BTW there is also csv (pipe) dialect which doesn't put special meaning into " characters so you can theoretically replace all commas with | character and switch the filetype to csv (pipe)

@kanlukasz
Copy link
Author

kanlukasz commented Jan 22, 2022

Looks like you just need to switch filetype to CSV (semicolon) or select the semicolon character -> right click -> Set as Rainbow Separator.

Yes you are right. Everything works fine after using this option 👍

Do you mean that " have no special meaning in your case?

As you can see in my example, " and < is used in the body of the CSV file because it has a column with html content like img src
So (for example) i can't use Align option because it gets an error:
image
Is this the limitation you mentioned?

@mechatroner
Copy link
Owner

Yeah, basically to handle your use case there should be a "non-standard" semicolon dialect, but it is not viable to add it right now, unfortunately. As I mentioned you can try to replace ; with | or TAB and switch the dialect to csv (pipe) or TSV. Another option is to replace all double quotes with e.g. single quotes or double single quotes: " -> '', this would also allow you to align the file.
And BTW having < in the file is not a problem since all CSV dialects that I am aware of do not handle this character in any special way.
The general solution to this problem is dynamic syntax generation which is also discussed in #1

@kanlukasz
Copy link
Author

I cannot change the structure as this file will be imported into another application later.
Thanks for the clarification anyway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants