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


C# MonoDevelop.GetFormattingOptions方法代码示例

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


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

示例1: CompleteStatement

		public override void CompleteStatement (MonoDevelop.Ide.Gui.Document doc)
		{
			var fixer = new ConstructFixer (doc.GetFormattingOptions (), doc.Editor.CreateNRefactoryTextEditorOptions ());
			int newOffset;
			if (fixer.TryFix (doc.Editor.Document, doc.Editor.Caret.Offset, out newOffset)) {
				doc.Editor.Caret.Offset = newOffset;
			}
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:8,代码来源:CSharpCodeGenerator.cs

示例2: OutputNode

		static string OutputNode (MonoDevelop.Ide.Gui.Document doc, AstNode node)
		{
			using (var stringWriter = new System.IO.StringWriter ()) {
//				formatter.Indentation = indentLevel;
				var formatter = new TextWriterOutputFormatter (stringWriter);
				stringWriter.NewLine = doc.Editor.EolMarker;
				
				var visitor = new CSharpOutputVisitor (formatter, doc.GetFormattingOptions ());
				node.AcceptVisitor (visitor);
				return stringWriter.ToString ();
			}
		}
开发者ID:ConorMurph1991,项目名称:monodevelop,代码行数:12,代码来源:CSharpCodeGenerator.cs

示例3: CompleteStatement

		////		public override string CreateFieldEncapsulation (IUnresolvedTypeDefinition implementingType, IField field, string propertyName, Accessibility modifiers, bool readOnly)
		////		{
		////			SetIndentTo (implementingType);
		////			StringBuilder result = new StringBuilder ();
		////			AppendIndent (result);
		////			
		//////			if (modifiers != MonoDevelop.Projects.Dom.Modifiers.None) {
		//////				switch (modifiers) {
		//////				}
		//////				result.Append (ambience.GetString (modifiers));
		//////				result.Append (" ");
		//////			}
		////			var options = new CodeGenerationOptions () {
		////				ImplementingType = field.DeclaringTypeDefinition,
		////				Part = implementingType
		////			};
		////			result.Append ("public ");
		////			AppendReturnType (result, options, field.ReturnType);
		////			result.Append (" ");
		////			result.Append (propertyName);
		////			AppendBraceStart (result, Policy.PropertyBraceStyle);
		////			AppendIndent (result);
		////			
		////			result.Append ("get");
		////			AppendBraceStart (result, Policy.PropertyGetBraceStyle);
		////			AppendIndent (result);
		////			result.Append ("return this.");
		////			result.Append (CSharpAmbience.FilterName (field.Name));
		////			result.Append (";");
		////			AppendLine (result);
		////			AppendBraceEnd (result, Policy.PropertyGetBraceStyle);
		////			AppendLine (result);
		////
		////			if (!readOnly) {
		////				AppendIndent (result);
		////				result.Append ("set");
		////				AppendBraceStart (result, Policy.PropertyGetBraceStyle);
		////				AppendIndent (result);
		////				result.Append (CSharpAmbience.FilterName (field.Name));
		////				result.Append (" = value;");
		////				AppendLine (result);
		////				AppendBraceEnd (result, Policy.PropertyGetBraceStyle);
		////				AppendLine (result);
		////			}
		////			
		////			AppendBraceEnd (result, Policy.PropertyBraceStyle);
		////			return result.ToString ();
		////		}
		//		
		//		int CountBlankLines (IReadonlyTextDocument doc, int startLine)
		//		{
		//			int result = 0;
		//			IDocumentLine line;
		//			while ((line = doc.GetLine (startLine + result)) != null && doc.GetLineIndent (line).Length == line.Length) {
		//				result++;
		//			}
		//		
		//			return result;
		//		}
		//		
		//		static bool InsertUsingAfter (AstNode node)
		//		{
		//			return node is NewLineNode && IsCommentOrUsing (node.GetNextSibling (s => !(s is NewLineNode))) ||
		//				IsCommentOrUsing (node) || (node is PreProcessorDirective);
		//		}
		//
		//		static bool IsCommentOrUsing (AstNode node)
		//		{
		//			return node is ICSharpCode.NRefactory.CSharp.Comment ||
		//				node is UsingDeclaration ||
		//				node is UsingAliasDeclaration;
		//		}
		//		

		//		
		//		static string OutputNode (TextEditor editor, DocumentContext context, AstNode node)
		//		{
		//			using (var stringWriter = new System.IO.StringWriter ()) {
		////				formatter.Indentation = indentLevel;
		//				var formatter = new TextWriterTokenWriter (stringWriter);
		//				stringWriter.NewLine = editor.EolMarker;
		//
		//				var visitor = new CSharpOutputVisitor (formatter, null /* TODO: BROKEN DUE ROSLYN PORT (note: that code should be unused) */ );
		//				node.AcceptVisitor (visitor);
		//				return stringWriter.ToString ();
		//			}
		//		}
		//		
		//		
		//		public AstType CreateShortType (ICompilation compilation, CSharpUnresolvedFile parsedFile, TextLocation loc, IType fullType)
		//		{
		//			var csResolver = parsedFile.GetResolver (compilation, loc);
		//			var builder = new ICSharpCode.NRefactory.CSharp.Refactoring.TypeSystemAstBuilder (csResolver);
		//			return builder.ConvertType (fullType);			
		//		}
		//

		public override async void CompleteStatement (MonoDevelop.Ide.Gui.Document doc)
		{
			var fixer = new ConstructFixer (doc.GetFormattingOptions ());
//.........这里部分代码省略.........
开发者ID:sushihangover,项目名称:monodevelop,代码行数:101,代码来源:CSharpCodeGenerator.cs


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