diff --git a/lib/ace/mode/folding/sqlserver.js b/lib/ace/mode/folding/sqlserver.js index f91e9cf4..8ef3c71c 100644 --- a/lib/ace/mode/folding/sqlserver.js +++ b/lib/ace/mode/folding/sqlserver.js @@ -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; }; diff --git a/lib/ace/mode/sqlserver_highlight_rules.js b/lib/ace/mode/sqlserver_highlight_rules.js index 70231a49..e2d26a32 100644 --- a/lib/ace/mode/sqlserver_highlight_rules.js +++ b/lib/ace/mode/sqlserver_highlight_rules.js @@ -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(); };