You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are no extensions installed, just a fresh install of VS Code. The "rename symbol" fails under some circumstances.
In this JS example you can successfully rename function name foo or variable name name to something different:
functionfoo(){varname="John",surname="Doe";if(name=="John"){alert("The full name is "+name+" "+surname);}}// TODO: Change function name from foo to// something better!foo()
However, if you remove the function:
if you put the cursor on the first occurrence of name and then try to rename this symbol - it will be renamed only this occurrence
if you put the cursor on the second occurrence of name - it will be a message "You cannot rename elements that are defined in the standard TypeScript library"
varname="John",surname="Doe";if(name=="John"){alert("The full name is "+name+" "+surname);}
This issue has the same root cause as #31783. There is a global value in the DOM typings called name conflicts with the local name. If you are working in a module this is not an issue but for global style javascript files, you hit this.
You can see this warning more easily by adding //@ts-check to the top of the file to enable type checking in it.
Moving upstream to see if the UX can be improved for this
At first I was going to say "Shouldn't the global name be shadowed?" but then I realize that in this case it is the global name because top-level var puts things on the global object...
(Not sure is it a bug or not.)
There are no extensions installed, just a fresh install of VS Code. The "rename symbol" fails under some circumstances.
In this JS example you can successfully rename function name
foo
or variable namename
to something different:However, if you remove the function:
name
and then try to rename this symbol - it will be renamed only this occurrencename
- it will be a message "You cannot rename elements that are defined in the standard TypeScript library"Version: 1.35.0 (user setup)
Commit: 553cfb2c2205db5f15f3ee8395bbd5cf066d357d
Date: 2019-06-04T01:18:19.664Z
Electron: 3.1.8
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT ia32 6.1.7600
The text was updated successfully, but these errors were encountered: