dotnet / dotnet/roslyn

Configure Roslyn's usings quickfix to ignore certain namespaces

Open
#78,040 0 comments 1 reaction 0 assignees View on GitHub
Area-IDE
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

Originally discussed on [StackOverflow](https://stackoverflow.com/q/79557803/9971404), where @jasonmalinowski mentioned that such behaviour currently does not exist. Hence, I've opened this feature request. I hope it can be considered.

## Summary

Please allow us to configure Roslyn to ignore certain namespaces when using the "missing namespace" quickfix.

## Background and Motivation

When my code is missing a namespace, I can use the "usings" quickfix (ctrl + .) to recommend applicable namespaces.

I use a library which has many types that are identically-named to those in the framework and even in my own code. So the quickfix often recommends namespaces from that library, and places them first in the popup. This is a nuisance which increases friction.

## Proposed Feature

I don't know what would be the best approach. There are a number of places where config can be placed:
- in `.editorconfig`
- in `Project.csproj` or `Directory.Build.props`
- in `global.json`
- in a `Foo.cs` file at the project root, marked with some sort of assembly attribute

## Alternative Designs

N/A

Thanks for considering it!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.