Exemplo n.º 1
0
        public ParseInformation Parse(
            FileName fileName,
            ITextSource fileContent,
            TypeScriptProject project,
            IEnumerable <TypeScriptFile> files)
        {
            try {
                using (TypeScriptContext context = contextFactory.CreateContext()) {
                    context.AddFile(fileName, fileContent.Text);
                    context.RunInitialisationScript();

                    NavigationBarItem[] navigation = context.GetNavigationInfo(fileName);
                    var unresolvedFile             = new TypeScriptUnresolvedFile(fileName);
                    unresolvedFile.AddNavigation(navigation, fileContent);

                    if (project != null)
                    {
                        context.AddFiles(files);
                        var          document    = new TextDocument(fileContent);
                        Diagnostic[] diagnostics = context.GetDiagnostics(fileName, project.GetOptions());
                        TypeScriptService.TaskService.Update(diagnostics, fileName);
                    }

                    return(new ParseInformation(unresolvedFile, fileContent.Version, true));
                }
            } catch (Exception ex) {
                Console.WriteLine(ex.ToString());
                LoggingService.Debug(ex.ToString());
            }

            return(new ParseInformation(
                       new TypeScriptUnresolvedFile(fileName),
                       fileContent.Version,
                       true));
        }
 public TypeScriptProjectContent(TypeScriptProject project)
 {
     Options = project.GetOptions();
 }
Exemplo n.º 3
0
		public ParseInformation Parse(
			FileName fileName,
			ITextSource fileContent,
			TypeScriptProject project,
			IEnumerable<TypeScriptFile> files)
		{
			try {
				using (TypeScriptContext context = contextFactory.CreateContext()) {
					context.AddFile(fileName, fileContent.Text);
					context.RunInitialisationScript();
					
					NavigationBarItem[] navigation = context.GetNavigationInfo(fileName);
					var unresolvedFile = new TypeScriptUnresolvedFile(fileName);
					unresolvedFile.AddNavigation(navigation, fileContent);
					
					if (project != null) {
						context.AddFiles(files);
						var document = new TextDocument(fileContent);
						Diagnostic[] diagnostics = context.GetDiagnostics(fileName, project.GetOptions());
						TypeScriptService.TaskService.Update(diagnostics, fileName);
					}
					
					return new ParseInformation(unresolvedFile, fileContent.Version, true);
				}
			} catch (Exception ex) {
				Console.WriteLine(ex.ToString());
				LoggingService.Debug(ex.ToString());
			}
			
			return new ParseInformation(
				new TypeScriptUnresolvedFile(fileName),
				fileContent.Version,
				true);
		}
Exemplo n.º 4
0
 public TypeScriptProjectContent(TypeScriptProject project)
 {
     Options = project.GetOptions();
 }