Returns completions for stylesheet languages (CSS, SCSS, Less etc.)
@param  {TextEditor} editor
@param  {String} prefix
@return {Array}
770783
function getStylesheetSnippetsCompletions(editor, prefix) {
	if (hasScope(editor, 'meta.property-value')) {
		return false;
	}

	const syntax = detectSyntax(editor);

	if (!completionsCache.has(syntax)) {
		// Create cache with Emmet snippets completions
		const registry = createSnippetsRegistry(syntax);
		const snippets = convertToCSSSnippets(registry);
		const completions = snippets.map(snippet => {
			let rightLabel = snippet.property;
			let description;
			const keywords = snippet.keywords();
			if (keywords.length) {
				rightLabel += ` <span class="emmet-snippet-keywords">${removeFields(keywords.join(' | '))}</span>`;
				description = 'Contains embedded keywords. Type `-` or `:` and first embedded keyword letters for completion.';
			}

			return {
				text: snippet.key,
				type: 'snippet',
				rightLabelHTML: rightLabel,
				description
			};
		});

		completionsCache.set(syntax, completions);
	}

	let completions = completionsCache.get(syntax);

	if (prefix) {
		completions = completions.filter(completion => completion.text.indexOf(prefix) === 0);
	}

	return completions.map(completion => Object.assign({ replacementPrefix: prefix }, completion));
}
334277
def is_symbols_pair_complete(editor, symbol):
    

    symbols_pairs = get_editor_capability(editor, "symbols_pairs")
    if not symbols_pairs:
        return

    cursor = editor.textCursor()
    cursor.movePosition(QTextCursor.StartOfLine, QTextCursor.MoveAnchor)
    cursor.movePosition(QTextCursor.EndOfLine, QTextCursor.KeepAnchor)
    selected_text = foundations.strings.to_string(cursor.selectedText())
    if symbol == symbols_pairs[symbol]:
        return selected_text.count(symbol) % 2 == 0
    else:
        return selected_text.count(symbol) == selected_text.count(symbols_pairs[symbol])
351512
function generateStylesheets(done) {
			// Convert codepoints to array of strings
			var codepoints = [];
			_.each(o.glyphs, function(name) {
				codepoints.push(o.codepoints[name].toString(16));
			});
			o.codepoints = codepoints;

			// Prepage glyph names to use as CSS classes
			o.glyphs = _.map(o.glyphs, classnameize);

			o.stylesheets.sort(function(a, b) {
				return a === 'css' ? 1 : -1;
			}).forEach(generateStylesheet);

			done();
		}
