Giter Club home page Giter Club logo

monodevelop.xml's People

Contributors

alanmcgovern avatar atsushieno avatar bratsche avatar codebutler avatar davidkarlas avatar duncanmak avatar garuma avatar jstedfast avatar kirillosenkov avatar knocte avatar mdmarin avatar mhutch avatar mkestner avatar mkrueger avatar mrward avatar radical avatar sevoku avatar slluis avatar sparek avatar tak avatar therzok avatar xamarin-release-manager avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

monodevelop.xml's Issues

XProcessingInstruction starts at -1

When parsing this XML I see XProcessingInstruction node start at -1:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<X>
  <n:T></n:T>
  <X/>
  <A.B></A.B>
  <A B="a"></A>
  <A>&#x03C0;</A>
  <A>a &lt;</A>
  <A><![CDATA[bar]]></A>
  <!-- comment -->
</X>

GetNodesIntersectingRange doesn't include the root node

Is it by design that calling XmlDomExtensions.GetNodesIntersectingRange and passing it a range of a subelement doesn't include the parent element?

E.g.

<A>
<B>
</B>
</A>

passing the range of B only returns B, but A's range isn't considered intersecting it?

XmlHighlightEndTagTagger doesn't implement ITagger<NavigableHighlightTag>

This location expects a tagger of tag type NavigableHighlightTag:

using (var tagAggregator = _tagAggregatorFactory.CreateTagAggregator<NavigableHighlightTag> (args.TextView)) {

But the corresponding tagger doesn't implement it, it implements ITextMarkerTag:

class XmlHighlightEndTagTagger : HighlightTagger<ITextMarkerTag, ITextMarkerTag>

Assert in XmlNameState.PushChar on <x :

When parsing <x : I get an assert:

https://github.com/KirillOsenkov/MonoDevelop.Xml/blob/523dcc1f207bf432dd865b9874ab85172e3b6722/Core/Parser/XmlNameState.cs#L48

MonoDevelop.Xml.Parser.XmlNameState.PushChar Line 73
MonoDevelop.Xml.Parser.XmlParser.Push Line 90

I'm not sure that it's a bug per se, as the parser seems to be able to recover, but in general I think the parser should be able to handle any inputs. Curious what you think.

Here's a test:

		[Test]
		public void BadOpeningTagWithNamespace ()
		{
			var parser = new XmlTreeParser (CreateRootState ());
			parser.Parse ("<x :");
			parser.AssertErrorCount (2);
		}

InvalidOperationException: invalid state in XmlNameState.PushChar

Parse this code:

<X>
  <n:
  T></n:T>
  <X/>
</X>
System.InvalidOperationException: Invalid state
   at XmlParserState MonoDevelop.Xml.Parser.XmlNameState.PushChar(char c, XmlParserContext context, ref string rollback) in C:/MonoDevelop.Xml/Core/Parser/XmlNameState.cs:line 46
   at void MonoDevelop.Xml.Parser.XmlParser.Push(char c) in C:/MonoDevelop.Xml/Core/Parser/XmlParser.cs:line 90
   at Task<XmlParseResult> MonoDevelop.Xml.Editor.Completion.XmlBackgroundParser.StartOperationAsync(ITextSnapshot input, XmlParseResult previousOutput, ITextSnapshot previousInput, CancellationToken token)+() => { } in C:/MonoDevelop.Xml/Editor/Parsing/XmlBackgroundParser.cs:line 39
   at void System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at bool System.Threading.ThreadPoolWorkQueue.Dispatch()
   at bool System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

AutoClosingTag doesn't work in large files

In a large XML file, type <a a="a" and then type the closing >

The closing tag is likely not inserted. This is because at the time when the command handler runs the parse tree for the new snapshot that has the > that was just inserted is not yet available, so a call to GetSpineParser is recovered from the previous tree that doesn't have the closing >.

Since in the previous tree the > is not there, the element under caret is not IsEnded and the condition here bails:

if (el == null || !el.IsEnded || !el.IsNamed || el.Span.End != position.Position) {

It is noteworthy how even though the text and the parse tree is identical up to the caret position, the shape of the parse tree after the caret position is different and thus impacting whether the current element is ended or not. For small files the latest parse tree is usually available at that point, and in that tree the element is Ended, so the command handler executes.

This patch fixes it by always forcing the full tree for the latest snapshot:

image

However this totally kills perf as it forces a synchronous parse of the latest snapshot immediately on typing. I'm not sure what's the best thing to do here, perhaps some heuristic to make just this particular case work.

NullRef in XmlBackgroundParser.MaximumCompatiblePosition (XmlBackgroundParser.cs:line 58)

System.NullReferenceException: Object reference not set to an instance of an object.
   at int MonoDevelop.Xml.Editor.Completion.XmlBackgroundParser.MaximumCompatiblePosition(ITextSnapshot snapshotA, ITextSnapshot snapshotB) in C:/MonoDevelop.Xml/Editor/Parsing/XmlBackgroundParser.cs:line 58
   at XmlSpineParser MonoDevelop.Xml.Editor.Completion.XmlBackgroundParser.GetSpineParser(SnapshotPoint point) in C:/MonoDevelop.Xml/Editor/Parsing/XmlBackgroundParser.cs:line 81
   at async Task<(SnapshotSpan sourceSpan, ImmutableArray<ValueTuple<ReferenceUsage, SnapshotSpan>> highlights)> MonoDevelop.MSBuild.Editor.HighlightReferences.MSBuildHighlightReferencesTagger.GetHighlightsAsync(SnapshotPoint caretLocation, CancellationToken token)
   at void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<TResult>.Start<TStateMachine>(ref TStateMachine stateMachine)
   at Task<(SnapshotSpan sourceSpan, ImmutableArray<ValueTuple<ReferenceUsage, SnapshotSpan>> highlights)> MonoDevelop.MSBuild.Editor.HighlightReferences.MSBuildHighlightReferencesTagger.GetHighlightsAsync(SnapshotPoint caretLocation, CancellationToken token)
   at async void MonoDevelop.Xml.Editor.HighlightReferences.HighlightTagger<TTag, TKind>.TimerFired(object state)+(?) => { } in C:/MonoDevelop.Xml/Editor/HighlightReferences/HighlightTagger.cs:line 68

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.