How to use the brace.acequire function in brace

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

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github matthijsgroen / ebnf2railroad / src / index.js View on Github external
searchReferencesFromIdentifier
} = require("ebnf2railroad");

const styleElem = document.createElement("style");
styleElem.setAttribute("type", "text/css");
styleElem.innerHTML = documentStyle();
const headSection = document.getElementsByTagName("head")[0];
headSection.appendChild(styleElem);

const ace = require("brace");
require("brace/ext/language_tools");
require("brace/mode/plain_text");
require("./ace-ebnf-mode");

const EditSession = ace.EditSession;
const Range = ace.acequire("ace/range").Range;
require("brace/theme/iplastic");

// Toggle collapse/expand

// 1 = middle, 2 = doc, 3 = middle, 0 = expand
let position = 1;
const updatePosition = newPosition => {
  position = newPosition % 4;
  if (position === 1 || position === 3) {
    document.body.classList.add("split");
  } else {
    document.body.classList.remove("split");
  }
  if (position !== 0) {
    document.body.classList.remove("expanded");
  } else {
github plasma-umass / Stopify / StopifyAce.js View on Github external
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const React = require("react");
const react_ace_1 = require("react-ace");
const ace = require("brace");
const languages_1 = require("./languages");
require('brace/mode/ocaml');
require('brace/mode/c_cpp');
require('brace/mode/clojure');
require('brace/mode/scala');
require('brace/mode/javascript');
require('brace/mode/dart');
require('brace/theme/eclipse');
const Range = ace.acequire('ace/range').Range;
/**
 * Encapsulates an AceEditor that supports setting breakpoints by
 * clicking in the gutter.
 */
class StopifyAce extends React.Component {
    constructor(props) {
        super(props);
        this.breakpoints = [];
        /// Ace Marker object that is kept in sync with props.line.
        this.lastLineMarker = null;
    }
    componentWillReceiveProps(props) {
        if (this.lastLineMarker !== null) {
            this.editor.session.removeMarker(this.lastLineMarker);
        }
        if (props.line) {
github YMFE / yapi / client / components / AceEditor / mockEditor.js View on Github external
var ace = require('brace'),
  Mock = require('mockjs');
require('brace/mode/javascript');
require('brace/mode/json');
require('brace/mode/xml');
require('brace/mode/html')
require('brace/theme/xcode');
require("brace/ext/language_tools.js");
var json5 = require('json5');
const MockExtra = require('common/mock-extra.js')

var langTools = ace.acequire("ace/ext/language_tools"),
  wordList = [
    // { name: '字符串', mock: '@string' },
    // { name: '自然数', mock: '@natural' },
    // { name: '浮点数', mock: '@float' },
    // { name: '字符', mock: '@character' },
    // { name: '布尔', mock: '@boolean' },
    // { name: 'url', mock: '@url' },
    // { name: '域名', mock: '@domain' },
    // { name: 'ip地址', mock: '@ip' },
    // { name: 'id', mock: '@id' },
    // { name: 'guid', mock: '@guid' },
    // { name: '当前时间', mock: '@now' },
    // { name: '时间戳', mock: '@timestamp'},
    // { name: '日期', mock: '@date' },
    // { name: '时间', mock: '@time' },
    // { name: '日期时间', mock: '@datetime' },
github microsoft / fluent-ui-react / docs / src / components / Editor / Editor.tsx View on Github external
import PropTypes from 'prop-types'
import * as React from 'react'
import AceEditor, { AceEditorProps } from 'react-ace'
import * as ace from 'brace'
import 'brace/ext/language_tools'
import 'brace/mode/html'
import 'brace/mode/jsx'
import 'brace/mode/sh'
import 'brace/theme/tomorrow_night'
import { eventStack, doesNodeContainClick } from 'src/lib'

const parentComponents = []

// Set up custom completers by using a ace extension
// https://github.com/thlorenz/brace/issues/19
const languageTools = ace.acequire('ace/ext/language_tools')

type Completion = {
  caption: string
  value: string
  meta: string
}

const semanticUIReactCompleter = {
  getCompletions(editor, session, pos, prefix, callback) {
    const completions: Completion[] = []

    _.each(parentComponents, component => {
      const { name } = component._meta
      // Component
      completions.push({ caption: name, value: name, meta: 'Component' })
github ptmt / tryflow / app / client / components / code.react.js View on Github external
setErrors(errors) {
    if (!errors) {
      return false;
    }
    const session = this.editor.getSession();
    session.setAnnotations(errors);
    Object.keys(session.$backMarkers).forEach(r => session.removeMarker(r))
    //console.log(this.editor.getSession().$backMarkers);
    var Range =  ace.acequire("ace/range").Range
    errors.forEach(error => {
      session.addMarker(
        new Range(error.row, error.column, error.row, error.columnEnd + 1), 'ace_highlight-marker', 'background'
      );
    })
  },
github airbnb / airpal / src / main / resources / assets / js / editor_view.js View on Github external
var ace           = require('brace'),
    _             = require('lodash'),
    Placeholder   = ace.acequire('ace/placeholder').PlaceHolder,
    Range         = ace.acequire('ace/range').Range,
    EventEmitter  = require('events').EventEmitter,
    slice         = Array.prototype.slice;

require('./lib/jquery.event.drag-2.2');
require('brace/theme/monokai');
require('brace/mode/sql');

var placeholderRE = /\[\[placeholder:[\w-]+\]\]/i,
    defaultPlaceholder = '[[placeholder:PLACEHOLDER_NAME]]',
    placeHolderNameOffset = defaultPlaceholder.indexOf(':') + 1;

function containsPlaceHolder(text) {
  return placeholderRE.test(text);
}

function TemplateCreator(editor) {
github airbnb / airpal / src / main / resources / assets / js / elements / query_editor.js View on Github external
/** @jsx React.DOM */
var React = require('react'),
    ace = require('brace'),
    _ = require('lodash'),
    Placeholder = ace.acequire('ace/placeholder').PlaceHolder,
    Range = ace.acequire('ace/range').Range,
    QueryEditor;

require('brace/theme/monokai');
require('brace/mode/sql');

function rangeStartEndSame(start, end) {
  return !!start && !!end &&
    (start.row === end.row) &&
    (start.column === end.column);
}

QueryEditor = React.createClass({

  getDefaultProps: function() {
    return {
      theme: 'ace/theme/monokai',
github PawelTroka / Computator.NET / Computator.NET.WebClient / ClientApp / components / Scripting.tsx View on Github external
public constructor() {
        super();
        this.state = { result: "", expression: "" };

        const langTools = brace.acequire("ace/ext/language_tools");
        const customCompleter = new CustomCompleter("scripting");
        langTools.setCompleters([customCompleter]);
    }
github PawelTroka / Computator.NET / Computator.NET.WebClient / ClientApp / components / Expression.tsx View on Github external
public constructor(props: IExpressionProps) {
        super(props);
        const langTools = brace.acequire("ace/ext/language_tools");
        const customCompleter = new CustomCompleter("expression");
        langTools.setCompleters([customCompleter]);
    }
github ethereum / remix-ide / src / app / editor / editor.js View on Github external
'use strict'
const EventManager = require('../../lib/events')
const yo = require('yo-yo')
const csjs = require('csjs-inject')
const ace = require('brace')
import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../package.json'

const globalRegistry = require('../../global/registry')
const SourceHighlighters = require('./SourceHighlighters')

const Range = ace.acequire('ace/range').Range
require('brace/ext/language_tools')
require('brace/ext/searchbox')
const langTools = ace.acequire('ace/ext/language_tools')
require('ace-mode-solidity/build/remix-ide/mode-solidity')
require('ace-mode-move/build/remix-ide/mode-move')
require('ace-mode-zokrates')
require('brace/mode/javascript')
require('brace/mode/python')
require('brace/mode/json')
require('brace/theme/chaos')
require('brace/theme/chrome')

const css = csjs`
  .ace-editor {
    width     : 100%;
  }
`
document.head.appendChild(yo`
  <style></style>

brace

browserify compatible version of the ace editor.

MIT
Latest version published 7 years ago

Package Health Score

58 / 100
Full package analysis

Popular brace functions