idea-php-dotenv-plugin icon indicating copy to clipboard operation
idea-php-dotenv-plugin copied to clipboard

Go to is not working if variable is not access directly (JavaScript)

Open Alexsey opened this issue 4 years ago • 2 comments

  1. Create a .env file
USER = 'Aaron'
  1. Create index.js file
const user = process.env.USER

Move caret to USER and press Ctrl + B (Declaration or Usages) - the .env would be opened, just as expected

  1. Now change code to
const env = process.env
const user = env.USER

Move caret to USER and press Ctrl + B (Declaration or Usages) - the caret would be moved to process.env. But it should move to .env file, just like in point 2, because the code is actually the same

  1. Now change code to
const {env} = process
const user = env.USER

The USER is unresolved, Ctrl + B is not working at all. But it should be resolved, and Ctrl + B should work the same as in point 2, because the code is actually the same

Alexsey avatar Sep 10 '19 16:09 Alexsey

Hi, @Alexsey That's true. Current implementation of completion and Go to declaration in JavaScript is very simple. It just tries to autocomplete all process.env.* calls. I'll do some research, maybe I could make it more smart.

adelf avatar Sep 10 '19 16:09 adelf

Thank you, that would be really cool!

Alexsey avatar Sep 10 '19 16:09 Alexsey