From 18a459a26430bfa58e0f798c4bacce6a799c77bd Mon Sep 17 00:00:00 2001 From: anijanyan <56698448+anijanyan@users.noreply.github.com> Date: Thu, 25 Aug 2022 22:14:25 +0400 Subject: [PATCH] fix: Fix problematic semicolon in CSS media queries (#4849) --- src/mode/css_completions.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mode/css_completions.js b/src/mode/css_completions.js index 772e0cc07c4..03a391f59ca 100644 --- a/src/mode/css_completions.js +++ b/src/mode/css_completions.js @@ -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 };