-2

I'm on Visual Studio 2022 happily writing C# code, when I suddenly started getting these teal boxes next to my code:

Unwanted teal boxes

If I click on them, they tell me that my class is implementing some methods or whatever. This is very much useless information, and makes it quite difficult to concentrate.

What are these boxes and how do I get rid of them?

0

1 Answer 1

5

No, it isn't useless information. The fact that you say "or whatever" just demonstrates that you don't understand the information, so how can you declare that it's useless? They provide information and, importantly, navigation for types that implement interfaces.

If you had clicked one of those icons, you would have seen that there's more information available. If you click the one for the interface, it will show you all the types that implement it. You can click on any one in the list to navigate directly to it. Similarly, clicking one for an interface member will list all the implementations of that member and allow you to navigate directly to them. The reverse is true of the icons for the class and its members, which enable you to navigate directly to the interface and its members.

This information may not seem important to you, when you have an interface and a class that implements it right next to each other in code. Once you start creating applications of any significant size though, they won't be right next to each other. They will be in different code files and likely in different projects, with multiple classes implementing some of the interfaces. In that case, the information can be important and the navigation definitely is.

You probably ought to assume a bit less about whether something is important when you have to ask what it actually is. I strongly suggest that you don't get rid of them because, even if you only use them once, they've still served a purpose without causing any harm. I'm guessing that they can be turned off but you may lose other functionality as well. If it can be done though, it will be in the VS Options dialogue. You should have a thorough look through that to see what's available and what else you might want to modify, either now or in the future. If everyone looks through that dialogue for themselves early on, they'll generally have a good idea of where to find something in the future.

So, I did just look in the VS options. Under Text Editor -> C# -> Advanced, one of the sections is Inheritance Margin and there's an option to show or hide it. I've never seen that before but I had a decent idea of where to look because I've spent some time examining the Options dialogue before to see what's there. Because of that, it took me a couple of minutes to find it. You are just as capable as me of doing those things.

10
  • Thanks for voicing your opinion. I think it could have used a bit less condescendence, but now with your edit, it does answer my question. You say that you found it right away, which is quite impressive -- I would have never even thought this could be called "inheritance margin". I passed through it, and never even considered this could be it. Regardless, I have no idea why this got turned on, but now I can turn it off. Commented Feb 4 at 8:12
  • 1
    @PandaPajama, I expect that it's on by default. Given that you couldn't work out how to turn it off, what are the chances of people who would benefit from it ever turning it on if it wasn't? As for how I found it, I didn't know that name either. Given that mousing over any of the icons specifically uses the word "inherited" though, once I saw the name, it seemed pretty obvious that was it. I knew to look in that area because, as I said, I made the effort to look through the Options dialogue when I started out so I know that stuff in the code window is under Text Editor. Commented Feb 4 at 8:22
  • @PandaPajama, what you perceived to be condescension was frustration more than anything. You have no idea how many times I've answered a question that I didn't know the answer to until I read it but found the answer by looking where the person who asked the question could have looked for themselves. Like I said, I only knew where to look because I have proactively looked before, when I was probably less experienced than you. Many questions can be answered for yourself, if you take the time and make the effort to look. Unfortunately, you're not alone in not doing so. Commented Feb 4 at 8:25
  • Has it ever happened to you that you're looking for your keys at home, you look everywhere and can't find them; and then you ask somebody else and they find them right away? I can assure you I am equally frustrated by not having found it, even though I spend the good part of an hour going through all menus I could think of, including the checkbox that you found. I hear that you're frustrated about this, but I can assure you your help was quite useful. I still think everything but the last paragraph is unecessary though... Commented Feb 4 at 8:32
  • And by the way, now that I know the name, I've found other people who got this randomly enabled as well. This is probably linked to some obscure hotkey that I might have mistakenly pressed at some point. Think about what you would have thought if it had happened to you, and you'd probably understand the frustration that led me to asking about it here. Commented Feb 4 at 8:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.