diff options
Diffstat (limited to 'main/src/addins/AspNet/Html')
5 files changed, 27 insertions, 29 deletions
diff --git a/main/src/addins/AspNet/Html/BaseHtmlEditorExtension.cs b/main/src/addins/AspNet/Html/BaseHtmlEditorExtension.cs index b20a67c689..6d6f039cd0 100644 --- a/main/src/addins/AspNet/Html/BaseHtmlEditorExtension.cs +++ b/main/src/addins/AspNet/Html/BaseHtmlEditorExtension.cs @@ -84,7 +84,7 @@ namespace MonoDevelop.AspNet.Html return new XmlRootState (new HtmlTagState (), new HtmlClosingTagState (true)); } - public override void Initialize () + protected override void Initialize () { base.Initialize (); diff --git a/main/src/addins/AspNet/Html/DocTypeCompletionData.cs b/main/src/addins/AspNet/Html/DocTypeCompletionData.cs index 583293ab43..571f8e0125 100644 --- a/main/src/addins/AspNet/Html/DocTypeCompletionData.cs +++ b/main/src/addins/AspNet/Html/DocTypeCompletionData.cs @@ -29,6 +29,7 @@ using System; using MonoDevelop.Core; using MonoDevelop.Ide.CodeCompletion; +using MonoDevelop.Ide.Editor.Extension; namespace MonoDevelop.AspNet.Html { @@ -61,24 +62,21 @@ namespace MonoDevelop.AspNet.Html get { return name; } } - public override void InsertCompletionText (CompletionListWindow window, ref KeyActions ka, Gdk.Key closeChar, char keyChar, Gdk.ModifierType modifier) + public override void InsertCompletionText (CompletionListWindow window, ref KeyActions ka, KeyDescriptor descriptor) { - MonoDevelop.Ide.Gui.Content.IEditableTextBuffer buf = window.CompletionWidget as MonoDevelop.Ide.Gui.Content.IEditableTextBuffer; + var buf = window.CompletionWidget; if (buf != null) {
- using (var undo = buf.OpenUndoGroup ()) { - int deleteStartOffset = window.CodeCompletionContext.TriggerOffset; - if (text.StartsWith (docTypeStart)) { - int start = window.CodeCompletionContext.TriggerOffset - docTypeStart.Length; - if (start >= 0) { - string readback = buf.GetText (start, window.CodeCompletionContext.TriggerOffset); - if (string.Compare (readback, docTypeStart, StringComparison.OrdinalIgnoreCase) == 0) - deleteStartOffset -= docTypeStart.Length; - } + int deleteStartOffset = window.CodeCompletionContext.TriggerOffset; + if (text.StartsWith (docTypeStart)) { + int start = window.CodeCompletionContext.TriggerOffset - docTypeStart.Length; + if (start >= 0) { + string readback = buf.GetText (start, window.CodeCompletionContext.TriggerOffset); + if (string.Compare (readback, docTypeStart, StringComparison.OrdinalIgnoreCase) == 0) + deleteStartOffset -= docTypeStart.Length; } -
- buf.DeleteText (deleteStartOffset, buf.CursorPosition - deleteStartOffset); - buf.InsertText (buf.CursorPosition, text); - }
+ } +
+ buf.Replace (deleteStartOffset, buf.CaretOffset - deleteStartOffset, text); } } } diff --git a/main/src/addins/AspNet/Html/HtmlEditorExtension.cs b/main/src/addins/AspNet/Html/HtmlEditorExtension.cs index c287c6f7f0..b8913eadcd 100644 --- a/main/src/addins/AspNet/Html/HtmlEditorExtension.cs +++ b/main/src/addins/AspNet/Html/HtmlEditorExtension.cs @@ -26,9 +26,9 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -using ICSharpCode.NRefactory.TypeSystem; using MonoDevelop.Ide.TypeSystem; using MonoDevelop.Xml.Dom; +using MonoDevelop.Ide.Editor; namespace MonoDevelop.AspNet.Html { @@ -86,11 +86,11 @@ namespace MonoDevelop.AspNet.Html XElement el = n as XElement; if (el != null && el.IsClosed && el.ClosingTag.Region.End > region.End) { - region = new DomRegion (region.Begin, el.ClosingTag.Region.End); + region = new DocumentRegion (region.Begin, el.ClosingTag.Region.End); } - int s = Editor.Document.LocationToOffset (region.BeginLine, region.BeginColumn ); - int e = Editor.Document.LocationToOffset (region.EndLine, region.EndColumn); + int s = Editor.LocationToOffset (region.BeginLine, region.BeginColumn ); + int e = Editor.LocationToOffset (region.EndLine, region.EndColumn); if (e > s && s > -1) Editor.SetSelection (s, e); } diff --git a/main/src/addins/AspNet/Html/HtmlParser.cs b/main/src/addins/AspNet/Html/HtmlParser.cs index 6938328c0c..05f80ff6b3 100644 --- a/main/src/addins/AspNet/Html/HtmlParser.cs +++ b/main/src/addins/AspNet/Html/HtmlParser.cs @@ -30,21 +30,20 @@ using System; using System.Collections.Generic; using System.IO; -using ICSharpCode.NRefactory.TypeSystem; - using MonoDevelop.Ide.TypeSystem; using MonoDevelop.Projects; using MonoDevelop.Xml.Dom; using MonoDevelop.Xml.Parser; using MonoDevelop.AspNet.Html.Parser; +using MonoDevelop.Core.Text; namespace MonoDevelop.AspNet.Html { public class HtmlParser : TypeSystemParser { - public override ParsedDocument Parse (bool storeAst, string fileName, TextReader tr, Project project = null) + public override System.Threading.Tasks.Task<ParsedDocument> Parse (ParseOptions parseOptions, System.Threading.CancellationToken cancellationToken) { - var doc = new MonoDevelop.Xml.Editor.XmlParsedDocument (fileName); + var doc = new MonoDevelop.Xml.Editor.XmlParsedDocument (parseOptions.FileName); doc.Flags = ParsedDocumentFlags.NonSerializable; try { @@ -52,16 +51,16 @@ namespace MonoDevelop.AspNet.Html new XmlRootState (new HtmlTagState (), new HtmlClosingTagState (true)), true); - xmlParser.Parse (tr); + xmlParser.Parse (parseOptions.Content.CreateReader ()); doc.XDocument = xmlParser.Nodes.GetRoot (); - doc.Add (xmlParser.Errors); + doc.AddRange (xmlParser.Errors); if (doc.XDocument != null) - doc.Add (Validate (doc.XDocument)); + doc.AddRange (Validate (doc.XDocument)); } catch (Exception ex) { MonoDevelop.Core.LoggingService.LogError ("Unhandled error parsing HTML document", ex); } - return doc; + return System.Threading.Tasks.Task.FromResult((ParsedDocument)doc); } IEnumerable<Error> Validate (XDocument doc) diff --git a/main/src/addins/AspNet/Html/HtmlPathCompletion.cs b/main/src/addins/AspNet/Html/HtmlPathCompletion.cs index b5b5596a70..4bbd0a0d64 100644 --- a/main/src/addins/AspNet/Html/HtmlPathCompletion.cs +++ b/main/src/addins/AspNet/Html/HtmlPathCompletion.cs @@ -30,6 +30,7 @@ using MonoDevelop.Projects; using MonoDevelop.Core; using System.Text.RegularExpressions; using MonoDevelop.Ide; +using MonoDevelop.Ide.Editor.Extension; namespace MonoDevelop.AspNet.Html { @@ -116,7 +117,7 @@ namespace MonoDevelop.AspNet.Html get { throw new InvalidOperationException (); } } - public override void InsertCompletionText (CompletionListWindow window, ref KeyActions ka, Gdk.Key closeChar, char keyChar, Gdk.ModifierType modifier) + public override void InsertCompletionText (CompletionListWindow window, ref KeyActions ka, KeyDescriptor descriptor) { string text; var dialog = new MonoDevelop.Ide.Projects.ProjectFileSelectorDialog (proj, "", pattern); |