Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Show CSS code hints in SCSS mode. #4931

Merged
merged 3 commits into from
Sep 4, 2013
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/extensions/default/CSSCodeHints/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ define(function (require, exports, module) {

AppInit.appReady(function () {
var cssPropHints = new CssPropHints();
CodeHintManager.registerHintProvider(cssPropHints, ["css"], 0);
CodeHintManager.registerHintProvider(cssPropHints, ["css", "scss"], 0);

// For unit testing
exports.cssPropHintProvider = cssPropHints;
Expand Down
8 changes: 5 additions & 3 deletions src/language/CSSUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ define(function (require, exports, module) {
}

lastToken = state.stack[state.stack.length - 1];
return (lastToken === "{" || lastToken === "rule");
return (lastToken === "{" || lastToken === "rule" || lastToken === "block");
}

/**
Expand All @@ -94,7 +94,9 @@ define(function (require, exports, module) {
if (!state.stack || state.stack.length < 2) {
return false;
}
return (state.stack[state.stack.length - 1] === "propertyValue" && state.stack[state.stack.length - 2] === "rule");
return ((state.stack[state.stack.length - 1] === "propertyValue" &&
(state.stack[state.stack.length - 2] === "rule" || state.stack[state.stack.length - 2] === "block")) ||
(state.stack[state.stack.length - 1] === "(" && (state.stack[state.stack.length - 2] === "propertyValue")));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line fixes the unit test failure caused by latest CodeMirror update.

}

/**
Expand Down Expand Up @@ -450,7 +452,7 @@ define(function (require, exports, module) {
mode = editor.getModeForSelection();

// Check if this is inside a style block or in a css/less document.
if (mode !== "css" && mode !== "less") {
if (mode !== "css" && mode !== "text/x-scss" && mode !== "less") {
return createInfo();
}

Expand Down