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

Improve syntax highlighting of OCaml comments that contain strings #289

Merged
merged 2 commits into from
Jul 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
`before-except-val`, and `unset` (#288)
- Fix Reason syntax highlighting of binding operators (#291)
- Fix Reason syntax highlighting of type extensions (#292)
- Improve syntax highlighting of OCaml comments that contain strings (#289)

## 0.8.0

Expand Down
7 changes: 1 addition & 6 deletions syntaxes/menhir.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,13 @@

"comments": {
"patterns": [
{ "include": "source.ocaml#comments" },
{
"comment": "c-style block comment",
"name": "comment.block.menhir",
"begin": "/\\*",
"end": "\\*/"
},
{
"comment": "ocaml-style block comment",
"name": "comment.block.other.menhir",
"begin": "\\(\\*",
"end": "\\*\\)"
},
{
"comment": "c-style line comment",
"name": "comment.line.menhir",
Expand Down
21 changes: 20 additions & 1 deletion syntaxes/ocaml.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
"end": "\\*\\)",
"patterns": [
{ "include": "source.ocaml.ocamldoc#markup" },
{ "include": "#strings-in-comments" },
{ "include": "#comments" }
]
},
Expand All @@ -140,7 +141,25 @@
"name": "comment.block.ocaml",
"begin": "\\(\\*",
"end": "\\*\\)",
"patterns": [{ "include": "#comments" }]
"patterns": [
{ "include": "#strings-in-comments" },
{ "include": "#comments" }
]
}
]
},

"strings-in-comments": {
"patterns": [
{
"comment": "string literal",
"begin": "\"",
"end": "\""
},
{
"comment": "quoted string literal",
"begin": "\\{[^|]*\\|",
"end": "\\|[^}]*\\}"
}
]
},
Expand Down