Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Break types into their own files. #18442

Merged
merged 1 commit into from
Apr 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
207 changes: 0 additions & 207 deletions src/Features/Core/Portable/AddImport/SearchScope.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.FindSymbols;

namespace Microsoft.CodeAnalysis.CodeFixes.AddImport
{
internal abstract partial class AbstractAddImportCodeFixProvider<TSimpleNameSyntax>
{
/// <summary>
/// SearchScope used for searching *all* the symbols contained within a project/compilation.
/// i.e. the symbols created from source *and* symbols from references (both project and
/// metadata).
/// </summary>
private class AllSymbolsProjectSearchScope : ProjectSearchScope
{
public AllSymbolsProjectSearchScope(
AbstractAddImportCodeFixProvider<TSimpleNameSyntax> provider,
Project project,
bool exact,
CancellationToken cancellationToken)
: base(provider, project, exact, cancellationToken)
{
}

protected override Task<ImmutableArray<ISymbol>> FindDeclarationsAsync(
string name, SymbolFilter filter, SearchQuery searchQuery)
{
return SymbolFinder.FindDeclarationsAsync(_project, searchQuery, filter, CancellationToken);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.FindSymbols;
using Microsoft.CodeAnalysis.FindSymbols.SymbolTree;

namespace Microsoft.CodeAnalysis.CodeFixes.AddImport
{
internal abstract partial class AbstractAddImportCodeFixProvider<TSimpleNameSyntax>
{
private class MetadataSymbolsSearchScope : SearchScope
{
private readonly IAssemblySymbol _assembly;
private readonly PortableExecutableReference _metadataReference;
private readonly Solution _solution;

public MetadataSymbolsSearchScope(
AbstractAddImportCodeFixProvider<TSimpleNameSyntax> provider,
Solution solution,
IAssemblySymbol assembly,
PortableExecutableReference metadataReference,
bool exact,
CancellationToken cancellationToken)
: base(provider, exact, cancellationToken)
{
_solution = solution;
_assembly = assembly;
_metadataReference = metadataReference;
}

public override SymbolReference CreateReference<T>(SymbolResult<T> searchResult)
{
return new MetadataSymbolReference(
provider,
searchResult.WithSymbol<INamespaceOrTypeSymbol>(searchResult.Symbol),
_metadataReference);
}

protected override async Task<ImmutableArray<ISymbol>> FindDeclarationsAsync(
string name, SymbolFilter filter, SearchQuery searchQuery)
{
var service = _solution.Workspace.Services.GetService<ISymbolTreeInfoCacheService>();
var info = await service.TryGetMetadataSymbolTreeInfoAsync(_solution, _metadataReference, CancellationToken).ConfigureAwait(false);
if (info == null)
{
return ImmutableArray<ISymbol>.Empty;
}

return await info.FindAsync(searchQuery, _assembly, filter, CancellationToken).ConfigureAwait(false);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Threading;

namespace Microsoft.CodeAnalysis.CodeFixes.AddImport
{
internal abstract partial class AbstractAddImportCodeFixProvider<TSimpleNameSyntax>
{
private abstract class ProjectSearchScope : SearchScope
{
protected readonly Project _project;

public ProjectSearchScope(
AbstractAddImportCodeFixProvider<TSimpleNameSyntax> provider,
Project project,
bool exact,
CancellationToken cancellationToken)
: base(provider, exact, cancellationToken)
{
_project = project;
}

public override SymbolReference CreateReference<T>(SymbolResult<T> symbol)
{
return new ProjectSymbolReference(
provider, symbol.WithSymbol<INamespaceOrTypeSymbol>(symbol.Symbol), _project);
}
}
}
}
Loading