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


C# DocumentRange类代码示例

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


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


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