533125
function markExtension(editor) {
  const ml = new MarkerList();
  const mm = new MarkerManager(ml);
  let wmh, mmh, vmh;

  editor.eventManager.addEventType('markerUpdated');

  if (editor.isViewer()) {
    vmh = new ViewerMarkerHelper(editor.preview);
  } else {
    wmh = new WysiwygMarkerHelper(editor.getSquire());
    mmh = new MarkdownMarkerHelper(editor.getCodeMirror());
  }

  /**
   * getHelper
   * Get helper for current situation
   * @returns {object} helper
   */
  function getHelper() {
    let helper;

    if (editor.isViewer()) {
      helper = vmh;
    } else if (editor.isWysiwygMode()) {
      helper = wmh;
    } else {
      helper = mmh;
    }

    return helper;
  }

  /**
   * Update mark when resizing
   */
  function updateMarkWhenResizing() {
    const helper = getHelper();

    ml.getAll().forEach(marker => {
      helper.updateMarkerWithExtraInfo(marker);
    });

    editor.eventManager.emit('markerUpdated', ml.getAll());
  }

  // We need to update marker after window have been resized
  $(window).on('resize', updateMarkWhenResizing);

  editor.on('removeEditor', () => {
    $(window).off('resize', updateMarkWhenResizing);
  });

  // Reset marker content after set value
  editor.on('setMarkdownAfter', () => {
    const helper = getHelper();
    mm.resetContent(helper.getTextContent());
  });

  /**
   * setValueWithMarkers
   * Set value with markers
   * @param {string} value markdown content
   * @param {object} markerDataCollection marker data that obtain with exportMarkers method
   * @returns {Array.<object>} markers
   */
  editor.setValueWithMarkers = (value, markerDataCollection) => {
    let helper;

    ml.resetMarkers();

    markerDataCollection.forEach(markerData => {
      ml.addMarker(markerData.start, markerData.end, markerData.id);
    });

    editor.setValue(value);

    mm.resetContent(value.replace(FIND_CRLF_RX, ''));

    if (editor.isViewer() || editor.isWysiwygMode()) {
      helper = getHelper();
      mm.updateMarkersByContent(helper.getTextContent());
    } else {
      helper = mmh;
    }

    ml.getAll().forEach(marker => {
      helper.updateMarkerWithExtraInfo(marker);
    });

    editor.eventManager.emit('markerUpdated', ml.getAll());

    return ml.getAll();
  };

  /**
   * getMarker
   * Get markers that have given id
   * @param {string} id id of marker
   * @returns {object}
   */
  editor.getMarker = id => ml.getMarker(id);

  /**
   * getMarkersAll
   * Get all markers
   * @returns {Array.<object>}
   */
  editor.getMarkersAll = () => ml.getAll();

  /**
   * removeMarker
   * Remove marker with given id
   * @param {string} id of marker that should be removed
   * @returns {marker} removed marker
   */
  editor.removeMarker = id => ml.removeMarker(id);

  /**
   * getMarkersData
   * Get marker data to export so you can restore markers next time
   * @returns {object} markers data
   */
  editor.exportMarkers = () => {
    let markersData;

    if (editor.isMarkdownMode()) {
      markersData = ml.getMarkersData();
    } else if (editor.isViewer() || editor.isWysiwygMode()) {
      mm.updateMarkersByContent(editor.getValue().replace(FIND_CRLF_RX, ''));
      markersData = ml.getMarkersData();
      mm.updateMarkersByContent(getHelper().getTextContent());
    }

    return markersData;
  };

  /**
   * selectMarker
   * Make selection with marker that have given id
   * @param {string} id id of marker
   */
  editor.selectMarker = id => {
    const helper = getHelper();
    const marker = editor.getMarker(id);

    if (marker) {
      helper.selectOffsetRange(marker.start, marker.end);
    }
  };

  /**
   * addMarker
   * Add Marker with given id
   * if you pass just id then it uses current selection for marker
   * or you can pass start and end offset for marker
   * @param {number|string} start start offset or id
   * @param {number} end end offset
   * @param {string} id id of marker
   * @returns {object} marker that have made
   */
  editor.addMarker = (start, end, id) => {
    let marker;
    const helper = getHelper();

    if (!id) {
      id = start;
      marker = helper.getMarkerInfoOfCurrentSelection();
    } else {
      marker = {
        start,
        end
      };

      marker = helper.updateMarkerWithExtraInfo(marker);
    }

    if (marker) {
      marker.id = id;
      marker = ml.addMarker(marker);
      ml.sortBy('end');
      editor.eventManager.emit('markerUpdated', [marker]);
    }

    return marker;
  };

  /**
   * clearSelect
   * Clear selection
   */
  editor.clearSelect = () => {
    getHelper().clearSelect();
  };

  if (!editor.isViewer()) {
    editor.on('changeMode', () => {
      editor._updateMarkers();
    });

    editor.on('change', util.debounce(() => {
      editor._updateMarkers();
    }, MARKER_UPDATE_DELAY));

    /**
     * _updateMarkers
     * Update markers with current text content
     */
    editor._updateMarkers = () => {
      const helper = getHelper();

      if (!ml.getAll().length) {
        return;
      }

      mm.updateMarkersByContent(helper.getTextContent());

      ml.getAll().forEach(marker => {
        helper.updateMarkerWithExtraInfo(marker);
      });

      editor.eventManager.emit('markerUpdated', ml.getAll());
    };
  }
}
953116
function (styles) {
				if (styles) {
					var textStyles = {};
					styles = merge(styles); // create a copy to avoid altering the original object (#537)
					each(['fontSize', 'fontWeight', 'fontFamily', 'color', 'lineHeight', 'width', 'textDecoration', 'textShadow'], function (prop) {
						if (styles[prop] !== UNDEFINED) {
							textStyles[prop] = styles[prop];
							delete styles[prop];
						}
					});
					text.css(textStyles);
				}
				return baseCss.call(wrapper, styles);
			}
1065481
function css(prefix) {
	var stream;
	if (prefix === 'bootstrap') {
		stream = gulp.src('src/clockpicker.css');
	} else {
		// Concat with some styles picked from bootstrap
		stream = gulp.src(['src/standalone.css', 'src/clockpicker.css'])
			.pipe(concat('clockpicker.css'));
	}
	stream.pipe(rename({
			prefix: prefix + '-'
		}))
		.pipe(replace(versionRegExp, version))
		.pipe(gulp.dest('dist'))
		.pipe(minifyCSS({
			keepSpecialComments: 1
		}))
		.pipe(rename({
			suffix: '.min'
		}))
		.pipe(gulp.dest('dist'));
}
387332
function(property, camelCase) {
		var prefixed = self.prefix + property;

		return camelCase? StyleFix.camelCase(prefixed) : prefixed;
	}
519627
function parseCss (ctx, done) {
  var result
  try {
    result = postcss()
      .process(ctx.src, {
        map: {
          sourcesContent: true,
          annotation: false,
          prev: ctx.map
        },
        from: ctx.filename
      })
    ctx.src = result.css
    ctx.map = result.map.toJSON()
    done(null, ctx)
  } catch (e) {
    var msg = e.message
    var ext = extname(ctx.filename).slice(1).toLowerCase()
    if (ext !== 'css') {
      msg += ' (Try to use appropriate parser for ' + ext + ')'
    }
    done(new Error(msg))
  }
}
1176100
def get_common_complete_suffix(document, completions):
    
    # Take only completions that don't change the text before the cursor.
    def doesnt_change_before_cursor(completion):
        end = completion.text[:-completion.start_position]
        return document.text_before_cursor.endswith(end)

    completions2 = [c for c in completions if doesnt_change_before_cursor(c)]

    # When there is at least one completion that changes the text before the
    # cursor, don't return any common part.
    if len(completions2) != len(completions):
        return ''

    # Return the common prefix.
    def get_suffix(completion):
        return completion.text[-completion.start_position:]

    return _commonprefix([get_suffix(c) for c in completions2])
41511
function prefixAll(styles) {
  Object.keys(styles).forEach(function (property) {
    var value = styles[property];
    if (value instanceof Object && !Array.isArray(value)) {
      // recurse through nested style objects
      styles[property] = prefixAll(value);
    } else {
      Object.keys(_prefixProps2.default).forEach(function (prefix) {
        var properties = _prefixProps2.default[prefix];
        // add prefixes if needed
        if (properties[property]) {
          styles[prefix + (0, _capitalizeString2.default)(property)] = value;
        }
      });
    }
  });

  Object.keys(styles).forEach(function (property) {
    [].concat(styles[property]).forEach(function (value, index) {
      // resolve every special plugins
      plugins.forEach(function (plugin) {
        return assignStyles(styles, plugin(property, value));
      });
    });
  });

  return (0, _sortPrefixedStyle2.default)(styles);
}
1360196
function _findMatchingRulesInStyleBlocks(htmlDocument, selector, resultSelectors) {
        // HTMLUtils requires a real CodeMirror instance; make sure we can give it the right Editor
        var htmlEditor = EditorManager.getCurrentFullEditor();
        if (htmlEditor.document !== htmlDocument) {
            console.error("Cannot search for <style> blocks in HTML file other than current editor");
            return;
        }

        // Find all <style> blocks in the HTML file
        var styleBlocks = HTMLUtils.findStyleBlocks(htmlEditor);

        styleBlocks.forEach(function (styleBlockInfo) {
            // Search this one <style> block's content, appending results to 'resultSelectors'
            var oneStyleBlockMatches = _findAllMatchingSelectorsInText(styleBlockInfo.text, selector);
            _addSelectorsToResults(resultSelectors, oneStyleBlockMatches, htmlDocument, styleBlockInfo.start.line);
        });
    }
