This commit is contained in:
Morgan Yarbrough 2015-04-17 14:24:38 -04:00
commit 1b9c8bfc88
2 changed files with 54 additions and 22 deletions

View file

@ -2,15 +2,13 @@
-- Author: Morgan Yarbrough
-- Create date: 4/27/2015
-- Description: Test Procedure that shows off language features.
-- Includes non-standard folding using region comments using either
-- Includes non-standard folding using region comments using either
-- line comments or block comments (both are demonstrated below)
-- =============================================
CREATE PROCEDURE dbo.TestProcedure
--#region parameters
@Vint INT = 1
,@vdate DATE = NULL
,@vdatetime DATETIME = DATEADD(dd,1,GETDATE())
@vint INT = 1, @vdate DATE = NULL, @vdatetime DATETIME = DATEADD (dd, 1, GETDATE())
--#endregion
AS
@ -22,15 +20,17 @@ BEGIN
SET QUOTED_IDENTIFIER ON;
/*#endregion*/
SELECT Orders.OrderID
,Customers.CompanyName
,DATEFROMPARTS(YEAR(GETDATE()), 1, 1) AS FirstDayOfYear
SET @vint = CASE
WHEN @vdate IS NULL
THEN 1
ELSE 2
END
SELECT Orders.OrderID, Customers.CompanyName, DATEFROMPARTS(YEAR(GETDATE()), 1, 1) AS FirstDayOfYear
FROM Orders
INNER JOIN Customers
ON Orders.CustomerID = Customers.CustomerID
WHERE CompanyName NOT LIKE '%something'
OR CompanyName IS NULL
OR CompanyName IN ('bla','nothing')
END
OR CompanyName IN ('bla', 'nothing')
END

View file

@ -45,31 +45,63 @@ oop.inherits(FoldMode, BaseFoldMode);
// TODO: add more folding (will require in depth testing because this has never existed before) for things like:
// CASE ... END https://msdn.microsoft.com/en-us/library/ms181765.aspx
// BEGIN ... END https://msdn.microsoft.com/en-us/library/ms182717.aspx
// -- LEFT OFF TRYING TO ADD ADVANCED FOLDING... UNCOMMENT TO CONTINUE
this.foldingStartMarker = /CASE|BEGIN/;
this.foldingStopMarker = /END/;
// this.foldingStartMarker = /\bCASE\b|\bBEGIN\b/i;
// this.foldingStopMarker = /\bEND\b/i;
this.startRegionRe = /^\s*(\/\*|--)#region\b/;
this._getFoldWidgetBase = this.getFoldWidget;
this.getFoldWidget = function(session, foldStyle, row) {
var line = session.getLine(row);
// var fw = this.getFoldWidget(session, foldStyle, row);
//var fw = this._getFoldWidgetBase(session, foldStyle, row);
if (this.startRegionRe.test(line))
if (/*!fw && */this.startRegionRe.test(line))
return "start";
return "";
return fw;
};
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
/*this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
var line = session.getLine(row);
if (this.startRegionRe.test(line))
return this.getCommentRegionBlock(session, line, row);
if (this.startRegionRe.test(line)) return this.getCommentRegionBlock(session, line, row);
// var match = line.match(this.foldingStartMarker);
// if (match) {
// var i = match.index;
// if (match[1]) return this.openingBracketBlock(session, match[1], row, i);
// var range = session.getCommentFoldRange(row, i + match[0].length, 1);
// if (range && !range.isMultiLine()) {
// if (forceMultiline) {
// range = this.getSectionRange(session, row);
// }
// else if (foldStyle != "all") range = null;
// }
// return range;
// }
if (foldStyle === "markbegin") return;
var match = line.match(this.foldingStopMarker);
if (match) {
var i = match.index + match[0].length;
if (match[1]) return this.closingBracketBlock(session, match[1], row, i);
return session.getCommentFoldRange(row, i, - 1);
}
return;
};
};*/
this.getCommentRegionBlock = function(session, line, row) {
var startColumn = line.search(/\s*$/);