コード例 #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));
        }
コード例 #2
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);
		}