How to use the monaco-editor-core.languages function in monaco-editor-core

To help you get started, we’ve selected a few monaco-editor-core examples, based on popular ways it is used in public projects.

github microsoft / BotFramework-Composer / Composer / packages / tools / language-servers / language-understanding / demo / src / client.ts View on Github external
monaco.languages.setMonarchTokensProvider('botframeworklu', {
  ignoreCase: true,
  tokenizer: {
    root: [],
  },
});

monaco.languages.register({
  id: 'bflu',
  extensions: ['.lu'],
  aliases: ['LU', 'language-understanding'],
  mimetypes: ['application/lu'],
});

monaco.languages.setLanguageConfiguration('bflu', {
  autoClosingPairs: [
    { open: '{', close: '}' },
    { open: '[', close: ']' },
    { open: '(', close: ')' },
  ],
});

monaco.editor.defineTheme('lutheme', {
  base: 'vs',
  inherit: false,
  colors: {},
  rules: [],
});

// create Monaco editor
const value = `@  ml a
github microsoft / BotFramework-Composer / Composer / packages / tools / language-servers / language-understanding / demo / src / client.ts View on Github external
import * as monaco from 'monaco-editor-core';
import { listen, MessageConnection, Disposable } from 'vscode-ws-jsonrpc';
import {
  MonacoLanguageClient,
  CloseAction,
  ErrorAction,
  MonacoServices,
  createConnection,
} from 'monaco-languageclient';

import normalizeUrl = require('normalize-url');
const ReconnectingWebSocket = require('reconnecting-websocket');

// register Monaco languages

monaco.languages.setMonarchTokensProvider('botframeworklu', {
  ignoreCase: true,
  tokenizer: {
    root: [],
  },
});

monaco.languages.register({
  id: 'bflu',
  extensions: ['.lu'],
  aliases: ['LU', 'language-understanding'],
  mimetypes: ['application/lu'],
});

monaco.languages.setLanguageConfiguration('bflu', {
  autoClosingPairs: [
    { open: '{', close: '}' },
github microsoft / BotFramework-Composer / Composer / packages / tools / language-servers / language-generation / demo / src / client.ts View on Github external
import * as monaco from 'monaco-editor-core';
import { listen, MessageConnection } from 'vscode-ws-jsonrpc';
import {
  MonacoLanguageClient,
  CloseAction,
  ErrorAction,
  MonacoServices,
  createConnection,
} from 'monaco-languageclient';
import normalizeUrl = require('normalize-url');
const ReconnectingWebSocket = require('reconnecting-websocket');

// register Monaco languages

monaco.languages.setMonarchTokensProvider('botbuilderlg', {
  ignoreCase: true,
  brackets: [
    { open: '{', close: '}', token: 'delimiter.curly' },
    { open: '[', close: ']', token: 'delimiter.bracket' },
    { open: '(', close: ')', token: 'delimiter.parenthesis' },
  ],
  tokenizer: {
    root: [
      // template name line
      [/^\s*#/, { token: 'template-name', next: '@template_name' }],
      // template body
      [/^\s*-/, { token: 'template-body-identifier', goBack: 1, next: '@template_body' }],
      //comments
      [/^\s*>/, { token: 'comments', next: '@comments' }],
      // import statement in lg
      [/\[.*\]/, 'imports'],
github microsoft / BotFramework-Composer / Composer / packages / tools / language-servers / language-generation / demo / src / client.ts View on Github external
[/[0-9.]+/, 'number'],
      [/./, 'expression.content'],
    ],
    structure_lg: [
      [/^\s*\]\s*$/, 'structure-lg', '@pop'],
      [/^\s*>[\s\S]*$/, 'comments'],
      [/(=|\|)([a_zA-Z0-9@ ]|\@)*\{/, { token: 'expression', next: '@expression' }],
      [/^\s*@\{/, { token: 'expression', next: '@expression' }],
      [/=\s*[\s\S]+\s*$/, { token: 'structure-property' }],
      [/\s*[a-zA-Z0-9_-]+\s*$/, { token: 'structure-name' }],
      [/./, 'structure-lg.content'],
    ],
  },
});

monaco.languages.register({
  id: 'botbuilderlg',
  extensions: ['.lg'],
  aliases: ['LG', 'language-generation'],
  mimetypes: ['application/lg'],
});

monaco.editor.defineTheme('lgtheme', {
  base: 'vs',
  inherit: false,
  colors: {},
  rules: [
    { token: 'template-name', foreground: '0000FF' },
    { token: 'function-name', foreground: '79571E' },
    { token: 'keywords', foreground: '0000FF' },
    { token: 'comments', foreground: '7A7574' },
    { token: 'number', foreground: '00A32B' },

monaco-editor-core

A browser based code editor

MIT
Latest version published 2 months ago

Package Health Score

95 / 100
Full package analysis

Similar packages