当前位置: 首页>>代码示例>>C#>>正文


C# IPsiSourceFile.GetSolution方法代码示例

本文整理汇总了C#中IPsiSourceFile.GetSolution方法的典型用法代码示例。如果您正苦于以下问题:C# IPsiSourceFile.GetSolution方法的具体用法?C# IPsiSourceFile.GetSolution怎么用?C# IPsiSourceFile.GetSolution使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPsiSourceFile的用法示例。


在下文中一共展示了IPsiSourceFile.GetSolution方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Process

    public void Process(IPsiSourceFile sourceFile, IRangeMarker rangeMarkerMarker, CodeCleanupProfile profile, IProgressIndicator progressIndicator)
    {
      ISolution solution = sourceFile.GetSolution();
      if (!profile.GetSetting(OurDescriptor))
      {
        return;
      }

      IPsiFile[] files = sourceFile.GetPsiFiles<PsiLanguage>().Cast<IPsiFile>().ToArray();
      using (progressIndicator.SafeTotal("Reformat Psi", files.Length))
      {
        foreach (IPsiFile file in files)
        {
          using (IProgressIndicator pi = progressIndicator.CreateSubProgress(1))
          {
            using (WriteLockCookie.Create())
            {
              var languageService = file.Language.LanguageService();
              Assertion.Assert(languageService != null, "languageService != null");
              var formatter = languageService.CodeFormatter;
              Assertion.Assert(formatter != null, "formatter != null");

              PsiManager.GetInstance(sourceFile.GetSolution()).DoTransaction(
                delegate
                {
                  if (rangeMarkerMarker != null && rangeMarkerMarker.IsValid)
                  {
                    formatter.Format(
                      solution,
                      rangeMarkerMarker.DocumentRange,
                      CodeFormatProfile.DEFAULT,
                      true,
                      false,
                      pi);
                  }
                  else
                  {
                    formatter.FormatFile(
                      file,
                      CodeFormatProfile.DEFAULT,
                      pi);
                  }
                }, "Code cleanup");
            }
          }
        }
      }
    }
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:48,代码来源:ReformatCode.cs

示例2: Add

        public ITreeNode Add(IPsiSourceFile sourceFile, string text, int start, int len)
        {
            var name = text.Substring(start, len);
              NitraDeclaredElement declaredElement;
              if (!_declaredElements.TryGetValue(name.ToLower(), out declaredElement))
            declaredElement = new NitraDeclaredElement(sourceFile.GetSolution(), name);

              if (name.Length > 0 && char.IsUpper(name[0]))
              {
            var node = new NitraDeclaration(declaredElement, sourceFile, name, start, len);
            declaredElement.AddDeclaration(node);
            _declaredElements.Add(name, declaredElement);
            return node;
              }
              else
              {
            List<NitraNameReference> refs;
            if (!_references.TryGetValue(declaredElement, out refs))
            {
              refs = new List<NitraNameReference>();
              _references.Add(declaredElement, refs);
            }

            var node = new NitraNameReference(sourceFile, name, start, len);
            refs.Add(node);
            return node;
              }
        }
开发者ID:lhsail,项目名称:Nitra,代码行数:28,代码来源:NitraProject.cs

示例3: Process

        /// <summary>
        /// Process clean-up on file.
        /// </summary>
        /// <param name="projectFile">
        /// The project file to process.
        /// </param>
        /// <param name="rangeMarker">
        /// The range marker to process.
        /// </param>
        /// <param name="profile">
        /// The code cleanup settings to use.
        /// </param>
        /// <param name="progressIndicator">
        /// The progress indicator.
        /// </param>
        public void Process(
            IPsiSourceFile projectFile, IRangeMarker rangeMarker, CodeCleanupProfile profile, JB::JetBrains.Application.Progress.IProgressIndicator progressIndicator)
        {
            if (projectFile == null)
            {
                return;
            }

            if (!this.IsAvailable(projectFile))
            {
                return;
            }

            ISolution solution = projectFile.GetSolution();

            ICSharpFile file = projectFile.GetPsiFile<CSharpLanguage>() as ICSharpFile;

            if (file == null)
            {
                return;
            }

            PsiManager.GetInstance(solution).DoTransaction(() => this.InternalProcess(profile, file), "Code cleanup");

            StyleCopTrace.Out();
        }
