Merge pull request #3115 from pratik-m/add-pipe-delimter-to-csv-syntax

Adding pipe delimeter support for csv files
This commit is contained in:
Keith Hall 2024-11-13 20:24:20 +02:00 committed by GitHub
commit 517ddd8e00
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 10 deletions

View File

@ -64,6 +64,7 @@
- Add support for [CFML](https://www.adobe.com/products/coldfusion-family.html), see #3031 (@brenton-at-pieces) - Add support for [CFML](https://www.adobe.com/products/coldfusion-family.html), see #3031 (@brenton-at-pieces)
- Map `*.mkd` files to `Markdown` syntax, see issue #3060 and PR #3061 (@einfachIrgendwer0815) - Map `*.mkd` files to `Markdown` syntax, see issue #3060 and PR #3061 (@einfachIrgendwer0815)
- Add syntax mapping for kubernetes config files #3049 (@cyqsimon) - Add syntax mapping for kubernetes config files #3049 (@cyqsimon)
- Adds support for pipe delimiter for CSV #3115 (@pratik-m)
- Add syntax mapping for `/etc/pacman.conf` #2961 (@cyqsimon) - Add syntax mapping for `/etc/pacman.conf` #2961 (@cyqsimon)
## Themes ## Themes

View File

@ -7,14 +7,14 @@ file_extensions:
- tsv - tsv
scope: text.csv scope: text.csv
variables: variables:
field_separator: (?:[,;\t]) field_separator: (?:[,;|\t])
record_separator: (?:$\n?) record_separator: (?:$\n?)
contexts: contexts:
prototype: prototype:
- match: (?={{record_separator}}) - match: (?={{record_separator}})
pop: true pop: true
fields: fields:
- match: '' - match: ""
push: push:
- field_or_record_separator - field_or_record_separator
- field4 - field4
@ -26,15 +26,15 @@ contexts:
- field1 - field1
main: main:
- meta_include_prototype: false - meta_include_prototype: false
- match: '^' - match: "^"
set: fields set: fields
field_or_record_separator: field_or_record_separator:
- meta_include_prototype: false - meta_include_prototype: false
- match: '{{record_separator}}' - match: "{{record_separator}}"
scope: punctuation.terminator.record.csv scope: punctuation.terminator.record.csv
pop: true pop: true
- match: '{{field_separator}}' - match: "{{field_separator}}"
scope: punctuation.separator.sequence.csv scope: punctuation.separator.sequence.csv
pop: true pop: true
@ -56,23 +56,22 @@ contexts:
pop: true pop: true
field1: field1:
- match: '' - match: ""
set: set:
- meta_content_scope: meta.field-1.csv support.type - meta_content_scope: meta.field-1.csv support.type
- include: field_contents - include: field_contents
field2: field2:
- match: '' - match: ""
set: set:
- meta_content_scope: meta.field-2.csv support.function - meta_content_scope: meta.field-2.csv support.function
- include: field_contents - include: field_contents
field3: field3:
- match: '' - match: ""
set: set:
- meta_content_scope: meta.field-3.csv constant.numeric - meta_content_scope: meta.field-3.csv constant.numeric
- include: field_contents - include: field_contents
field4: field4:
- match: '' - match: ""
set: set:
- meta_content_scope: meta.field-4.csv keyword.operator - meta_content_scope: meta.field-4.csv keyword.operator
- include: field_contents - include: field_contents