// Internal for testing internal void StartParser() { _dispatcher.AssertForegroundThread(); // Make sure any tests use the real thing or a good mock. These tests can cause failures // that are hard to understand when this throws. Debug.Assert(_documentTracker.IsSupportedProject); Debug.Assert(_documentTracker.ProjectSnapshot != null); _projectEngine = _projectEngineFactory.Create(_documentTracker.ProjectSnapshot, ConfigureProjectEngine); Debug.Assert(_projectEngine != null); Debug.Assert(_projectEngine.Engine != null); Debug.Assert(_projectEngine.FileSystem != null); // We might not have a document snapshot in the case of an ephemeral project. // If we can't be sure, then just assume it's an MVC view since that's likely anyway. var fileKind = _documentTracker.ProjectSnapshot?.GetDocument(_documentTracker.FilePath)?.FileKind ?? FileKinds.Legacy; var projectDirectory = Path.GetDirectoryName(_documentTracker.ProjectPath); _parser = new BackgroundParser(_projectEngine, FilePath, projectDirectory, fileKind); _parser.ResultsReady += OnResultsReady; _parser.Start(); TextBuffer.Changed += TextBuffer_OnChanged; }
// Internal for testing internal void StartParser() { _joinableTaskContext.AssertUIThread(); // Make sure any tests use the real thing or a good mock. These tests can cause failures // that are hard to understand when this throws. Debug.Assert(_documentTracker.IsSupportedProject); Debug.Assert(_documentTracker.ProjectSnapshot != null); _projectEngine = _projectEngineFactory.Create(_documentTracker.ProjectSnapshot, ConfigureProjectEngine); Debug.Assert(_projectEngine != null); Debug.Assert(_projectEngine.Engine != null); Debug.Assert(_projectEngine.FileSystem != null); // We might not have a document snapshot in the case of an ephemeral project. // If we don't have a document then infer the FileKind from the FilePath. var fileKind = _documentTracker.ProjectSnapshot?.GetDocument(_documentTracker.FilePath)?.FileKind ?? FileKinds.GetFileKindFromFilePath(_documentTracker.FilePath); var projectDirectory = Path.GetDirectoryName(_documentTracker.ProjectPath); _parser = new BackgroundParser(_projectEngine, FilePath, projectDirectory, fileKind); _parser.ResultsReady += OnResultsReady; _parser.Start(); TextBuffer.Changed += TextBuffer_OnChanged; }
// Internal for testing internal void StartParser() { _dispatcher.AssertForegroundThread(); var projectDirectory = Path.GetDirectoryName(_documentTracker.ProjectPath); _templateEngine = _templateEngineFactory.Create(projectDirectory, ConfigureTemplateEngine); _parser = new BackgroundParser(TemplateEngine, FilePath); _parser.ResultsReady += OnResultsReady; _parser.Start(); TextBuffer.Changed += TextBuffer_OnChanged; }
// Internal for testing internal void StartParser() { _dispatcher.AssertForegroundThread(); // Make sure any tests use the real thing or a good mock. These tests can cause failures // that are hard to understand when this throws. Debug.Assert(_documentTracker.IsSupportedProject); Debug.Assert(_documentTracker.ProjectSnapshot != null); _projectEngine = _projectEngineFactory.Create(_documentTracker.ProjectSnapshot, ConfigureProjectEngine); Debug.Assert(_projectEngine != null); Debug.Assert(_projectEngine.Engine != null); Debug.Assert(_projectEngine.FileSystem != null); var projectDirectory = Path.GetDirectoryName(_documentTracker.ProjectPath); _parser = new BackgroundParser(_projectEngine, FilePath, projectDirectory); _parser.ResultsReady += OnResultsReady; _parser.Start(); TextBuffer.Changed += TextBuffer_OnChanged; }