OlmschenkEarth logo

JetBrains Refactoring is Better Than VSCode Refactoring

JetBrains IDEs (PyCharm, IntelliJ, etc.) have better refactoring than VSCode does. Consider the simple task of reordering the parameters of a Python function. In PyCharm, you simply say you want to change the order of the parameters, and PyCharm will automatically find all usages of that function and update them appropriately. In VSCode, there is no way to do this. If you want to reorder the parameters, you need to go change each usage of the function yourself, like an animal.

This is more than just a convenience. If you swap two parameters of the same type and you miss updating any usage, the code will appear to run fine, but you’ve now introduced a subtle bug into your code.

JetBrains making your life easy by updating every usage correctly.
VSCode leaving problems all over your project.

It’s the same thing when deleting a parameter. Or adding a new required parameter. Or converting an optional parameter to a required parameter. In each of these cases, PyCharm will perform the correct refactoring. Meanwhile, VSCode requires that you painstakingly find and update every usage on your own, and keep track of which ones you have and haven’t updated yet.

VSCode does manage the bare minimum of being able to rename a parameter and the usages of it. However, it won’t update any places that parameter name was used in the comments of that function. Even the function’s own docstring, which should certainly reference the parameter, is not updated. This gets even worse when renaming functions. When renaming a parameter, you might only need to look through the comments and docstring of that parameter’s function. But if you rename a function, that function could be referenced in another docstring or comment anywhere in your code. That is, if you have increase_area and shrink_area functions that reference each other as their opposites, and then you decide to rename the latter to decrease_area, you better remember to update the reference in the former’s docstring. And is that the only function that references the old shrink_area in its docstring? Going to have to go searching to find out.

Over in PyCharm land, even these references in comments and docstrings are updated. When you rename something, you don’t need to remember to do follow-up tasks like searching for other usages to rename. PyCharm has you covered.

Now, while this is just scratching the surface of the refactorings that JetBrains provides, until VSCode can do the basics, there’s not much point in piling on. For now, we’ll keep the bar low. But even if we put the bar on the floor, VSCode might trip on it.