Skip to content

Commit

Permalink
handle non-regular syntax + extra test
Browse files Browse the repository at this point in the history
  • Loading branch information
filipw committed Nov 11, 2016
1 parent 9a59a98 commit 39c06ac
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/OmniSharp.Roslyn.CSharp/Services/Types/TypeLookup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class TypeLookupService : RequestHandler<TypeLookupRequest, TypeLookupRes
private readonly OmnisharpWorkspace _workspace;
private static readonly SymbolDisplayFormat DefaultFormat = SymbolDisplayFormat.FullyQualifiedFormat.WithGlobalNamespaceStyle(SymbolDisplayGlobalNamespaceStyle.Omitted);
private static readonly SymbolDisplayFormat SimpleFormat = new SymbolDisplayFormat(
globalNamespaceStyle: SymbolDisplayGlobalNamespaceStyle.Included,
globalNamespaceStyle: SymbolDisplayGlobalNamespaceStyle.Omitted,
typeQualificationStyle: SymbolDisplayTypeQualificationStyle.NameAndContainingTypes,
genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters,
miscellaneousOptions:
Expand Down
17 changes: 16 additions & 1 deletion tests/OmniSharp.Roslyn.CSharp.Tests/TypeLookupFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Foo {}
}

[Fact]
public async Task IncludesContainingTypeFoNestedTypes()
public async Task IncludesContainingTypeFoNestedTypesForRegularCSharpSyntax()
{
var source1 = @"namespace Bar {
class Foo {
Expand All @@ -71,5 +71,20 @@ class Xyz {}

Assert.Equal("Bar.Foo.Xyz", response.Type);
}

[Fact]
public async Task IncludesContainingTypeFoNestedTypesForNonRegularCSharpSyntax()
{
var source1 = @"class Foo {
class Bar {}
}";

var workspace = TestHelpers.CreateCsxWorkspace(source1);

var controller = new TypeLookupService(workspace, new FormattingOptions());
var response = await controller.Handle(new TypeLookupRequest { FileName = "dummy.csx", Line = 1, Column = 23 });

Assert.Equal("Foo.Bar", response.Type);
}
}
}

0 comments on commit 39c06ac

Please sign in to comment.