3rdparty/NRefactory/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs
/// <summary>
/// Gets the types that needs to be imported via using or full type name.
/// </summary>
Gets the types that needs to be imported via using or full type name.
Gets the types that needs to be imported via using or full type name .
public IEnumerable<ICompletionData> GetImportCompletionData(int offset)
		{
			var generalLookup = new MemberLookup(null, Compilation.MainAssembly);
			SetOffset(offset);
			var namespaces = new List<INamespace>();
			for (var n = ctx.CurrentUsingScope; n != null; n = n.Parent) {
				namespaces.Add(n.Namespace);
				foreach (var u in n.Usings)
					namespaces.Add(u);
			}
			foreach (var type in Compilation.GetAllTypeDefinitions ()) {
				if (!generalLookup.IsAccessible(type, false))
					continue;	
				if (namespaces.Any(n => n.FullName == type.Namespace))
					continue;
				bool useFullName = false;
				foreach (var ns in namespaces) {
					if (ns.GetTypeDefinition(type.Name, type.TypeParameterCount) != null) {
						useFullName = true;
						break;
					}
				}
				yield return factory.CreateImportCompletionData(type, useFullName, false);
			}
		}
public IEnumerable < ICompletionData > GetImportCompletionData ( int offset ) { var generalLookup = new MemberLookup ( null , Compilation . MainAssembly ) ; SetOffset ( offset ) ; var namespaces = new List < INamespace > ( ) ; for ( var n = ctx . CurrentUsingScope ; n != null ; n = n . Parent ) { namespaces . Add ( n . Namespace ) ; foreach ( var u in n . Usings ) namespaces . Add ( u ) ; } foreach ( var type in Compilation . GetAllTypeDefinitions ( ) ) { if ( ! generalLookup . IsAccessible ( type , false ) ) continue ; if ( namespaces . Any ( n => n . FullName == type . Namespace ) ) continue ; bool useFullName = false ; foreach ( var ns in namespaces ) { if ( ns . GetTypeDefinition ( type . Name , type . TypeParameterCount ) != null ) { useFullName = true ; break ; } } yield return factory . CreateImportCompletionData ( type , useFullName , false ) ; } }
Gets the types that needs to be imported via using or full type name.
Gets the types that needs to be imported via using or full type name .
// flatten usings
offset
int