1148373
function checkStylesheet(i) {
  const start = i;
  let l;

  while (i < tokensLength) {
    if (l = checkSC(i)) tokens[i].stylesheet_child = 1;
    else if (l = checkRuleset(i)) tokens[i].stylesheet_child = 2;
    else if (l = checkInclude(i)) tokens[i].stylesheet_child = 3;
    else if (l = checkExtend(i)) tokens[i].stylesheet_child = 4;
    else if (l = checkMixin(i)) tokens[i].stylesheet_child = 5;
    else if (l = checkLoop(i)) tokens[i].stylesheet_child = 6;
    else if (l = checkConditionalStatement(i)) tokens[i].stylesheet_child = 7;
    else if (l = checkAtrule(i)) tokens[i].stylesheet_child = 8;
    else if (l = checkDeclaration(i)) tokens[i].stylesheet_child = 9;
    else if (l = checkDeclDelim(i)) tokens[i].stylesheet_child = 10;
    else throwError(i);

    i += l;
  }

  return i - start;
}
1362615
function parseNonCrossOriginStylesheet(sheet, options, priority) {
	const q = axe.utils.queue();

	/**
	 * `sheet.cssRules` throws an error on `cross-origin` stylesheets
	 */
	const cssRules = sheet.cssRules;

	const rules = Array.from(cssRules);
	if (!rules) {
		return q;
	}

	/**
	 * reference -> https://developer.mozilla.org/en-US/docs/Web/API/CSSRule#Type_constants
	 */
	const cssImportRules = rules.filter(r => r.type === 3); // type === 3 -> CSSRule.IMPORT_RULE

	/**
	 * when no `@import` rules in given sheet
	 * -> resolve the current `sheet` & exit
	 */
	if (!cssImportRules.length) {
		q.defer(resolve =>
			resolve({
				isExternal: false,
				priority,
				root: options.rootNode,
				shadowId: options.shadowId,
				sheet
			})
		);

		// exit
		return q;
	}

	/**
	 * iterate `@import` rules and fetch styles
	 */
	cssImportRules.forEach((importRule, cssRuleIndex) =>
		q.defer((resolve, reject) => {
			const importUrl = importRule.href;
			const newPriority = [...priority, cssRuleIndex];
			const axiosOptions = {
				method: 'get',
				url: importUrl,
				timeout: options.timeout
			};
			axe.imports
				.axios(axiosOptions)
				.then(({ data }) =>
					resolve(
						options.convertDataToStylesheet({
							data,
							isExternal: true,
							priority: newPriority,
							root: options.rootNode,
							shadowId: options.shadowId
						})
					)
				)
				.catch(reject);
		})
	);

	const nonImportCSSRules = rules.filter(r => r.type !== 3);

	// no further rules to process in this sheet
	if (!nonImportCSSRules.length) {
		return q;
	}

	// convert all `nonImportCSSRules` style rules into `text` and defer into queue
	q.defer(resolve =>
		resolve(
			options.convertDataToStylesheet({
				data: nonImportCSSRules.map(rule => rule.cssText).join(),
				isExternal: false,
				priority,
				root: options.rootNode,
				shadowId: options.shadowId
			})
		)
	);

	return q;
}
769256
function getCSSRules(doc) {
    var styles = doc.getElementsByTagName('style'),
        allRules = { },
        rules;

    // very crude parsing of style contents
    for (var i = 0, len = styles.length; i < len; i++) {
      var styleContents = styles[0].textContent;

      // remove comments
      styleContents = styleContents.replace(/\/\*[\s\S]*?\*\//g, '');

      rules = styleContents.match(/[^{]*\{[\s\S]*?\}/g);
      rules = rules.map(function(rule) { return rule.trim() });

      rules.forEach(function(rule) {
        var match = rule.match(/([\s\S]*?)\s*\{([^}]*)\}/),
            rule = match[1],
            declaration = match[2].trim(),
            propertyValuePairs = declaration.replace(/;$/, '').split(/\s*;\s*/);

        if (!allRules[rule]) {
          allRules[rule] = { };
        }

        for (var i = 0, len = propertyValuePairs.length; i < len; i++) {
          var pair = propertyValuePairs[i].split(/\s*:\s*/),
              property = pair[0],
              value = pair[1];

          allRules[rule][property] = value;
        }
      });
    }

    return allRules;
  }
184827
function findAbbreviation(editor) {
		var r = range(editor.getSelectionRange());
		var content = String(editor.getContent());
		if (r.length()) {
			// abbreviation is selected by user
			return r.substring(content);
		}
		
		// search for new abbreviation from current caret position
		var curLine = editor.getCurrentLineRange();
		return actionUtils.extractAbbreviation(content.substring(curLine.start, r.start));
	}
343310
function css_beautify(source_text, options) {
    options = options || {};
    var indentSize = options.indent_size || 4;
    var indentCharacter = options.indent_char || ' ';

    // compatibility
    if (typeof indentSize == "string")
        indentSize = parseInt(indentSize);


    // tokenizer
    var whiteRe = /^\s+$/;
    var wordRe = /[\w$\-_]/;

    var pos = -1, ch;
    function next() {
        return ch = source_text.charAt(++pos)
    }
    function peek() {
        return source_text.charAt(pos+1)
    }
    function eatString(comma) {
        var start = pos;
        while(next()){
            if (ch=="\\"){
                next();
                next();
            } else if (ch == comma) {
                break;
            } else if (ch == "\n") {
                break;
            }
        }
        return source_text.substring(start, pos + 1);
    }

    function eatWhitespace() {
        var start = pos;
        while (whiteRe.test(peek()))
            pos++;
        return pos != start;
    }

    function skipWhitespace() {
        var start = pos;
        do{
        }while (whiteRe.test(next()))
        return pos != start + 1;
    }

    function eatComment() {
        var start = pos;
        next();
        while (next()) {
            if (ch == "*" && peek() == "/") {
                pos ++;
                break;
            }
        }

        return source_text.substring(start, pos + 1);
    }


    function lookBack(str) {
        return source_text.substring(pos-str.length, pos).toLowerCase() == str;
    }

    // printer
    var indentString = source_text.match(/^[\r\n]*[\t ]*/)[0];
    var singleIndent = Array(indentSize + 1).join(indentCharacter);
    var indentLevel = 0;
    function indent() {
        indentLevel++;
        indentString += singleIndent;
    }
    function outdent() {
        indentLevel--;
        indentString = indentString.slice(0, -indentSize);
    }

    var print = {}
    print["{"] = function(ch) {
        print.singleSpace();
        output.push(ch);
        print.newLine();
    }
    print["}"] = function(ch) {
        print.newLine();
        output.push(ch);
        print.newLine();
    }

    print.newLine = function(keepWhitespace) {
        if (!keepWhitespace)
            while (whiteRe.test(output[output.length - 1]))
                output.pop();

        if (output.length)
            output.push('\n');
        if (indentString)
            output.push(indentString);
    }
    print.singleSpace = function() {
        if (output.length && !whiteRe.test(output[output.length - 1]))
            output.push(' ');
    }
    var output = [];
    if (indentString)
        output.push(indentString);
    /*_____________________--------------------_____________________*/

    while(true) {
        var isAfterSpace = skipWhitespace();

        if (!ch)
            break;

        if (ch == '{') {
            indent();
            print["{"](ch);
        } else if (ch == '}') {
            outdent();
            print["}"](ch);
        } else if (ch == '"' || ch == '\'') {
            output.push(eatString(ch))
        } else if (ch == ';') {
            output.push(ch, '\n', indentString);
        } else if (ch == '/' && peek() == '*') { // comment
            print.newLine();
            output.push(eatComment(), "\n", indentString);
        } else if (ch == '(') { // may be a url
            if (lookBack("url")) {
              output.push(ch);
              eatWhitespace();
              if (next()) {
                if (ch != ')' && ch != '"' && ch != '\'')
                    output.push(eatString(')'));
                else
                    pos--;
              }
            } else {
              if (isAfterSpace)
                  print.singleSpace();
              output.push(ch);
              eatWhitespace();
            }
        } else if (ch == ')') {
            output.push(ch);
        } else if (ch == ',') {
            eatWhitespace();
            output.push(ch);
            print.singleSpace();
        } else if (ch == ']') {
            output.push(ch);
        }  else if (ch == '[' || ch == '=') { // no whitespace before or after
            eatWhitespace();
            output.push(ch);
        } else {
            if (isAfterSpace)
                print.singleSpace();

            output.push(ch);
        }
    }


    var sweetCode = output.join('').replace(/[\n ]+$/, '');
    return sweetCode;
}
549702
function (editor, matchers) {
      for (var i = 0; i < matchers.length; i++) {
        var f = matchers[i];
        var result = f(editor);

        if (result) {
          return result;
        }
      }

      return null;
    }