title: VS Code: How to find all references of a variable in python?
body: <p>I'd like a VS Code feature like <a href="https://www.jetbrains.com/help/pycharm/finding-usages-in-project.html" rel="noreferrer"><strong>Find Usages</strong></a> in Pycharm, which can find all reads and writes of a variable. Take a simple file for example:</p>
  
  <pre><code>class Foo:
      def __init__(self, bar):
          self.bar = bar
  
      def do_something(self):
          bar1 = "hhhhh"
          if bar1 == self.bar:
              print("do something")
  </code></pre>
  
  <p>In Pycharm using "Find Usages" of <code>self.bar</code>: </p>
  
  <p><a href="https://i.stack.imgur.com/YTzQI.png" rel="noreferrer"><img src="https://i.stack.imgur.com/YTzQI.png" alt="Find Usages screenshot"></a></p>
  
  <p>I've tried "Find all references" but it doesn't work:</p>
  
  <p><a href="https://i.stack.imgur.com/RdjzE.png" rel="noreferrer"><img src="https://i.stack.imgur.com/RdjzE.png" alt="Find all references screenshot"></a></p>
  
  <p>as it doesn't find <code>if bar1 == self.bar:</code>.</p>
  
  <p><strong>Update</strong>: searching for just occurrences is not what I am asking, as it just matches keywords which includes other variables with same name and also occurrences in comments.</p>
  
  <p><strong>Update</strong>: turns out to be a known issue in Microsoft python language server: <a href="http://github.com/microsoft/python-language-server/issues/1174" rel="noreferrer">github.com/microsoft/python-language-server/issues/1174</a></p>