开发者ID:transformersprimeabcxyz,项目名称:_TO-FIRST-stylecop,代码行数:41,代码来源:StyleCopCodeCleanupModule.cs

示例4: Process

        /// <summary>
        /// Process clean-up on file.
        /// </summary>
        /// <param name="projectFile">
        /// The project file to process.
        /// </param>
        /// <param name="rangeMarker">
        /// The range marker to process.
        /// </param>
        /// <param name="profile">
        /// The code cleanup settings to use.
        /// </param>
        /// <param name="progressIndicator">
        /// The progress indicator.
        /// </param>
        public void Process(
            IPsiSourceFile projectFile, IRangeMarker rangeMarker, CodeCleanupProfile profile, JetBrains.Application.Progress.IProgressIndicator progressIndicator)
        {
            if (projectFile == null)
            {
                return;
            }

            if (!this.IsAvailable(projectFile))
            {
                return;
            }

            ISolution solution = projectFile.GetSolution();

            ICSharpFile file = projectFile.GetDominantPsiFile<CSharpLanguage>() as ICSharpFile;

            if (file == null)
            {
                return;
            }

            var services = solution.GetPsiServices(); 
            services.Transactions.Execute("Code cleanup", () => this.InternalProcess(profile, file));

            StyleCopTrace.Out();
        }
开发者ID:transformersprimeabcxyz,项目名称:_TO-FIRST-stylecop,代码行数:42,代码来源:StyleCopCodeCleanupModule.cs

示例5: lock

		void ICache.Merge(IPsiSourceFile sourceFile, object builtPart)
		{
			var values = builtPart as List<IUnitTestElement>;
			if (values != null)
			{
				lock (_lock)
				{
					_elementsInFiles.RemoveKey(sourceFile);
					_elementsInFiles.AddValueRange(sourceFile, values);
				}

				var xml = "<Serialized></Serialized>";
				if (_elementsInFiles[sourceFile].Any())
				{
					var document = new XmlDocument();
					document.LoadXml(xml);
					var info = new PersistentUnitTestSessionInfo(sourceFile.GetSolution(), null)
					{
						Elements = _elementsInFiles[sourceFile]
					};
					info.WriteToXml(document.DocumentElement);
					xml = document.OuterXml;
				}

				if (_persistentCache != null)
				{
					_persistentCache.AddDataToSave(sourceFile, xml);
				}
			}
		}
开发者ID:sergeyt,项目名称:karma-resharper,代码行数:30,代码来源:TestCache.cs

示例6: GetPsiFile

 public static IPsiFile GetPsiFile(IPsiSourceFile sourceFile)
 {
   PsiManager manager = PsiManager.GetInstance(sourceFile.GetSolution());
   manager.AssertAllDocumentAreCommited();
   return manager.GetPsiFile<PsiLanguage>(new DocumentRange(sourceFile.Document, 0)) as IPsiFile;
 }
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:6,代码来源:PsiDaemonStageBase.cs

示例7: CreateHighlightDumper

 protected virtual TestHighlightingDumper CreateHighlightDumper(IPsiSourceFile sourceFile, TextWriter writer)
 {
     return new TestHighlightingDumper(sourceFile, writer, GetActiveStages(sourceFile.GetSolution()), HighlightingPredicate, CompilerIdsLanguage);
 }
开发者ID:KozhevnikovDmitry,项目名称:MockMetrics,代码行数:4,代码来源:CSharpHighlightingWithinSolutionTestBase.cs


注:本文中的IPsiSourceFile.GetSolution方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。