public T4PreprocessingResult Preprocess()

in Backend/RiderPlugin/ForTea.RiderPlugin/ProtocolAware/Services/Impl/T4TemplatePreprocessingManager.cs [55:81]


    public T4PreprocessingResult Preprocess(IT4File file)
    {
      Logger.Verbose("Preprocessing a file");
      var psiSourceFile = file.PhysicalPsiSourceFile.NotNull();
      var projectFile = psiSourceFile.ToProjectFile().NotNull();
      var solution = file.GetSolution();
      var contextFreeTree = psiSourceFile.BuildT4Tree();
      var location = new T4FileLocation(solution.GetComponent<ProjectModelViewHost>().GetIdByItem(projectFile));
      try
      {
        string message = T4RiderCodeGeneration.GeneratePreprocessedCode(contextFreeTree).RawText;
        solution.Locks.ExecuteOrQueueEx(solution.GetSolutionLifetimes().UntilSolutionCloseLifetime,
          "T4 template preprocessing", () =>
          {
            using (WriteLockCookie.Create())
            {
              TargetFileManager.SavePreprocessResults(file, message);
            }
          });
        return new T4PreprocessingResult(location, true, new List<T4BuildMessage>());
      }
      catch (T4OutputGenerationException e)
      {
        var message = BuildMessageConverter.ToT4BuildMessages(e.FailureDatum.AsEnumerable());
        return new T4PreprocessingResult(location, false, message);
      }
    }