Skip to content

Commit 18a459a

Browse files
authored
fix: Fix problematic semicolon in CSS media queries (#4849)
1 parent d5842cb commit 18a459a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Diff for: src/mode/css_completions.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -128,24 +128,29 @@ var CssCompletions = function() {
128128
if (state==='ruleset' || session.$mode.$id == "ace/mode/scss") {
129129
//css attribute value
130130
var line = session.getLine(pos.row).substr(0, pos.column);
131+
var inParens = /\([^)]*$/.test(line);
132+
if (inParens) {
133+
line = line.substr(line.lastIndexOf('(') + 1);
134+
}
131135
if (/:[^;]+$/.test(line)) {
132136
/([\w\-]+):[^:]*$/.test(line);
133137

134138
return this.getPropertyValueCompletions(state, session, pos, prefix);
135139
} else {
136-
return this.getPropertyCompletions(state, session, pos, prefix);
140+
return this.getPropertyCompletions(state, session, pos, prefix, inParens);
137141
}
138142
}
139143

140144
return [];
141145
};
142146

143-
this.getPropertyCompletions = function(state, session, pos, prefix) {
147+
this.getPropertyCompletions = function(state, session, pos, prefix, skipSemicolon) {
148+
skipSemicolon = skipSemicolon || false;
144149
var properties = Object.keys(propertyMap);
145150
return properties.map(function(property){
146151
return {
147152
caption: property,
148-
snippet: property + ': $0;',
153+
snippet: property + ': $0' + (skipSemicolon ? '' : ';'),
149154
meta: "property",
150155
score: 1000000
151156
};

0 commit comments

Comments
 (0)