From 797979974d1de83f14be2b129cbb2ab9652214da Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Tue, 5 Jun 2007 20:17:28 +0000 Subject: [PATCH] Syntax highlighting: Allow keyword groups without keywords to fix SD2-1354: Saving an empty keyword list using the highlighting editor causes the highlighting file to become invalid git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.1@2539 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../ICSharpCode.TextEditor/Project/Resources/Mode.xsd | 3 ++- .../Project/Src/Gui/TextEditorControlBase.cs | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Resources/Mode.xsd b/src/Libraries/ICSharpCode.TextEditor/Project/Resources/Mode.xsd index 1297c6e1b3..81a79dc62f 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Resources/Mode.xsd +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Resources/Mode.xsd @@ -188,8 +188,9 @@ + - + diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextEditorControlBase.cs b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextEditorControlBase.cs index 4229b37ba6..1e05721d95 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextEditorControlBase.cs +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/TextEditorControlBase.cs @@ -624,7 +624,11 @@ namespace ICSharpCode.TextEditor document.UndoStack.ClearAll(); document.BookmarkManager.Clear(); if (autoLoadHighlighting) { - document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategyForFile(fileName); + try { + document.HighlightingStrategy = HighlightingStrategyFactory.CreateHighlightingStrategyForFile(fileName); + } catch (HighlightingDefinitionInvalidException ex) { + MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } } if (autodetectEncoding) {