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


C# ITextEditor.ToEditorOptions方法代码示例

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


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

示例1: Format

		/// <summary>
		/// Formats the specified part of the document.
		/// </summary>
		public static void Format(ITextEditor editor, int offset, int length, CSharpFormattingOptions options)
		{
			var formatter = new CSharpFormatter(options, editor.ToEditorOptions());
			formatter.AddFormattingRegion(new DomRegion(editor.Document.GetLocation(offset), editor.Document.GetLocation(offset + length)));
			var changes = formatter.AnalyzeFormatting(editor.Document, SyntaxTree.Parse(editor.Document));
			changes.ApplyChanges(offset, length);
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:10,代码来源:CSharpFormatter.cs

示例2: Format

		/// <summary>
		/// Formats the specified part of the document.
		/// </summary>
		public static void Format(ITextEditor editor, int offset, int length, CSharpFormattingOptionsContainer optionsContainer)
		{
			TextEditorOptions editorOptions = editor.ToEditorOptions();
			optionsContainer.CustomizeEditorOptions(editorOptions);
			var formatter = new CSharpFormatter(optionsContainer.GetEffectiveOptions(), editorOptions);
			formatter.AddFormattingRegion(new DomRegion(editor.Document.GetLocation(offset), editor.Document.GetLocation(offset + length)));
			var changes = formatter.AnalyzeFormatting(editor.Document, SyntaxTree.Parse(editor.Document));
			changes.ApplyChanges(offset, length);
		}
开发者ID:dgrunwald,项目名称:SharpDevelop,代码行数:12,代码来源:CSharpFormatter.cs

示例3: IndentLines

		public override void IndentLines(ITextEditor editor, int beginLine, int endLine)
		{
			var document = editor.Document;
			var engine = CreateIndentEngine(document, editor.ToEditorOptions());
			int currentLine = beginLine;
			do {
				var line = document.GetLineByNumber(currentLine);
				IndentSingleLine(engine, document, line);
			} while (++currentLine <= endLine);
		}
开发者ID:krunalc,项目名称:SharpDevelop,代码行数:10,代码来源:CSharpFormattingStrategy.cs

示例4: Format

		/// <summary>
		/// Formats the specified part of the document.
		/// </summary>
		public static void Format(ITextEditor editor, int offset, int length, CSharpFormattingOptionsContainer optionsContainer)
		{
			SyntaxTree syntaxTree = SyntaxTree.Parse(editor.Document);
			if (syntaxTree.Errors.Count > 0) {
				// Don't format files containing syntax errors!
				return;
			}
			
			TextEditorOptions editorOptions = editor.ToEditorOptions();
			optionsContainer.CustomizeEditorOptions(editorOptions);
			var formatter = new CSharpFormatter(optionsContainer.GetEffectiveOptions(), editorOptions);
			formatter.AddFormattingRegion(new DomRegion(editor.Document.GetLocation(offset), editor.Document.GetLocation(offset + length)));
			var changes = formatter.AnalyzeFormatting(editor.Document, syntaxTree);
			changes.ApplyChanges(offset, length);
		}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:18,代码来源:CSharpFormatter.cs

示例5: IndentLine

		public override void IndentLine(ITextEditor editor, IDocumentLine line)
		{
			var document = editor.Document;
			var engine = CreateIndentEngine(document, editor.ToEditorOptions());
			IndentSingleLine(engine, document, line);
		}
开发者ID:krunalc,项目名称:SharpDevelop,代码行数:6,代码来源:CSharpFormattingStrategy.cs

示例6: SDRefactoringContext

		public SDRefactoringContext(ITextEditor editor, CSharpAstResolver resolver, TextLocation location, CancellationToken cancellationToken = default(CancellationToken))
			: base(resolver, cancellationToken)
		{
			this.resolver = resolver;
			this.editor = editor;
			this.textSource = editor.Document;
			this.document = editor.Document;
			this.selectionStart = editor.SelectionStart;
			this.selectionLength = editor.SelectionLength;
			this.location = location;
			this.editorOptions = editor.ToEditorOptions();
			InitializeServices();
		}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:13,代码来源:SDRefactoringContext.cs


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