added doc comment highlight to fix folding
This commit is contained in:
parent
184df6d18e
commit
d38849ef9f
2 changed files with 19 additions and 10 deletions
|
|
@ -49,6 +49,7 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|||
|
||||
this.foldingStartMarker = /(\bCASE\b|\bBEGIN\b)|^\s*(\/\*)/i;
|
||||
this.foldingStopMarker = /^(\bEND\b)|^[\s\*]*(\*\/)/i;
|
||||
// this.foldingStopMarker = /(\bEND\b)|^[\s\*]*(\*\/)/i;?need hat?
|
||||
// this.foldingStopMarker = /^(?!\bCASE\b|\bBEGIN\b)(\bEND\b)|^[\s\*]*(\*\/)/i;
|
||||
// this.foldingStopMarker = /^(?!\bCASE\b|\bBEGIN\b).*(\bEND\b)|^[\s\*]*(\*\/)/i;
|
||||
|
||||
|
|
@ -63,13 +64,9 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|||
var match = line.match(this.foldingStartMarker);
|
||||
if (match) {
|
||||
var i = match.index;
|
||||
//if first capturing group (CASE|BEGIN)
|
||||
if (match[1]) return this.getBeginEndBlock(session, row, i, match[1]);
|
||||
|
||||
//still going: match is for second capturing group, which is blockcomment
|
||||
|
||||
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
|
||||
console.log('getCommentFoldRange',range);
|
||||
|
||||
if (range && !range.isMultiLine()) {
|
||||
if (forceMultiline) {
|
||||
range = this.getSectionRange(session, row);
|
||||
|
|
@ -80,9 +77,8 @@ oop.inherits(FoldMode, BaseFoldMode);
|
|||
|
||||
return range;
|
||||
}
|
||||
|
||||
//no support for end folding markers yet
|
||||
if (foldStyle === "markbegin") return;
|
||||
|
||||
if (foldStyle === "markbegin") return; //no support for end folding markers yet
|
||||
return;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ define(function(require, exports, module) {
|
|||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
|
||||
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||
|
||||
var SqlServerHighlightRules = function() {
|
||||
|
|
@ -167,7 +168,8 @@ var SqlServerHighlightRules = function() {
|
|||
}, {
|
||||
defaultToken: "string"
|
||||
}]
|
||||
}, {
|
||||
},
|
||||
DocCommentHighlightRules.getStartRule("doc-start"), {
|
||||
token: "comment",
|
||||
regex: "--.*$"
|
||||
}, {
|
||||
|
|
@ -202,7 +204,16 @@ var SqlServerHighlightRules = function() {
|
|||
}, {
|
||||
token: "text",
|
||||
regex: "\\s+"
|
||||
}]
|
||||
}],
|
||||
comment: [
|
||||
DocCommentHighlightRules.getTagRule(), {
|
||||
token: "comment",
|
||||
regex: "\\*\\/",
|
||||
next: "no_regex"
|
||||
}, {
|
||||
defaultToken: "comment",
|
||||
caseInsensitive: true
|
||||
}],
|
||||
};
|
||||
|
||||
//add each set statment as regex at top of rules so that they are processed first because they require multiple words
|
||||
|
|
@ -215,6 +226,8 @@ var SqlServerHighlightRules = function() {
|
|||
});
|
||||
}
|
||||
|
||||
this.embedRules(DocCommentHighlightRules, "doc-", [DocCommentHighlightRules.getEndRule("start")]);
|
||||
|
||||
this.normalizeRules();
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue