This repository has been archived by the owner on Apr 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
115 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#region header | ||
// ======================================================================== | ||
// Copyright (c) 2017 - Julien Caillon ([email protected]) | ||
// This file (SyntaxFolding.cs) is part of 3P. | ||
// | ||
// 3P is a free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// 3P is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with 3P. If not, see <http://www.gnu.org/licenses/>. | ||
// ======================================================================== | ||
#endregion | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using _3PA.MainFeatures.Parser; | ||
using _3PA.NppCore; | ||
|
||
namespace _3PA.MainFeatures.SyntaxHighlighting { | ||
|
||
internal class SyntaxFolding { | ||
|
||
public static void OnParseEndParserItems(List<ParserError> arg1, Dictionary<int, LineInfo> lineInfos, List<ParsedItem> arg3) { | ||
var lineInfoCopy = new Dictionary<int, LineInfo>(lineInfos); | ||
|
||
Task.Factory.StartNew(() => { | ||
UiThread.Invoke(() => SetFolding(lineInfoCopy)); | ||
}); | ||
} | ||
|
||
public static void SetFolding(Dictionary<int, LineInfo> lineInfos) { | ||
var i = 0; | ||
var lastIdent = 0; | ||
while (lineInfos.ContainsKey(i)) { | ||
var line = Sci.GetLine(i); | ||
line.SetFoldLevel(lineInfos[i].BlockDepth, FoldLevelFlags.None); | ||
if (lineInfos[i].BlockDepth > lastIdent) { | ||
if (i > 0) | ||
Sci.GetLine(i - 1).FoldLevelFlags = FoldLevelFlags.Header; | ||
lastIdent = lineInfos[i].BlockDepth; | ||
} else { | ||
if (lineInfos[i].BlockDepth < lastIdent) | ||
lastIdent = lineInfos[i].BlockDepth; | ||
|
||
} | ||
i++; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,23 @@ | ||
using System; | ||
#region header | ||
// ======================================================================== | ||
// Copyright (c) 2017 - Julien Caillon ([email protected]) | ||
// This file (SciMsg.cs) is part of 3P. | ||
// | ||
// 3P is a free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// 3P is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with 3P. If not, see <http://www.gnu.org/licenses/>. | ||
// ======================================================================== | ||
#endregion | ||
using System; | ||
// ReSharper disable InconsistentNaming | ||
|
||
namespace _3PA.NppCore { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,23 @@ | ||
using System; | ||
#region header | ||
// ======================================================================== | ||
// Copyright (c) 2017 - Julien Caillon ([email protected]) | ||
// This file (SciMsgSub.cs) is part of 3P. | ||
// | ||
// 3P is a free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// 3P is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with 3P. If not, see <http://www.gnu.org/licenses/>. | ||
// ======================================================================== | ||
#endregion | ||
using System; | ||
|
||
namespace _3PA.NppCore { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters