fix css autocomplete sort order

This commit is contained in:
tophf 2021-02-14 21:48:44 +03:00
parent 3102738cfb
commit 58ae4704b2

View File

@ -149,12 +149,13 @@
} }
function initCssProps() { function initCssProps() {
cssProps = addSuffix(cssMime.propertyKeywords).sort(); cssProps = addSuffix(cssMime.propertyKeywords);
cssMedia = [].concat(...Object.entries(cssMime).map(getMediaKeys).filter(Boolean)).sort(); cssMedia = [].concat(...Object.entries(cssMime).map(getMediaKeys).filter(Boolean)).sort();
} }
function addSuffix(obj, suffix = ': ') { function addSuffix(obj, suffix = ': ') {
return Object.keys(obj).map(k => k + suffix); // Sorting first, otherwise "foo-bar:" would precede "foo:"
return Object.keys(obj).sort().map(k => k + suffix);
} }
function getMediaKeys([k, v]) { function getMediaKeys([k, v]) {