with SourceProjectContent.LoadForCode i can add code to a "project". but how would i get the syntax errors without loading the code into a "syntaxeditor".
Each CompilationUnit has a SyntaxErrors collection. So if you are tracking which source key (filenames) you pass the SourceProjectContent, you could iterate through GetTypesForSourceKey for each source key and on the first type in that array, if any, find its parent CompilationUnit and look at its SyntaxErrors collection.
Would it help if we added a collection of source keys that are currently in use. Like maybe return an array of strings?
Okay ya that will work. Is the Rootnode always the CompilationUnit? Or do i need to find the parent that is a CompilationUnit?
For some people it might help to have that collection of source keys, but not so much for me.
How could i be notified of changes to a CompilationUnit so i can pull its new error list from it. Maybe when it is reparsed or some event i could handle?
That would work and i do that for compiler errors. But the SyntaxError class has the text offset i should be able to convert that to a line number and even a column. I am betting that actipro has a method for figuring this out. Time will tell
It's best to use AstNode.FindAncestor and look for an ICompilationUnit (or your specific CompilationUnit class). Generally RootNode will be the compilation unit however in the future there might be merged language scenarios where that might change.
For tracking changes you can handle the SyntaxEditor.DocumentSemanticParseDataChanged events of the SyntaxEditors that are open.
The Getting Started topic in the documentation has a section on converting from offsets to document positions (line numbers), etc. so check that out.
3) But i don't have a SyntaxEditor a document or editorview just the DotNetProjectResolver.
Maybe as of now it isn’t possible. It would be nice so I can populate a line number. I can work with textrange but it would be nice to have a line and column for the end user to see.