diff --git a/src/qsharp/qsharp.ts b/src/qsharp/qsharp.ts index f5c2eb32..3093fef6 100644 --- a/src/qsharp/qsharp.ts +++ b/src/qsharp/qsharp.ts @@ -5,8 +5,30 @@ import type { languages } from '../fillers/monaco-editor-core'; +export const conf: languages.LanguageConfiguration = { + comments: { + lineComment: '//' + }, + brackets: [ + ['{', '}'], + ['[', ']'], + ['(', ')'] + ], + autoClosingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"', notIn: ['string', 'comment'] } + ], + surroundingPairs: [ + { open: '{', close: '}' }, + { open: '[', close: ']' }, + { open: '(', close: ')' }, + { open: '"', close: '"' } + ] +}; -export const language = { +export const language = { // Set defaultToken to invalid to see what you do not tokenize yet defaultToken: 'invalid', @@ -45,7 +67,7 @@ export const language = { 'intrinsic', 'let', 'set', - 'w\/', + 'w/', 'new', 'not', 'and', @@ -55,7 +77,7 @@ export const language = { 'using', 'borrowing', 'mutable' - ], + ], typeKeywords: [ 'Unit', @@ -136,16 +158,7 @@ export const language = { 'volatile' ], - constants: [ - 'true', - 'false', - 'PauliI', - 'PauliX', - 'PauliY', - 'PauliZ', - 'One', - 'Zero' - ], + constants: ['true', 'false', 'PauliI', 'PauliX', 'PauliY', 'PauliZ', 'One', 'Zero'], builtin: [ 'X', @@ -179,101 +192,104 @@ export const language = { ], operators: [ - 'and=', - '<-', - '->', - '*', - '*=', - '@', - '!', - '^', - '^=', - ':', - '::', - '..', - '==', - '...', - '=', - '=>', - '>', - '>=', - '<', - '<=', - '-', - '-=', - '!=', - 'or=', - '%', - '%=', - '|', - '+', - '+=', - '?', - '/', - '/=', - '&&&', - '&&&=', - '^^^', - '^^^=', - '>>>', - '>>>=', - '<<<', - '<<<=', - '|||', - '|||=', - '~~~', - '_', - 'w/', - 'w/=' + 'and=', + '<-', + '->', + '*', + '*=', + '@', + '!', + '^', + '^=', + ':', + '::', + '..', + '==', + '...', + '=', + '=>', + '>', + '>=', + '<', + '<=', + '-', + '-=', + '!=', + 'or=', + '%', + '%=', + '|', + '+', + '+=', + '?', + '/', + '/=', + '&&&', + '&&&=', + '^^^', + '^^^=', + '>>>', + '>>>=', + '<<<', + '<<<=', + '|||', + '|||=', + '~~~', + '_', + 'w/', + 'w/=' ], - symbols: /[=>