• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# DocumentRange类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中DocumentRange的典型用法代码示例。如果您正苦于以下问题:C# DocumentRange类的具体用法?C# DocumentRange怎么用?C# DocumentRange使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DocumentRange类属于命名空间,在下文中一共展示了DocumentRange类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: PsiIntentionResult

 public PsiIntentionResult(List<ITemplateFieldHolder> holders, IDeclaration declaration, ITreeNode anchor, DocumentRange range)
 {
   myDeclaration = declaration;
   myHolders = holders;
   myPrefferedSelection = range;
   myAnchor = anchor;
 }
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:7,代码来源:PsiIntentionResult.cs


示例2: Actions

 /// <summary>
 /// Returns a WhyBulb for the given highlighting.
 /// </summary>
 /// <param name="highlighting">Highlighting to process.</param>
 /// <param name="highlightingRange">Hihglighting range - not used here.</param>
 /// <returns></returns>
 public ICollection<IDisableHighlightingAction> Actions(IHighlighting highlighting, DocumentRange highlightingRange)
 {
     var cSharpHighlighting = highlighting as CSharpHighlightingBase;
     return (cSharpHighlighting == null)
                ? EmptyArray<IDisableHighlightingAction>.Instance
                : new IDisableHighlightingAction[] { new WhyBulb(highlighting.ErrorStripeToolTip, highlighting.GetType().Name) };
 }
开发者ID:dbremner,项目名称:whysharper,代码行数:13,代码来源:SuggestionProvider.cs


示例3: GetHighlight

        /// <summary>
        /// Gets the highlight for the specified StyleCop Violation.
        /// </summary>
        /// <param name="violation">
        /// The <see cref="StyleCop.ViolationEventArgs"/> instance containing the event data.
        /// </param>
        /// <param name="documentRange">
        /// <see cref="DocumentRange"/>where the Violation happened.
        /// </param>
        /// <param name="fileName">
        /// <see cref="CsElement"/>of the violation.
        /// </param>
        /// <param name="lineNumber">
        /// Line number where the violation happened.
        /// </param>
        /// <returns>
        /// An <see cref="IHighlighting"/> for the specified Violation.
        /// </returns>
        public static IHighlighting GetHighlight(ViolationEventArgs violation, DocumentRange documentRange, string fileName, int lineNumber)
        {
            string ruleID = violation.Violation.Rule.CheckId;
            string highlightID = HighlightingRegistering.GetHighlightID(ruleID);

            VSSolutionManager solutionManager = Shell.Instance.GetComponent<VSSolutionManager>();

            IContextBoundSettingsStore settingsStore = PsiSourceFileExtensions.GetSettingsStore(null, solutionManager.CurrentSolution);

            Severity severity = HighlightingSettingsManager.Instance.GetConfigurableSeverity(highlightID, settingsStore);

            switch (severity)
            {
                case Severity.ERROR:
                    return new StyleCopHighlightingError(violation, documentRange, fileName, lineNumber);
                case Severity.HINT:
                    return new StyleCopHighlightingHint(violation, documentRange, fileName, lineNumber);
                case Severity.INFO:
                    return new StyleCopHighlightingError(violation, documentRange, fileName, lineNumber);
                case Severity.SUGGESTION:
                    return new StyleCopHighlightingSuggestion(violation, documentRange, fileName, lineNumber);
                case Severity.WARNING:
                    return new StyleCopHighlightingWarning(violation, documentRange, fileName, lineNumber);
                default:
                    return new StyleCopHighlightingDoNotShow(violation, documentRange, fileName, lineNumber);
            }
        }
开发者ID:transformersprimeabcxyz,项目名称:_TO-FIRST-stylecop,代码行数:45,代码来源:StyleCopHighlightingFactory.cs


