Skip to content

Commit

Permalink
Fixed highlighting for monaco (finos#855)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCockx authored Oct 8, 2024
1 parent 5e14afd commit 4159a4e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
25 changes: 14 additions & 11 deletions rosetta-ide/rosetta.tmLanguage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1038,19 +1038,22 @@ repository:
- include: '#documentationFollowedByExpression'

expression:
include: '#parameterizedExpression'
arguments:
extraEnd: ''
patterns:
- include: '#parameterizedExpression'
arguments:
extraEnd: ''

expressionWithoutThenOperation:
include: '#parameterizedExpression'
arguments:
extraEnd: '(?={{wordStart}}then{{wordEnd}})|'
patterns:
- include: '#parameterizedExpression'
arguments:
extraEnd: '(?={{wordStart}}then{{wordEnd}})|'

expressionWithoutThenAndDefaultOperation:
include: '#parameterizedExpression'
arguments:
extraEnd: '(?={{wordStart}}then|default{{wordEnd}})|'
patterns:
- include: '#parameterizedExpression'
arguments:
extraEnd: '(?={{wordStart}}then|default{{wordEnd}})|'

parameterizedExpression:
parameters: ['extraEnd']
Expand Down Expand Up @@ -1167,7 +1170,7 @@ repository:
- name: meta.switch-operation.rosetta
begin: '{{wordStart}}switch{{wordEnd}}'
beginCaptures:
0: { name: keyword.operator.word.rosetta }
0: { name: keyword.control.conditional.switch.rosetta }
end: '{{extraEnd}}{{expressionEndIgnoringComma}}'
patterns:
- include: '#comment'
Expand Down Expand Up @@ -1370,4 +1373,4 @@ repository:

comma:
name: punctuation.separator.comma.rosetta
match: ','
match: ','
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,11 @@ private void validatePattern(TmValue<Object> pattern, Map<Object, Object> namedP
// - begin/while
// - list of patterns
if (tmMap.value.get("include") != null) {
if (!tmMap.path.get(tmMap.path.size() - 1).equals("patterns")) {
// Note: this check is only necessary for Monaco. See https://github.com/zikaari/monaco-textmate/issues/13.
// VS Code supports direct includes.
throw new ConfigurationException("Validation failed on include: may only be used inside 'patterns'. " + tmMap.getPath());
}
runValidators(tmMap, Map.of("include", include, "comment", comment, "repository", repository));
} else if (tmMap.value.get("match") != null) {
runValidators(tmMap, Map.of("name", scopes, "match", regex, "captures", captures, "comment", comment, "repository", repository));
Expand Down

0 comments on commit 4159a4e

Please sign in to comment.