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


C# ISolution.GetPsiServices方法代码示例

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


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

示例1: AfterCompletion

        protected override sealed void AfterCompletion(
      ITextControl textControl, ISolution solution, Suffix suffix,
      TextRange resultRange, string targetText, int caretOffset)
        {
            solution.GetPsiServices().CommitAllDocuments();

              var expressions = TextControlToPsi
            .GetSelectedElements<ICSharpExpression>(solution, textControl.Document, resultRange);
              foreach (var expression in expressions)
              {
            AcceptExpression(textControl, solution, resultRange, expression);
            break;
              }
        }
开发者ID:Restuta,项目名称:PostfixCompletion,代码行数:14,代码来源:ProcessExpressionPostfixLookupItem.cs

示例2: Build

        public IContextActionDataProvider Build(ISolution solution, ITextControl textControl)
        {
            if (!solution.GetPsiServices().Caches.IsIdle.Value)
            {
                return null;
            }

            IPsiSourceFile psiSourceFile = textControl.Document.GetPsiSourceFile(solution);
            if (psiSourceFile == null || !psiSourceFile.IsValid())
            {
                return null;
            }

            var file =
                psiSourceFile.GetPsiFile<NTriplesLanguage>(new DocumentRange(textControl.Document, textControl.Caret.Offset())) as
                INTriplesFile;
            if (file == null || !file.IsValid() || !file.Language.Is<NTriplesLanguage>())
            {
                return null;
            }

            return new NTriplesContextActionDataProvider(solution, textControl, file);
        }
开发者ID:xsburg,项目名称:ReSharper.NTriples,代码行数:23,代码来源:NTriplesContextActionDataBuilder.cs

示例3: ExecutePsiTransaction

        /// <summary>
        /// Performs the QuickFix, ensures the file is both writable and creates a transaction.
        /// </summary>
        /// <param name="solution">
        /// Current Solution.
        /// </param>
        /// <param name="progress">
        /// Progress Indicator for the fix.
        /// </param>
        /// <returns>
        /// The execute transaction.
        /// </returns>
        protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, JetBrains.Application.Progress.IProgressIndicator progress)
        {
            return delegate(ITextControl textControl)
                {
                    solution.GetComponent<DocumentManagerOperations>().SaveAllDocuments();

                    using (solution.GetComponent<DocumentTransactionManager>().CreateTransactionCookie(JetBrains.Util.DefaultAction.Commit, "action name"))
                    {
                        var services = solution.GetPsiServices();
                        services.Transactions.Execute(
                            "Code cleanup",
                            () => services.Locks.ExecuteWithWriteLock(() => { ExecuteTransactionInner(solution, textControl); }));
                    }
                };
        }
开发者ID:RainsSoft,项目名称:StyleCop,代码行数:27,代码来源:V5BulbItemImpl.cs

示例4: Accept

        public void Accept(
      ITextControl textControl, TextRange nameRange,
      LookupItemInsertType insertType, Suffix suffix,
      ISolution solution, bool keepCaretStill)
        {
            // find target expression after code completion
              var expressionRange = myExpressionRange.Range;

              if (myWasReparsed)
              {
            textControl.Document.ReplaceText(nameRange, "__");
            solution.GetPsiServices().CommitAllDocuments();
            nameRange = TextRange.FromLength(nameRange.StartOffset, 2);
              }

              var expression = (ICSharpExpression) FindMarkedNode(
            solution, textControl, expressionRange, nameRange, typeof(ICSharpExpression));

              if (expression == null)
              {
            // still can be parsed as IReferenceName
            var referenceName = (IReferenceName) FindMarkedNode(
              solution, textControl, expressionRange, nameRange, typeof(IReferenceName));

            if (referenceName == null) return;

            // reparse IReferenceName as ICSharpExpression
            var factory = CSharpElementFactory.GetInstance(referenceName.GetPsiModule(), false);
            expression = factory.CreateExpression(referenceName.GetText());
              }

              // take required component while tree is valid
              var psiModule = expression.GetPsiModule();

              var reference = FindMarkedNode(
            solution, textControl, myReferenceRange.Range, nameRange, myReferenceType);

              // Razor.{caret} case
              if (reference == expression && myWasReparsed)
              {
            var parentReference = reference.Parent as IReferenceExpression;
            if (parentReference != null && parentReference.NameIdentifier.Name == "__")
              reference = parentReference;
              }

              // calculate textual range to remove
              var replaceRange = CalculateRangeToRemove(nameRange, expression, reference);

              // fix "x > 0.if" to "x > 0"
              ICSharpExpression expressionCopy;
              if (reference != null && expression.Contains(reference))
              {
            expressionCopy = FixExpression(expression, reference);
              }
              else
              {
            expressionCopy = expression.IsPhysical() ? expression.Copy(expression) : expression;
              }

              Assertion.Assert(!expressionCopy.IsPhysical(), "expressionCopy is physical");

              ExpandPostfix(
            textControl, suffix, solution,
            replaceRange, psiModule, expressionCopy);
        }
