public ICompilationUnit Parse( IProjectContent projectContent, string fileName, ITextBuffer fileContent, IEnumerable <TypeScriptFile> files) { try { using (TypeScriptContext context = contextFactory.CreateContext()) { var file = new FileName(fileName); context.AddFile(file, fileContent.Text); context.RunInitialisationScript(); NavigationBarItem[] navigation = context.GetNavigationInfo(file); var unit = new TypeScriptCompilationUnit(projectContent) { FileName = fileName }; unit.AddNavigation(navigation, fileContent); var typeScriptProjectContent = projectContent as TypeScriptProjectContent; if (typeScriptProjectContent != null) { context.AddFiles(files); IDocument document = DocumentUtilitites.LoadReadOnlyDocumentFromBuffer(fileContent); Diagnostic[] diagnostics = context.GetDiagnostics(file, typeScriptProjectContent.Options); TypeScriptService.TaskService.Update(diagnostics, file, document); } return(unit); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); LoggingService.Debug(ex.ToString()); } return(new DefaultCompilationUnit(projectContent)); }
public ICompilationUnit Parse( IProjectContent projectContent, string fileName, ITextBuffer fileContent, IEnumerable<TypeScriptFile> files) { try { using (TypeScriptContext context = contextFactory.CreateContext()) { var file = new FileName(fileName); context.AddFile(file, fileContent.Text); context.RunInitialisationScript(); NavigationBarItem[] navigation = context.GetNavigationInfo(file); var unit = new TypeScriptCompilationUnit(projectContent) { FileName = fileName }; unit.AddNavigation(navigation, fileContent); var typeScriptProjectContent = projectContent as TypeScriptProjectContent; if (typeScriptProjectContent != null) { context.AddFiles(files); IDocument document = DocumentUtilitites.LoadReadOnlyDocumentFromBuffer(fileContent); Diagnostic[] diagnostics = context.GetDiagnostics(file, typeScriptProjectContent.Options); TypeScriptService.TaskService.Update(diagnostics, file, document); } return unit; } } catch (Exception ex) { Console.WriteLine(ex.ToString()); LoggingService.Debug(ex.ToString()); } return new DefaultCompilationUnit(projectContent); }
public ICompilationUnit Parse(IProjectContent projectContent, string fileName, ITextBuffer fileContent) { try { using (TypeScriptContext context = contextFactory.CreateContext()) { var file = new FileName(fileName); context.AddFile(file, fileContent.Text); context.RunInitialisationScript(); NavigationInfo navigationInfo = context.GetOutliningRegions(file); var unit = new TypeScriptCompilationUnit(projectContent) { FileName = fileName }; unit.AddNavigationInfo(navigationInfo, fileContent); return unit; } } catch (Exception ex) { Console.WriteLine(ex.ToString()); LoggingService.Debug(ex.ToString()); } return new DefaultCompilationUnit(projectContent); }