mono/monodevelop

How to extend SyntaxModes on 7.x?

Closed this issue · 2 comments

Trying to install add-in on MonoDevelop 7.4 produces following message:

The add-in [...] is trying to extend '/MonoDevelop/SourceEditor2/SyntaxModes', but there isn't any add-in defining this extension point.

From addin.xml:

<Extension path="/MonoDevelop/SourceEditor2/SyntaxModes">
     <Templates file="SyntaxModes/DnnSqlDataProviderSyntaxMode.xml" />
</Extension>

Previously this worked fine with MonoDevelop 6.3.

The /MonoDevelop/SourceEditor2/SyntaxModes extension point no longer exists.

It should be possible to use the /MonoDevelop/SourceEditor2/Bundles.

ca594de

However the old syntax xml file format is no longer supported. The file formats supported are listed:

if (file.EndsWith (".json", StringComparison.OrdinalIgnoreCase)) {
using (var stream = openStream ()) {
string styleName;
JSonFormat format;
if (TryScanJSonStyle (stream, out styleName, out format)) {
switch (format) {
case JSonFormat.OldSyntaxTheme:
var theme = OldFormat.ImportColorScheme (getStreamProvider ().Open ());
if (theme != null)
bundle.Add (theme);
return theme;
case JSonFormat.TextMateJsonSyntax:
SyntaxHighlightingDefinition highlighting = TextMateFormat.ReadHighlightingFromJson (getStreamProvider().Open ());
if (highlighting != null)
bundle.Add (highlighting);
return highlighting;
}
}
}
} else if (file.EndsWith (".tmTheme", StringComparison.OrdinalIgnoreCase)) {
using (var stream = openStream ()) {
string styleName = ScanTextMateStyle (stream);
if (!string.IsNullOrEmpty (styleName)) {
var theme = TextMateFormat.LoadEditorTheme (getStreamProvider ().Open ());
if (theme != null)
bundle.Add (theme);
return theme;
} else {
LoggingService.LogError ("Invalid .tmTheme theme file : " + file);
}
}
} else if (file.EndsWith (".vssettings", StringComparison.OrdinalIgnoreCase)) {
using (var stream = openStream ()) {
string styleName = Path.GetFileNameWithoutExtension (file);
EditorTheme theme;
try {
theme = OldFormat.ImportVsSetting (styleName, getStreamProvider ().Open ());
} catch (StyleImportException e) {
switch (e.Reason) {
case StyleImportException.ImportFailReason.Unknown:
LoggingService.LogWarning ("Unknown error in theme file : " + file, e);
break;
case StyleImportException.ImportFailReason.NoValidColorsFound:
LoggingService.LogWarning ("No colors defined in vssettings : " + file, e);
break;
}
return null;
} catch (Exception e) {
LoggingService.LogWarning ("Invalid theme : " + file, e);
return null;
}
if (theme != null)
bundle.Add (theme);
return theme;
}
} else if (file.EndsWith (".tmLanguage", StringComparison.OrdinalIgnoreCase)) {
using (var stream = openStream ()) {
var highlighting = TextMateFormat.ReadHighlighting (stream);
if (highlighting != null)
bundle.Add (highlighting);
return highlighting;
}
} else if (file.EndsWith (".sublime-syntax", StringComparison.OrdinalIgnoreCase)) {
using (var stream = new StreamReader (openStream ())) {
var highlighting = Sublime3Format.ReadHighlighting (stream);
if (highlighting != null)
bundle.Add (highlighting);
return highlighting;
}
} else if (file.EndsWith (".sublime-package", StringComparison.OrdinalIgnoreCase) || file.EndsWith (".tmbundle", StringComparison.OrdinalIgnoreCase)) {
try {
using (var stream = new ICSharpCode.SharpZipLib.Zip.ZipInputStream (openStream ())) {
var entry = stream.GetNextEntry ();
var newBundle = new LanguageBundle (Path.GetFileNameWithoutExtension (file), file);
while (entry != null) {
if (entry.IsFile && !entry.IsCrypted) {
if (stream.CanDecompressEntry) {
byte [] data = new byte [entry.Size];
stream.Read (data, 0, (int)entry.Size);
LoadFile (newBundle, entry.Name, () => new MemoryStream (data), () => new MemoryStreamProvider (data, entry.Name));
}
}
entry = stream.GetNextEntry ();
}
languageBundles.Add (newBundle);
return newBundle;
}
} catch (Exception e) {
LoggingService.LogError ("Error while reading : " + file, e);
}
} else if (file.EndsWith (".tmPreferences", StringComparison.OrdinalIgnoreCase)) {
using (var stream = openStream ()) {
var preference = TextMateFormat.ReadPreferences (stream);
if (preference != null)
bundle.Add (preference);
return preference;
}
} else if (file.EndsWith (".tmSnippet", StringComparison.OrdinalIgnoreCase)) {
using (var stream = openStream ()) {
var snippet = TextMateFormat.ReadSnippet (stream);
if (snippet != null)
bundle.Add (snippet);
return snippet;
}
} else if (file.EndsWith (".sublime-snippet", StringComparison.OrdinalIgnoreCase)) {

OK, thanks!

Never understood the old XML file format completely, so I think it's gone for good.