This project is read-only.

Question regarding SemanticModel.LookupSymbols and curly braces

Topics: APIs
Oct 22, 2014 at 4:29 PM
Hello,

I'm trying to use the API in question in order to retrieve the symbols accessible inside a block of code. However, when I pass to the API the position of the closing curly brace (not the one after that, so it should still be inside the block), the symbols declared inside the block are not among the returned ones. Example:
void Method(int param1)
{
  var str = "foo";
}
In this case, specifying position of the method's closing brace will result in a set of symbols which doesn't include neither param1 nor str.

Is it some sort of design decision or a bug?
Nov 7, 2014 at 11:40 PM
Edited Nov 7, 2014 at 11:40 PM
This was a design decision. I think the scope you get pointing to the { character gives you the scope following that character. Similarly for the } character.