daveoftheparty / speedy-moq

Generate boilerplate code for Moq in C#
MIT License
1 stars 0 forks source link

diagnoser might be slightly borked #19

Closed daveoftheparty closed 3 years ago

daveoftheparty commented 3 years ago

working on wt-unit.task branch, which may be totally related...

when the two lines in the test below are commented out, we get our diagnostic/quickfix/code generation.

when the lines are uncommented, we do not get any of that. my guess is it's because I thought I figured what all CS diagnostics I needed to collect from rosyln to detect this "bare interface name on line" and I'm missing some. Alternatively, since I've now wired things up so that diagnostics don't publish UNTIL we have code generation ready (all interfaces from project have been loaded)... might ditch the rosyln diagnostics altogether in the IDiagnoser implementation, and literally just do string parsing:

Does a single symbol on an empty line have a corresponding lookup in our interface dictionary?

using NUnit.Framework;
using Moq;
using Features;

namespace Features.UnitTests
{
    public class CommitteeTests
    {

        [Test]
        public void Go()
        {
            IGreeter
            // var sut = new WelcomeCommittee();
            // var actual = sut.GetHello("john");
        }
    }
}
daveoftheparty commented 3 years ago

Tested in main-- it's a bug with the code in general.

daveoftheparty commented 3 years ago

Main fix was to stop looking at rosyln diagnostic code Ids, and just use the diagnostics to find parts of the document that are interesting, and then make sure that the "symbol" or text under diagnostic range is the only non-whitespace thing occurring on that line of text.