split mode specific code for structured folding

into separate files
This commit is contained in:
Fabian Jakobs 2011-12-01 18:19:24 +01:00
commit bbcb00acc4
27 changed files with 567 additions and 452 deletions

View file

@ -42,24 +42,19 @@ var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var PythonHighlightRules = require("./python_highlight_rules").PythonHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var PythonFoldMode = require("./folding/python").FoldMode;
var Range = require("../range").Range;
var Mode = function() {
this.$tokenizer = new Tokenizer(new PythonHighlightRules().getRules());
this.foldingRules = new PythonFoldMode();
};
oop.inherits(Mode, TextMode);
(function() {
this.foldingRules = {
foldingStartMarker: /\:(:?\s*)?(:?#.*)?$/,
getFoldWidgetRange: "indentationBlock"
};
this.toggleCommentLines = function(state, doc, startRow, endRow) {
var outdent = true;
var outentedRows = [];
var re = /^(\s*)#/;
for (var i=startRow; i<= endRow; i++) {
@ -91,7 +86,6 @@ oop.inherits(Mode, TextMode);
var tokenizedLine = this.$tokenizer.getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
var endState = tokenizedLine.state;
if (tokens.length && tokens[tokens.length-1].type == "comment") {
return indent;