lib/autocomplete.js
function getStylesheetCompletions(editor, pos, config) {
	const line = editor.getLine(pos.line).slice(0, pos.ch);
	const prefix = extractPrefix(line, /[\w-@$]/);

	if (prefix) {
		// Make sure that current position precedes element name (e.g. not attribute,
		// class, id etc.)
		const prefixRange = {
			from: { line: pos.line, ch: pos.ch - prefix.length },
			to: pos
		};

		if (config.options && config.options.property) {
			const lowerProp = config.options.property.toLowerCase();
			// Find matching CSS property snippet for keyword completions
			const completion = getSnippetCompletions(editor, pos, config)
				.find(item => item.property && item.property === lowerProp);

			if (completion && completion.keywords.length) {
				return completion.keywords.map(kw => {
					return kw.key.indexOf(prefix) === 0 && new EmmetCompletion('value', editor, prefixRange, kw.key, kw.preview, kw.snippet);
				}).filter(Boolean);
			}
		} else {
			return getSnippetCompletions(editor, pos, config)
				.filter(completion => completion.key !== prefix && completion.key.indexOf(prefix) === 0)
				.map(completion => new EmmetCompletion('snippet', editor, prefixRange, completion.key, completion.preview, completion.snippet));
		}
	}

	return [];
}
function getStylesheetCompletions(editor, pos, config) {
	const line = editor.getLine(pos.line).slice(0, pos.ch);
	const prefix = extractPrefix(line, /[\w-@$]/);

	if (prefix) {
		// Make sure that current position precedes element name (e.g. not attribute,
		// class, id etc.)
		const prefixRange = {
			from: { line: pos.line, ch: pos.ch - prefix.length },
			to: pos
		};

		if (config.options && config.options.property) {
			const lowerProp = config.options.property.toLowerCase();
			// Find matching CSS property snippet for keyword completions
			const completion = getSnippetCompletions(editor, pos, config)
				.find(item => item.property && item.property === lowerProp);

			if (completion && completion.keywords.length) {
				return completion.keywords.map(kw => {
					return kw.key.indexOf(prefix) === 0 && new EmmetCompletion('value', editor, prefixRange, kw.key, kw.preview, kw.snippet);
				}).filter(Boolean);
			}
		} else {
			return getSnippetCompletions(editor, pos, config)
				.filter(completion => completion.key !== prefix && completion.key.indexOf(prefix) === 0)
				.map(completion => new EmmetCompletion('snippet', editor, prefixRange, completion.key, completion.preview, completion.snippet));
		}
	}

	return [];
}
function getStylesheetCompletions ( editor , pos , config ) { const line = editor . getLine ( pos . line ) . slice ( 0 , pos . ch ) ; const prefix = extractPrefix ( line , / [\w-@$] / ) ; if ( prefix ) { // Make sure that current position precedes element name (e.g. not attribute, // class, id etc.) const prefixRange = { from : { line : pos . line , ch : pos . ch - prefix . length } , to : pos } ; if ( config . options && config . options . property ) { const lowerProp = config . options . property . toLowerCase ( ) ; // Find matching CSS property snippet for keyword completions const completion = getSnippetCompletions ( editor , pos , config ) . find ( item => item . property && item . property === lowerProp ) ; if ( completion && completion . keywords . length ) { return completion . keywords . map ( kw => { return kw . key . indexOf ( prefix ) === 0 && new EmmetCompletion ( 'value' , editor , prefixRange , kw . key , kw . preview , kw . snippet ) ; } ) . filter ( Boolean ) ; } } else { return getSnippetCompletions ( editor , pos , config ) . filter ( completion => completion . key !== prefix && completion . key . indexOf ( prefix ) === 0 ) . map ( completion => new EmmetCompletion ( 'snippet' , editor , prefixRange , completion . key , completion . preview , completion . snippet ) ) ; } } return [ ] ; }
Returns completions for stylesheet syntaxes
@param  {CodeMirror} editor
@param  {CodeMirror.Position} pos Cursor position in editor
@param  {Object} config Resolved Emmet config
@return {EmmetCompletion[]}
Returns completions for stylesheet syntaxes