roslyn-sdk icon indicating copy to clipboard operation
roslyn-sdk copied to clipboard

Consider documenting how to work with Markup references

Open taori opened this issue 2 years ago • 1 comments

I just began changing a unit test to assist me with writing a codefix and noticed that the way to verify diagnostics/fixes has changed.

I noticed this syntax in the testcode:

        class {|#0:TypeName|}
        {   

combined with

			var expected = VerifyCS.Diagnostic(MemberIndentAnalyzer.Rule)
				.WithLocation(0)
				.WithArguments("TypeName");

to generate a diagnostic. Unless there already is a documentation on how this works i would appreciate it if this was documented. I was unable to find docs here

An entry at quickstart: Testing analyzers would have been rather useful here, or ofc in the project template a reference to a MD file in this repo.

My unit test reports "The markup location '#0' was not found in the input." which i don't really understand. I am assuming here (because i found no documentation) that i am configuring myself a diagnostic with the implicit location reference "0" where the diagnostic contains the message parameter "TypeName" while in the test code i have a magic syntax that declares the position of {|#0|} while expecting TypeName to be in that place. Perhaps some documentation would help me to figure out why this is working (because the old way of manually specifying location was much more tedious, so i would really love to understand this)

taori avatar Jul 12 '22 13:07 taori

About the error warning: It was actually misleading. Once i added the markup to the fixtest code i no longer got that issue

taori avatar Jul 12 '22 14:07 taori