Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix problematic semicolon in CSS media queries #4849

Merged
merged 2 commits into from
Aug 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/mode/css_completions.js
Original file line number Diff line number Diff line change
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