Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Krüger <mkrueger@xamarin.com>2016-07-27 10:17:29 +0300
committerMike Krüger <mkrueger@xamarin.com>2016-07-27 10:17:29 +0300
commitf6b05bc85d422dfdab1cd3b8ad7bb82cc68b37fe (patch)
tree98f5beae7d48fb5080c2bbfbfd9e54ad6778f5dc /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util
parent6cf91e3181a6434b6cd9693ff18580d139815d75 (diff)
[Ide] Added text mate language wrapper class.
It's for extracting preferences out of the text mate settings.
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util')
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util/SimpleBracketMatcher.cs40
1 files changed, 18 insertions, 22 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util/SimpleBracketMatcher.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util/SimpleBracketMatcher.cs
index f091ef6d6d..0c7801d908 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util/SimpleBracketMatcher.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util/SimpleBracketMatcher.cs
@@ -28,6 +28,8 @@ using System.Collections.Generic;
using MonoDevelop.Ide.Editor.Highlighting;
using System.Threading;
using MonoDevelop.Ide.Editor.Extension;
+using MonoDevelop.Ide.Editor.TextMate;
+using System.Linq;
namespace MonoDevelop.Ide.Editor.Util
{
@@ -80,12 +82,10 @@ namespace MonoDevelop.Ide.Editor.Util
bool startsInLineComment = StartsInLineComment (document, offset);
-
- string lineComment = null;
- List<string> blockCommentStarts = new List<string> ();
- List<string> blockCommentEnds = new List<string> ();
- DefaultCommandTextEditorExtension.GetCommentTags (SyntaxHighlightingService.GetScopeForFileName (document.FileName), ref lineComment, blockCommentStarts, blockCommentEnds);
- string [] lineComments = lineComment != null ? new string [] { lineComment } : new string [0];
+ var lang = TextMateLanguage.Create (SyntaxHighlightingService.GetScopeForFileName (document.FileName));
+ var lineComments = lang.LineComments.ToArray ();
+ var blockCommentStarts = lang.BlockComments.Select (b => b.Item1).ToList ();
+ var blockCommentEnds = lang.BlockComments.Select (b => b.Item2).ToList ();
var stringQuotes = new string [] { "\"", "'" };
int depth = -1;
@@ -147,11 +147,10 @@ namespace MonoDevelop.Ide.Editor.Util
static bool StartsInLineComment (IReadonlyTextDocument document, int offset)
{
- string lineComment = null;
- List<string> blockCommentStarts = new List<string> ();
- List<string> blockCommentEnds = new List<string> ();
- DefaultCommandTextEditorExtension.GetCommentTags (SyntaxHighlightingService.GetScopeForFileName (document.FileName), ref lineComment, blockCommentStarts, blockCommentEnds);
- string [] lineComments = lineComment != null ? new string [] { lineComment } : new string [0];
+ var lang = TextMateLanguage.Create (SyntaxHighlightingService.GetScopeForFileName (document.FileName));
+ var lineComments = lang.LineComments.ToArray ();
+ var blockCommentStarts = lang.BlockComments.Select (b => b.Item1).ToList ();
+ var blockCommentEnds = lang.BlockComments.Select (b => b.Item2).ToList ();
var line = document.GetLineByOffset (offset);
for (int i = line.Offset; i < offset; i++) {
@@ -168,11 +167,10 @@ namespace MonoDevelop.Ide.Editor.Util
bool isInLineComment = false;
int curStringQuote = -1;
- string lineComment = null;
- List<string> blockCommentStarts = new List<string> ();
- List<string> blockCommentEnds = new List<string> ();
- DefaultCommandTextEditorExtension.GetCommentTags (SyntaxHighlightingService.GetScopeForFileName (document.FileName), ref lineComment, blockCommentStarts, blockCommentEnds);
- string [] lineComments = lineComment != null ? new string [] { lineComment } : new string [0];
+ var lang = TextMateLanguage.Create (SyntaxHighlightingService.GetScopeForFileName (document.FileName));
+ var lineComments = lang.LineComments.ToArray ();
+ var blockCommentStarts = lang.BlockComments.Select (b => b.Item1).ToList ();
+ var blockCommentEnds = lang.BlockComments.Select (b => b.Item2).ToList ();
var stringQuotes = new string [] { "\"", "'" };
@@ -213,12 +211,10 @@ namespace MonoDevelop.Ide.Editor.Util
bool isInBlockComment = false;
bool isInLineComment = false;
int curStringQuote = -1;
-
- string lineComment = null;
- List<string> blockCommentStarts = new List<string> ();
- List<string> blockCommentEnds = new List<string> ();
- DefaultCommandTextEditorExtension.GetCommentTags (SyntaxHighlightingService.GetScopeForFileName (document.FileName), ref lineComment, blockCommentStarts, blockCommentEnds);
- string [] lineComments = lineComment != null ? new string [] { lineComment } : new string [0];
+ var lang = TextMateLanguage.Create (SyntaxHighlightingService.GetScopeForFileName (document.FileName));
+ var lineComments = lang.LineComments;
+ var blockCommentStarts = lang.BlockComments.Select (b => b.Item1).ToList ();
+ var blockCommentEnds = lang.BlockComments.Select (b => b.Item2).ToList ();
var stringQuotes = new string [] { "\"", "'" };