Skip to content

Commit

Permalink
fix: Fix problematic semicolon in CSS media queries (#4849)
Browse files Browse the repository at this point in the history
  • Loading branch information
anijanyan committed Aug 25, 2022
1 parent d5842cb commit 18a459a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/mode/css_completions.js
Expand Up @@ -128,24 +128,29 @@ var CssCompletions = function() {
if (state==='ruleset' || session.$mode.$id == "ace/mode/scss") {
//css attribute value
var line = session.getLine(pos.row).substr(0, pos.column);
var inParens = /\([^)]*$/.test(line);
if (inParens) {
line = line.substr(line.lastIndexOf('(') + 1);
}
if (/:[^;]+$/.test(line)) {
/([\w\-]+):[^:]*$/.test(line);

return this.getPropertyValueCompletions(state, session, pos, prefix);
} else {
return this.getPropertyCompletions(state, session, pos, prefix);
return this.getPropertyCompletions(state, session, pos, prefix, inParens);
}
}

return [];
};

this.getPropertyCompletions = function(state, session, pos, prefix) {
this.getPropertyCompletions = function(state, session, pos, prefix, skipSemicolon) {
skipSemicolon = skipSemicolon || false;
var properties = Object.keys(propertyMap);
return properties.map(function(property){
return {
caption: property,
snippet: property + ': $0;',
snippet: property + ': $0' + (skipSemicolon ? '' : ';'),
meta: "property",
score: 1000000
};
Expand Down

0 comments on commit 18a459a

Please sign in to comment.