Ubaid Khanzada
Ubaid Khanzada

Reputation: 21

Show error on Monaco Editor when closing bracket is missing

I am using monaco with Angular 5. Here is my custom language configuartion code

const config = {
      surroundingPairs: [
        { open: '{', close: '}' },
        { open: '[', close: ']' },
        { open: '(', close: ')' },
        { open: '<', close: '>' },
        { open: "'", close: "'" },
        { open: '"', close: '"' },
      ],
      autoClosingPairs: [
        { open: '{', close: '}' },
        { open: '[', close: ']' },
        { open: '(', close: ')' },
        { open: "'", close: "'", notIn: ['string', 'comment'] },
        { open: '"', close: '"', notIn: ['string', 'comment'] },
      ],
    };
    monaco.languages.setLanguageConfiguration(customLanguage, config);

It is auto closing the brackets but I want to show syntax error if somehow user forget to close the brackets. Like when user write code

function() {
console.log("hello world");

Monaco should show the syntax error on above line as '}' is missing.

Upvotes: 0

Views: 884

Answers (0)

Related Questions