mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2025-12-27 10:33:59 -05:00
Fix comment syntax highlighting for Haskell (#8135)
This adds syntax highlighting for block comments `{- ... -}` and
configuration to support the “add comment” and “remove comment” keyboard
shortcuts.
This commit is contained in:
@@ -77,20 +77,30 @@ function definition(): monaco.languages.IMonarchLanguage {
|
||||
],
|
||||
|
||||
comment: [
|
||||
[/[^/*]+/, 'comment'],
|
||||
[/\*\//, 'comment', '@pop'],
|
||||
[/[/*]/, 'comment'],
|
||||
[/[^{-]+/, 'comment'],
|
||||
[/{-/, 'comment', '@push'],
|
||||
[/-}/, 'comment', '@pop'],
|
||||
[/[{-]/, 'comment'],
|
||||
],
|
||||
|
||||
whitespace: [
|
||||
[/[ \t\r\n]+/, 'white'],
|
||||
[/\/\*/, 'comment', '@comment'],
|
||||
[/\/\/.*$/, 'comment'],
|
||||
[/{-/, 'comment', '@comment'],
|
||||
[/--.*$/, 'comment'],
|
||||
],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function configuration(): monaco.languages.LanguageConfiguration {
|
||||
return {
|
||||
comments: {
|
||||
lineComment: '--',
|
||||
blockComment: ['{-', '-}'],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
monaco.languages.register({id: 'haskell'});
|
||||
monaco.languages.setMonarchTokensProvider('haskell', definition());
|
||||
monaco.languages.setLanguageConfiguration('haskell', configuration());
|
||||
|
||||
Reference in New Issue
Block a user