示例4: AttributeParamImpl

 public AttributeParamImpl(IXmlAttribute xmlAttribute,IParameterDescriptorProvider parameterDescriptorProvider)
 {
     name = xmlAttribute.AttributeName;
     nameDocumentRange = xmlAttribute.ToTreeNode().NameNode.GetDocumentRange();
     stringValue = xmlAttribute.UnquotedValue;
     this.parameterDescriptorProvider = parameterDescriptorProvider;
 }
开发者ID:willrawls,项目名称:arp,代码行数:7,代码来源:AttributeParamImpl.cs


示例5: FixExpressionToStatement

        public static ICSharpStatement FixExpressionToStatement(DocumentRange expressionRange,
                                                            [NotNull] IPsiServices psiServices)
        {
            var solution = psiServices.Solution;
              var offset = expressionRange.TextRange.StartOffset;
              var document = expressionRange.Document;

              var expressions = TextControlToPsi.GetElements<IRazorImplicitExpression>(solution, document, offset);
              foreach (var razorExpression in expressions)
              {
            var razorRange = razorExpression.GetDocumentRange();

            const string commandName = "Replacing razor expression with statement";
            using (solution.CreateTransactionCookie(
              DefaultAction.Commit, commandName, NullProgressIndicator.Instance))
            {
              razorRange.Document.ReplaceText(razorRange.TextRange, "@using(null){}");
            }

            solution.GetPsiServices().CommitAllDocuments();

            var statements = TextControlToPsi.GetElements<IUsingStatement>(solution, document, offset);
            foreach (var razorStatement in statements)
            {
              return razorStatement;
            }

            break;
              }

              return null;
        }
开发者ID:Nangal,项目名称:resharper-postfix,代码行数:32,代码来源:RazorUtil.cs


示例6: GetHighlight

        /// <summary>
        /// Gets the highlight for the specified StyleCop Violation.
        /// </summary>
        /// <param name="violation">
        /// The <see cref="StyleCop.ViolationEventArgs"/> instance containing the event data.
        /// </param>
        /// <param name="documentRange">
        /// <see cref="DocumentRange"/>where the Violation happened.
        /// </param>
        /// <param name="fileName">
        /// <see cref="CsElement"/>of the violation.
        /// </param>
        /// <param name="lineNumber">
        /// Line number where the violation happened.
        /// </param>
        /// <returns>
        /// An <see cref="IHighlighting"/> for the specified Violation.
        /// </returns>
        public static IHighlighting GetHighlight(ViolationEventArgs violation, DocumentRange documentRange, string fileName, int lineNumber)
        {
            string ruleID = violation.Violation.Rule.CheckId;
            string highlightID = HighlightingRegistering.GetHighlightID(ruleID);

            // To get the correct severity for a highlight we need to specify the current solution.
            ISolutionManager solutionManager = Shell.Instance.GetComponent<ISolutionManager>();
            Severity severity = HighlightingSettingsManager.Instance.GetConfigurableSeverity(highlightID, solutionManager.CurrentSolution);

            switch (severity)
            {
                case Severity.ERROR:
                    return new StyleCopViolationError(violation, documentRange, fileName, lineNumber);
                case Severity.HINT:
                    return new StyleCopViolationHint(violation, documentRange, fileName, lineNumber);
                case Severity.INFO:
                    return new StyleCopViolationError(violation, documentRange, fileName, lineNumber);
                case Severity.SUGGESTION:
                    return new StyleCopViolationSuggestion(violation, documentRange, fileName, lineNumber);
                case Severity.WARNING:
                    return new StyleCopViolationWarning(violation, documentRange, fileName, lineNumber);
                default:
                    return new StyleCopViolationDoNotShow(violation, documentRange, fileName, lineNumber);
            }
        }
开发者ID:transformersprimeabcxyz,项目名称:_TO-FIRST-stylecop,代码行数:43,代码来源:StyleCopViolationFactory.cs


示例7: GetSelectedRange

		public ISelectedRange GetSelectedRange(IPsiSourceFile sourceFile, DocumentRange documentRange) {
			Pair<IT4File, IFile> pair = GetFiles(sourceFile, documentRange);
			IT4File t4File = pair.First;
			IFile codeBehindFile = pair.Second;

			if (t4File == null)
				return null;

			ITreeNode t4Node = t4File.FindNodeAt(documentRange);
			if (t4Node == null)
				return null;

			// if the current selection is inside C# code, use the C# extend selection directly
			if (codeBehindFile != null) {
				ISelectEmbracingConstructProvider codeBehindProvider = PsiShared.GetComponent<PsiProjectFileTypeCoordinator>()
					.GetByPrimaryPsiLanguageType(codeBehindFile.Language)
					.SelectNotNull(fileType => Shell.Instance.GetComponent<IProjectFileTypeServices>().TryGetService<ISelectEmbracingConstructProvider>(fileType))
					.FirstOrDefault();

				if (codeBehindProvider != null) {
					ISelectedRange codeBehindRange = codeBehindProvider.GetSelectedRange(sourceFile, documentRange);
					if (codeBehindRange != null)
						return new T4CodeBehindWrappedSelection(t4File, codeBehindRange);
				}
			}

			return new T4NodeSelection(t4File, t4Node);
		}
开发者ID:mnaoumov,项目名称:ForTea,代码行数:28,代码来源:T4SelectEmbracingConstructProvider.cs


示例8: SuggestionBase

 /// <summary>Initializes a new instance of the <see cref="SuggestionBase"/> class.</summary>
 /// <param name="suggestionName">Name of the suggestion.</param>
 /// <param name="element">The element.</param>
 /// <param name="highlightingRange">The highlighting range.</param>
 /// <param name="toolTip">The tool tip.</param>
 protected SuggestionBase(string suggestionName, IElement element, DocumentRange highlightingRange, string toolTip)
 {
     this.range = highlightingRange;
       this.toolTip = toolTip;
       this.element = element;
       this.suggestionName = suggestionName;
 }
开发者ID:jamiebriant,项目名称:agentjohnson,代码行数:12,代码来源:SuggestionBase.cs


示例9: CreateMissedParameterFix

        public CreateMissedParameterFix(MissedParameterError missedParameterError)
        {
            if (missedParameterError == null)
                throw new ArgumentNullException("missedParameterError");

            this.missedParameterError = missedParameterError;
            headerNameRange = ((IXmlTag) missedParameterError.Element).ToTreeNode().Header.Name.GetDocumentRange();
        }
开发者ID:willrawls,项目名称:arp,代码行数:8,代码来源:CreateMissedParameterFix.cs


示例10: StyleCopHighlightingBase

 /// <summary>
 /// Initializes a new instance of the <see cref="StyleCopHighlightingBase"/> class.
 /// </summary>
 /// <param name="violationEventArgs">
 /// The <see cref="StyleCop.ViolationEventArgs"/> instance containing the Violation data.
 /// </param>
 /// <param name="documentRange">
 /// Range where the Violation happened.
 /// </param>
 protected StyleCopHighlightingBase(ViolationEventArgs violationEventArgs, DocumentRange documentRange)
 {
     this.CheckId = violationEventArgs.Violation.Rule.CheckId;
     this.ToolTip = violationEventArgs.Message + " [StyleCop Rule: " + this.CheckId + "]";
     this.documentRange = documentRange;
     this.Rule = violationEventArgs.Violation.Rule;
     this.Violation = violationEventArgs.Violation;
 }
开发者ID:RainsSoft,项目名称:StyleCop,代码行数:17,代码来源:StyleCopHighlightingBase.cs


示例11: NTriplesIntentionResult

 public NTriplesIntentionResult(
     List<ITemplateFieldHolder> holders, IDeclaration declaration, ITreeNode anchor, DocumentRange range)
 {
     this.myDeclaration = declaration;
     this.myHolders = holders;
     this.myPreferredSelection = range;
     this.myAnchor = anchor;
 }
开发者ID:xsburg,项目名称:ReSharper.NTriples,代码行数:8,代码来源:NTriplesIntentionResult.cs


