Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

118
Vistas
Search for place where variable is given value

Is there any mechanism within VS Code (including plugins) to search for the place where a variable is given a value? I often search for myvariable = but that doesn't catch things like:

{ myvariable } = ...
[ myvariable ] = ...

function myfunc(myvariable) { }
myfunc(myvalue)

I'm working with JavaScript exclusively.

about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

Not sure this is the right stack exchange for this question, but yes, there is a way to find these. The article on code navigation will help you further. Basically, VS Code has a command "Find references" (for me it's keybind F12 or ctrl+shift+F12 for a "full" version, but I don't know if this is the default) which will show you where a variable/type is declared and used.

As far as I know, there isn't an easy way to find only the places where a variable gets assigned. But these are included in the references search.

about 4 years ago · Juan Pablo Isaza Denunciar

0

You can use Ctrl+Shift+O to open the Go to symbol in editor menu.

Here you can search for variable definitions, and once selected your cursor will automatically be moved to the definition.

Example

Say my file looks like this:

enter image description here

I press Ctrl+Shift+O to bring up this:

enter image description here

Then I can select an item to move my cursor to the definition like this:

enter image description here

about 4 years ago · Juan Pablo Isaza Denunciar

0

Here is another idea just for fun. It uses an extension I wrote, Find and Transform, that handles your request pretty easily (as long as you can make the appropriate regex ;>}).

With this keybinding:

{
  "key": "alt+y",                  // whatever keybinding you want
  "command": "findInCurrentFile",
  "args": {
    "find": "${selectedText}(?=\\s*[}\\]]?\\s*=)",
    "isRegex": true,
  }
}

It'll get your selected text (which may just be the word under the cursor - see demo) and uses a positive lookahead to find the examples you mentioned in your question. The match will be scroll-revealed if necessary. Ctrl+U to return the cursor to your previous position.

selected text with reveal demo

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda