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


C# Mono.OffsetToLocation方法代码示例

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


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

示例1: AddToLine

        public void AddToLine(Mono.TextEditor.Document doc)
        {
            if (Line != null) {

                DocumentLocation dl = doc.OffsetToLocation(marker.StartCol);
                marker.StartCol = dl.Column;

                dl = doc.OffsetToLocation(marker.EndCol);
                marker.EndCol = dl.Column;

                doc.AddMarker (Line, marker);
            }
        }
开发者ID:moscrif,项目名称:ide,代码行数:13,代码来源:HoverMarker.cs

示例2: GetItem

		public TooltipItem GetItem (Mono.TextEditor.TextEditor editor, int offset)
		{
			var doc = IdeApp.Workbench.ActiveDocument;
			if (doc == null || doc.ParsedDocument == null)
				return null;
			var unit = doc.ParsedDocument.GetAst<CompilationUnit> ();
			if (unit == null)
				return null;

			var file = doc.ParsedDocument.ParsedFile as CSharpParsedFile;
			if (file == null)
				return null;
			
			ResolveResult result;
			AstNode node;
			var loc = editor.OffsetToLocation (offset);
			if (!doc.TryResolveAt (loc, out result, out node))
				return null;
			var resolver = new CSharpAstResolver (doc.Compilation, unit, file);
			resolver.ApplyNavigator (new NodeListResolveVisitorNavigator (node), CancellationToken.None);

			int startOffset = offset;
			int endOffset = offset;
			return new TooltipItem (new ToolTipData (unit, result, node, resolver), startOffset, endOffset - startOffset);
		}
开发者ID:head-thrash,项目名称:monodevelop,代码行数:25,代码来源:LanguageItemTooltipProvider.cs

示例3: GetExpression

		public string GetExpression (Mono.TextEditor.TextEditorData data, int offset)
		{
			if (offset < 0)
				return "";
			var doc = IdeApp.Workbench.ActiveDocument;
			if (doc == null)
				return "";
			var loc = RefactoringService.GetCorrectResolveLocation (doc, data.OffsetToLocation (offset));
			var unit       = doc.ParsedDocument.GetAst<CompilationUnit> ();
			var parsedFile = doc.ParsedDocument.ParsedFile as CSharpParsedFile;
			var node       = unit.GetNodeAt<Expression> (loc.Line, loc.Column);
			if (unit == null || parsedFile == null || node == null)
				return "";
			
			return data.GetTextBetween (node.StartLocation, node.EndLocation);
		}
开发者ID:vac0,项目名称:monodevelop,代码行数:16,代码来源:TextEditorResolverProvider.cs

示例4: SearchMember

		IEnumerable<MemberReference> SearchMember (INode member, ProjectDom dom, FilePath fileName, Mono.TextEditor.TextEditorData editor, Mono.TextEditor.Document buildDocument, List<LocalDocumentInfo.OffsetInfo> offsetInfos, ParsedDocument parsedDocument)
		{
			var resolver = new NRefactoryResolver (dom, parsedDocument.CompilationUnit, ICSharpCode.NRefactory.SupportedLanguage.CSharp, editor, fileName);
			
			FindMemberAstVisitor visitor = new FindMemberAstVisitor (buildDocument, member);
			visitor.IncludeXmlDocumentation = IncludeDocumentation;
			visitor.RunVisitor (resolver);
			
			foreach (var result in visitor.FoundReferences) {
				var offsetInfo = offsetInfos.FirstOrDefault (info => info.ToOffset <= result.Position && result.Position < info.ToOffset + info.Length);
				if (offsetInfo == null)
					continue;
				var offset = offsetInfo.FromOffset + result.Position - offsetInfo.ToOffset;
				var loc = editor.OffsetToLocation (offset);
				yield return new MemberReference (null, fileName, offset, loc.Line, loc.Column, result.Name, null);
			}
		}
开发者ID:raufbutt,项目名称:monodevelop-old,代码行数:17,代码来源:ASPNetReferenceFinder.cs

示例5: GetItem

		public override TooltipItem GetItem (Mono.TextEditor.TextEditor editor, int offset)
		{
			var doc = IdeApp.Workbench.ActiveDocument;
			if (doc == null || doc.ParsedDocument == null)
				return null;
			var unit = doc.ParsedDocument.GetAst<SyntaxTree> ();
			if (unit == null)
				return null;

			var file = doc.ParsedDocument.ParsedFile as CSharpUnresolvedFile;
			if (file == null)
				return null;
			
			ResolveResult result;
			AstNode node;
			var loc = editor.OffsetToLocation (offset);
			if (!doc.TryResolveAt (loc, out result, out node)) {
				if (node is CSharpTokenNode) {
					int startOffset2 = editor.LocationToOffset (node.StartLocation);
					int endOffset2 = editor.LocationToOffset (node.EndLocation);

					return new TooltipItem (new ToolTipData (unit, result, node, null), startOffset2, endOffset2 - startOffset2);
				}
				return null;
			}
			if (node == lastNode)
				return lastResult;
			var resolver = new CSharpAstResolver (doc.Compilation, unit, file);
			resolver.ApplyNavigator (new NodeListResolveVisitorNavigator (node), CancellationToken.None);

			var hoverNode = node.GetNodeAt (loc) ?? node;

			int startOffset = editor.LocationToOffset (hoverNode.StartLocation);
			int endOffset = editor.LocationToOffset (hoverNode.EndLocation);
			return lastResult = new TooltipItem (new ToolTipData (unit, result, node, resolver), startOffset, endOffset - startOffset);
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:36,代码来源:LanguageItemTooltipProvider.cs


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