taplo icon indicating copy to clipboard operation
taplo copied to clipboard

The wrong format from multi-line basic string

Open leolcao opened this issue 2 years ago • 2 comments

From the https://toml.io/en/v1.0.0#string, I found the sample str7 will make the color style of rest part in toml file become to invalid style.

str4 = """Here are two quotation marks: "". Simple enough."""
# str5 = """Here are three quotation marks: """."""  # INVALID
str5 = """Here are three quotation marks: ""\"."""
str6 = """Here are fifteen quotation marks: ""\"""\"""\"""\"""\"."""

# "This," she said, "is just a pointless statement."
str7 = """"This," she said, "is just a pointless statement.""""

# What you see is what you get.
winpath  = 'C:\Users\nodejs\templates'
winpath2 = '\\ServerX\admin$\system32\'
quoted   = 'Tom "Dubs" Preston-Werner'
regex    = '<\i\c*\s*>'


regex2 = '''I [dw]on't need \d{2} apples'''
lines  = '''
The first newline is
trimmed in raw strings.
   All other whitespace
   is preserved.
'''

result:

image

But, the syntax is right, and I still can use 'copy as json' to get right result.

{
  "str4": "Here are two quotation marks: \"\". Simple enough.",
  "str5": "Here are three quotation marks: \"\"\".",
  "str6": "Here are fifteen quotation marks: \"\"\"\"\"\"\"\"\"\"\"\"\"\"\".",
  "str7": "\"This,\" she said, \"is just a pointless statement.\"",
  "winpath": "C:\\Users\\nodejs\\templates",
  "winpath2": "\\\\ServerX\\admin$\\system32\\",
  "quoted": "Tom \"Dubs\" Preston-Werner",
  "regex": "<\\i\\c*\\s*>",
  "regex2": "I [dw]on't need \\d{2} apples",
  "lines": "The first newline is\ntrimmed in raw strings.\n   All other whitespace\n   is preserved.\n"
}

vscode version: 1.82.2 extension version: v0.19.2

leolcao avatar Sep 29 '23 08:09 leolcao

I don't think Taplo is responsible for syntax highlighting. At least that's not how it works in Emacs. Did you try not using Taplo and see if you have the same issue?

ia0 avatar Sep 29 '23 08:09 ia0

I don't think Taplo is responsible for syntax highlighting.

We have to provide a grammar for vscode as it has no built-in syntax highlighting for toml.

tamasfe avatar Sep 29 '23 10:09 tamasfe