Search code examples
jsoncsvtextcolortext-coloring

Can I edit text color by letters in VS?


I work with .csv database and I need to color all words with specific color that start with letter "G" but i cant find tutorial or something that would help me.

I try settings.json with "editor.tokenColorCustomizations" but it only colors my columns. Then I try work with TODOs (TODO+) extension, but also nothing.

I need all word "GPCM_Norm" to be red

Thats my settings.json


Solution

  • It can only be a matter of the right regex in TODO+ but I don't think TODO+ is appropriate for the task.
    As I suggested in my comment try highlight extension from the same author of TODO+. This is a more generic extension suitable for what yo try to achieve.
    Add this to highlight.regexes section. It´s supposed to grab all words starting with G in data.csv file and color them red

            "(\\bG[\\w]+)": {
                "filterFileRegex": "data.csv",
                "decorations": [
                    {
                        "color": "#ff0000"
                    }
                ]
    

    Change the regex "(\\bG[\\w]+)" to suit your needs, also the color and the filename