开发者ID:Excelion,项目名称:PostfixCompletion,代码行数:65,代码来源:PostfixLookupItem.cs

示例5: GetPrimaryMembers

        private IEnumerable<NTriplesFileMemberData> GetPrimaryMembers(ISolution solution)
        {
            var cache = solution.GetComponent<NTriplesCache>();
            //var subjects = cache.GetImportantSubjects().ToArray();

            var symbolsByFile = cache.GetAllUriIdentifierSymbolsByFile();
            var services = solution.GetPsiServices();
            foreach (var symbols in symbolsByFile)
            {
                var file = symbols.Key;
                var sourceFile = file.GetPsiFile(NTriplesLanguage.Instance, new DocumentRange(file.Document, 0));
                foreach (var symbol in symbols.Value)
                {
                    var uriIdentifier = new UriIdentifierDeclaredElement(
                        sourceFile, symbol.Namespace, symbol.LocalName, symbol.Info, services, true);
                    yield return new NTriplesFileMemberData(uriIdentifier, ContainerDisplayStyle.NoContainer);
                }
            }
        }
开发者ID:xsburg,项目名称:ReSharper.NTriples,代码行数:19,代码来源:NTriplesGotoSymbolProvider.cs

示例6: NarrowSearchDomain

        private ISearchDomain NarrowSearchDomain(ISolution solution, IEnumerable<string> words, IEnumerable<string> extendedWords, ISearchDomain domain)
        {
            List<string> allWords = words.ToList();
            List<string> allExtendedWords = extendedWords.ToList();

            if (domain.IsEmpty || allWords.IsEmpty())
                return domain;
            IWordIndex wordIndex = solution.GetPsiServices().CacheManager.WordIndex;
            var jetHashSet1 = new JetHashSet<IPsiSourceFile>(wordIndex.GetFilesContainingWord(allWords.First()), null);
            foreach (string word in allWords.Skip(1))
                jetHashSet1.IntersectWith(wordIndex.GetFilesContainingWord(word));
            if (allExtendedWords.Any())
            {
                var jetHashSet2 = new JetHashSet<IPsiSourceFile>(null);
                using (JetHashSet<IPsiSourceFile>.ElementEnumerator enumerator = jetHashSet1.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        IPsiSourceFile file = enumerator.Current;
                        if (allExtendedWords.Any(word => wordIndex.CanContainWord(file, word)))
                            jetHashSet2.Add(file);
                    }
                }
                jetHashSet1 = jetHashSet2;
            }
            return domain.Intersect(searchDomainFactory.CreateSearchDomain(jetHashSet1));
        }
开发者ID:hotgazpacho,项目名称:AgentMulder,代码行数:27,代码来源:PatternSearcher.cs

示例7: FindType

        private static List<IClrDeclaredElement> FindType(ISolution solution, string typeToFind)
        {
            ISymbolScope declarationsCache = solution.GetPsiServices().Symbols
                .GetSymbolScope(LibrarySymbolScope.FULL, false);

            List<IClrDeclaredElement> results = declarationsCache.GetElementsByShortName(typeToFind).ToList();
            return results;
        }
开发者ID:hmemcpy,项目名称:ReSharper.Xao,代码行数:8,代码来源:ViewModelRelatedFilesProvider.cs

示例8: ExecutePsiTransaction

        /// <inheritdoc/>
        protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
        {
            return textControl =>
            {
                using (solution.GetComponent<DocumentTransactionManager>()
                    .CreateTransactionCookie(DefaultAction.Commit, "action name"))
                {
                    var services = solution.GetPsiServices();
                    services.Transactions.Execute(
                        "Code cleanup",
                        () => services.Locks.ExecuteWithWriteLock(() =>
                        {
                            ICSharpTypeAndNamespaceHolderDeclaration holder = _highlighting.TypeAndNamespaceHolder;

                            Fixes.FixOrder(holder, _highlighting.Config);
                            Fixes.FixSpacing(holder, _highlighting.Config);
                        }));
                }
            };
        }
开发者ID:DiomedesDominguez,项目名称:order-usings,代码行数:21,代码来源:UsingOrderAndSpacingQuickFix.cs


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