示例12: ExecutePsiTransaction

 protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
 {
     var methodDeclaration = _highlighting.MethodDeclaration;
     methodDeclaration.SetExtern(false);
     var textRange = LanguageManager.Instance.GetService<IMemberBodyOperations>(methodDeclaration.Language).SetBodyToDefault(methodDeclaration);
     var rangeMarker = new DocumentRange(methodDeclaration.GetDocumentRange().Document, textRange).CreateRangeMarker(DocumentManager.GetInstance(solution));
     return control => control.Selection.SetRange(rangeMarker.Range);
 }
开发者ID:vcsjones,项目名称:ResharperInteropHelpers,代码行数:8,代码来源:DllImportMissingRemoveExternQuickFix.cs


示例13: Block

 /// <summary>
 /// 
 /// </summary>
 /// <param name="startLineNumber">Indexed from 1</param>
 /// <param name="endLineNumber">Indexed from 1</param>
 /// <param name="projectFile"></param>
 /// <param name="set"></param>
 /// <param name="range"></param>
 public Block(int startLineNumber, int endLineNumber, IProjectFile projectFile, Set set, DocumentRange? range)
 {
     Range = range;
     this.set = set;
     this.projectFile = projectFile;
     this.startLineNumber = startLineNumber;
     this.endLineNumber = endLineNumber;
 }
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:16,代码来源:Block.cs


示例14: AddHighLighting

 private void AddHighLighting(DocumentRange range, ITreeNode element, IHighlightingConsumer consumer, IHighlighting highlighting)
 {
   var info = new HighlightingInfo(range, highlighting, new Severity?());
   IFile file = element.GetContainingFile();
   if (file != null)
   {
     consumer.AddHighlighting(info.Highlighting, file);
   }
 }
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:9,代码来源:IdentifierHighlighterProcess.cs


示例15: StyleCopViolationBase

 /// <summary>
 /// Initializes a new instance of the <see cref="StyleCopViolationBase"/> class.
 /// </summary>
 /// <param name="violation">
 /// The <see cref="StyleCop.ViolationEventArgs"/> instance containing the Violation data.
 /// </param>
 /// <param name="documentRange">
 /// Range where the Violation happened.
 /// </param>
 /// <param name="fileName">
 /// The file Name.
 /// </param>
 /// <param name="lineNumber">
 /// Line number of where the violation happened.
 /// </param>
 protected StyleCopViolationBase(ViolationEventArgs violation, DocumentRange documentRange, string fileName, int lineNumber)
 {
     this.CheckId = violation.Violation.Rule.CheckId;
     this.ToolTip = violation.Message + " [StyleCop Rule: " + this.CheckId + "]";
     this.DocumentRange = documentRange;
     this.FileName = fileName;
     this.LineNumber = lineNumber;
     this.Rule = violation.Violation.Rule;
 }
开发者ID:transformersprimeabcxyz,项目名称:_TO-FIRST-stylecop,代码行数:24,代码来源:StyleCopViolationBase.cs


