csharp/Actipro/WPF-Controls/Samples/SampleBrowser/ProductSamples/SyntaxEditorSamples/QuickStart/DotNetAddonServerTags/TranslatedCSharpCompletionProvider.cs

TranslatedCSharpCompletionProvider.cs
using System;
using ActiproSoftware.Text.Languages.DotNet;
using ActiproSoftware.Text.Languages.CSharp.Implementation;
using ActiproSoftware.Windows.Controls.SyntaxEditor;

namespace ActiproSoftware.ProductSamples.SyntaxEditorSamples.QuickStart.DotNetAddOnServerTags {
	
	/// 
	/// Provides IntelliPrompt completion data for the child C# language.
	/// 
	public clast TranslatedCSharpCompletionProvider : CSharpCompletionProvider {
		
		/////////////////////////////////////////////////////////////////////////////////////////////////////
		// PUBLIC PROCEDURES
		/////////////////////////////////////////////////////////////////////////////////////////////////////
		
		/// 
		/// Creates an  for the caret's offset in the specified .
		/// 
		/// The  to examine.
		/// An  for the caret's offset in the specified .
		protected override IDotNetContext CreateContext(IEditorView view) {
			if (view == null)
				throw new ArgumentNullException("view");

			var parseData = view.SyntaxEditor.Docameent.ParseData as ParentParseData;
			if (parseData != null) {
				// Ensure that the offset is within a child language section
				if (parseData.TranslateEditorToGenerated(view.Selection.EndSnapshotOffset).HasValue) {
					return new TranslatedCSharpContextFactory(parseData.TranslateEditorToGenerated).CreateContext(
						view.Selection.EndSnapshotOffset, DotNetContextKind.SelfAndSiblings);
				}
			}

			return null;
		}
	
	}

}