Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Commit

Permalink
[Completion] Fixed bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Krüger committed Oct 9, 2012
1 parent e6051de commit c48fe90
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2410,7 +2410,9 @@ out trr
}
if (member is IType) {
if (resolveResult is TypeResolveResult || includeStaticMembers) {
result.AddType ((IType)member, false);
if (!lookup.IsAccessible(member, isProtectedAllowed))
continue;
result.AddType((IType)member, false);
continue;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,13 @@ public IEnumerable<ICompletionData> CreatePreProcessorDefinesCompletionData ()
loader.IncludeInternalMembers = true;
return loader.LoadAssemblyFile(typeof(System.ComponentModel.BrowsableAttribute).Assembly.Location);
});
static readonly Lazy<IUnresolvedAssembly> systemXmlLinq = new Lazy<IUnresolvedAssembly>(
delegate {
var loader = new CecilLoader();
loader.IncludeInternalMembers = true;
return loader.LoadAssemblyFile(typeof(System.Xml.Linq.XElement).Assembly.Location);
});


static readonly Lazy<IUnresolvedAssembly> mscorlib = new Lazy<IUnresolvedAssembly>(
delegate {
Expand Down Expand Up @@ -259,7 +266,7 @@ public static CSharpCompletionEngine CreateEngine(string text, out int cursorPos
var doc = new ReadOnlyDocument(editorText);

IProjectContent pctx = new CSharpProjectContent();
var refs = new List<IUnresolvedAssembly> { mscorlib.Value, systemCore.Value, systemAssembly.Value };
var refs = new List<IUnresolvedAssembly> { mscorlib.Value, systemCore.Value, systemAssembly.Value, systemXmlLinq.Value };
if (references != null)
refs.AddRange (references);

Expand Down Expand Up @@ -313,7 +320,7 @@ Tuple<ReadOnlyDocument, CSharpCompletionEngine> GetContent(string text, SyntaxTr
{
var doc = new ReadOnlyDocument(text);
IProjectContent pctx = new CSharpProjectContent();
pctx = pctx.AddAssemblyReferences(new [] { CecilLoaderTests.Mscorlib, CecilLoaderTests.SystemCore });
pctx = pctx.AddAssemblyReferences(new [] { mscorlib.Value, systemAssembly.Value, systemCore.Value, systemXmlLinq.Value });
var unresolvedFile = syntaxTree.ToTypeSystem();

pctx = pctx.AddOrUpdateFiles(unresolvedFile);
Expand Down Expand Up @@ -5634,5 +5641,36 @@ void Bar()
Assert.IsNull(provider.Find("InternalStringComparer"));
});
}

/// <summary>
/// Bug 6237 - Code completion includes private code
/// </summary>
[Test()]
public void TestBug6237 ()
{

CombinedProviderTest(
@"
namespace bug
{
public class TestClass
{
void Bar()
{
$System.Xml.Linq.XElement.$
}
}
}
", provider => {
Assert.IsTrue (provider.Count > 0);
// it's likely to be mono specific.
foreach (var data in provider.Data) {
Assert.IsFalse (data.DisplayText.StartsWith ("<"), "Data was:"+ data.DisplayText);
}
});
}


}
}

0 comments on commit c48fe90

Please sign in to comment.