示例16: Execute

        public void Execute(Action<DaemonStageResult> commiter)
        {
            try
            {
                // GetText gives the unsaved file contents, unlike file.ProjectFile.GetReadStream().
                string codeText = myDaemonProcess.Document.GetText();

            // I do not remember anymore why I created the Shallow version...
                var cloneFinder = new MethodsOnASingleClassCloneFinder(new ShallowExpansionFactory());
                //var cloneFinder = new MethodsOnASingleClassCloneFinder(new OscillatingExtractMethodExpansionFactory());

                cloneFinder.AddRefactoring(new LiteralToParameterExpansion());

                ScanResult scan_result = cloneFinder.GetCloneReplacements(codeText);
                if (scan_result != null)
                {
                    var document = myDaemonProcess.SourceFile.Document;

                    var Highlightings = new List<HighlightingInfo>();

                    foreach (var info in scan_result.Clones)
                    {
                        // We basically highlight the first line of the clone.
                        var start = document.GetLineStartOffset(((Int32<DocLine>) (info.HighlightStartLocationLine - 1))) + info.HighlightStartLocationColumn;
                        var end = start + info.HighlightLength;// Hmm, HighlightLength seems sort of arbitrary.
                        var warningHighlightRange = new DocumentRange(document, new TextRange(start, end));

                        // And this defines the chunk that gets replaced.
                        var replacedCodeRange = new DocumentRange(document,
                                                                  new TextRange(
                                                                      document.GetLineStartOffset(
                                                                          (Int32<DocLine>)
                                                                          (info.ReplacementSectionStartLine-1)),
                                                                      document.GetLineStartOffset(
                                                                          (Int32<DocLine>)
                                                                          info.ReplacementSectionEndLine)));

                        var highlight = new HighlightingInfo(warningHighlightRange,
                                                             new CloneDetectionHighlighting(info, replacedCodeRange));
                        Highlightings.Add(highlight);
                    }

                    // Creating container to put highlightings into.
                    DaemonStageResult ret = new DaemonStageResult(Highlightings);

                    commiter(ret);
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.Write(e);
                throw;
            }
        }
开发者ID:jbuedel,项目名称:AgentRalphPlugin,代码行数:54,代码来源:CloneDetectionDaemonStageProcess.cs


示例17: GetFooterTagRange

        public static DocumentRange GetFooterTagRange(IElement element, DocumentRange range)
        {
            IXmlTag tag = element as IXmlTag;
            if (tag == null)
                return DocumentRange.InvalidRange;
            if (tag.ToTreeNode().Header.Name.GetDocumentRange().TextRange == range.TextRange)
            {
                IXmlTagFooterNode footer = tag.ToTreeNode().Footer;
                if (footer != null)
                    return footer.Name.GetDocumentRange();
            }

            return DocumentRange.InvalidRange;
        }
开发者ID:willrawls,项目名称:arp,代码行数:14,代码来源:XMLPSIUtils.cs


示例18: UnityColorReference

        public UnityColorReference(IColorElement colorElement, IExpression owningExpression, ITreeNode owner,
            DocumentRange colorConstantRange)
        {
            myOwningExpression = owningExpression;
            ColorElement = colorElement;
            Owner = owner;
            ColorConstantRange = colorConstantRange;

            BindOptions = new ColorBindOptions
            {
                BindsToName = true,
                BindsToValue = true
            };
        }
开发者ID:JetBrains,项目名称:resharper-unity,代码行数:14,代码来源:UnityColorReference.cs


示例19: GetFiles

		private static Pair<IT4File, IFile> GetFiles([NotNull] IPsiSourceFile sourceFile, DocumentRange documentRange) {
			IT4File primaryFile = null;
			IFile secondaryFile = null;

			foreach (Pair<IFile, TreeTextRange> pair in sourceFile.EnumerateIntersectingPsiFiles(documentRange)) {
				var t4File = pair.First as IT4File;
				if (t4File != null)
					primaryFile = t4File;
				else
					secondaryFile = pair.First;
			}

			return Pair.Of(primaryFile, secondaryFile);
		}
开发者ID:mnaoumov,项目名称:ForTea,代码行数:14,代码来源:T4SelectEmbracingConstructProvider.cs


示例20: GetFiles

        private static Pair<IT4File, IFile> GetFiles([NotNull] IPsiSourceFile sourceFile, DocumentRange documentRange)
        {
            IT4File primaryFile = null;
            IFile secondaryFile = null;

            foreach (IFile file in sourceFile.EnumeratePsiFiles(documentRange)) {
                var t4File = file as IT4File;
                if (t4File != null)
                    primaryFile = t4File;
                else
                    secondaryFile = file;
            }

            return Pair.Of(primaryFile, secondaryFile);
        }
开发者ID:sscctech,项目名称:ForTea,代码行数:15,代码来源:T4SelectEmbracingConstructProvider.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DocumentRegion类代码示例发布时间:2022-05-24
下一篇:
C# DocumentObject类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap