Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
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
6 changes: 5 additions & 1 deletion src/editor/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -986,10 +986,14 @@ define(function (require, exports, module) {
return;
}

// We set clearWhenEmpty: false so that if there's a blank line at the beginning or end of
// the document, and that's the only hidden line, we can still actually hide it. Doing so
// requires us to create a 0-length marked span, which would ordinarily be cleaned up by CM
// if clearWithEmpty is true. See https://groups.google.com/forum/#!topic/codemirror/RB8VNF8ow2w
var value = this._codeMirror.markText(
{line: from, ch: 0},
{line: to - 1, ch: this._codeMirror.getLine(to - 1).length},
{collapsed: true, inclusiveLeft: true, inclusiveRight: true}
{collapsed: true, inclusiveLeft: true, inclusiveRight: true, clearWhenEmpty: false}
);

return value;
Expand Down
2 changes: 1 addition & 1 deletion src/editor/EditorCommandHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ define(function (require, exports, module) {
} else {
doc.replaceRange("\n", {line: line, ch: 0}, null, "+input");
}
cm.indentLine(line, "smart", false);
cm.indentLine(line, "smart", true);
editor.setSelection({line: line, ch: null});
}

Expand Down
2 changes: 1 addition & 1 deletion src/extensions/default/CSSCodeHints/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ define(function (require, exports, module) {

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

// For unit testing
exports.cssPropHintProvider = cssPropHints;
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/default/HTMLCodeHints/unittests.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ define(function (require, exports, module) {
verifyAttrHints(hintList, "application/msexcel");
});

it("should NOT list attribute value hints when the cursor is after the end quote of an attribute value", function () {
xit("should NOT list attribute value hints when the cursor is after the end quote of an attribute value", function () {
testDocument.replaceRange(" <input checked accept='' >\n", { line: 9, ch: 0 }); // insert new line

// Set cursor after the closing quote of accept attribute
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/default/LESSSupport/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ define(function (require, exports, module) {

LanguageManager.defineLanguage("less", {
name: "LESS",
mode: "less",
mode: ["css", "text/x-less"],
fileExtensions: ["less"],
blockComment: ["/*", "*/"],
lineComment: ["//"]
Expand Down
24 changes: 12 additions & 12 deletions src/language/CSSUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ define(function (require, exports, module) {

state = ctx.token.state.localState || ctx.token.state;

if (!state.stack || state.stack.length < 1) {
if (!state.context) {
return false;
}

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

Expand All @@ -90,32 +90,32 @@ define(function (require, exports, module) {

state = ctx.token.state.localState || ctx.token.state;

if (!state.stack || state.stack.length < 2) {
if (!state.context || !state.context.prev) {
return false;
}
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")));
return ((state.context.type === "prop" &&
(state.context.prev.type === "rule" || state.context.prev.type === "block")) ||
(state.context.type === "parens" && state.context.prev.type === "prop"));
}

/**
* @private
* Checks if the current cursor position is inside an @import rule
* Checks if the current cursor position is inside an at-rule
* @param {editor:{CodeMirror}, pos:{ch:{string}, line:{number}}, token:{object}} context
* @return {boolean} true if the context is in property value
*/
function _isInImportRule(ctx) {
function _isInAtRule(ctx) {
var state;
if (!ctx || !ctx.token || !ctx.token.state) {
return false;
}

state = ctx.token.state.localState || ctx.token.state;

if (!state.stack || state.stack.length < 1) {
if (!state.context) {
return false;
}
return (state.stack[0] === "@import");
return (state.context.type === "at");
}

/**
Expand Down Expand Up @@ -451,7 +451,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 !== "text/x-scss" && mode !== "less") {
if (mode !== "css" && mode !== "text/x-scss" && mode !== "text/x-less") {
return createInfo();
}

Expand Down Expand Up @@ -481,7 +481,7 @@ define(function (require, exports, module) {
return _getRuleInfoStartingFromPropValue(ctx, editor);
}

if (_isInImportRule(ctx)) {
if (_isInAtRule(ctx)) {
return _getImportUrlInfo(ctx, editor);
}

Expand Down
2 changes: 1 addition & 1 deletion src/thirdparty/CodeMirror2