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

Commit

Permalink
Revert "Use cm.getModeAt in getModeAt"
Browse files Browse the repository at this point in the history
This reverts commit 6776bc0.
  • Loading branch information
Marcel Gerber committed Dec 11, 2014
1 parent 2d920f5 commit 23774c2
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/utils/TokenUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
define(function (require, exports, module) {
"use strict";

var _ = require("thirdparty/lodash");
var _ = require("thirdparty/lodash"),
CodeMirror = require("thirdparty/CodeMirror2/lib/codemirror");

var cache,
CACHE_MAX_AGE = 1000; // cache for 1 second
Expand Down Expand Up @@ -203,10 +204,14 @@ define(function (require, exports, module) {
* @return {mode:{Object}, name:string}
*/
function getModeAt(cm, pos) {
var modeData = cm.getModeAt(pos),
name = modeData.name === "xml" ? modeData.configuration : modeData.name;
var outerMode = cm.getMode(),
modeData = CodeMirror.innerMode(outerMode, cm.getTokenAt(pos, true).state),
name;

return {mode: modeData, name: name};
name = (modeData.mode.name === "xml") ?
modeData.mode.configuration : modeData.mode.name;

return {mode: modeData.mode, name: name};
}

exports.movePrevToken = movePrevToken;
Expand Down

0 comments on commit 23774c2

Please sign in to comment.