p42ai / js-assistant

120+ refactorings and code-assists for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=p42ai.refactor
MIT License
119 stars 7 forks source link

Convert to template string issue #13

Closed ciruz closed 2 years ago

ciruz commented 2 years ago

Hey, I noticed a error when refactoring this code:

fetch(
    process.env.API_URL +
      `/foo/bar?id=${id}&token=${token}`
  );

image

Result:

fetch(
    `${process.env.API_URL}/foo/bar?id=${id}&token=`token}`
  );

Best, Tom

lgrammel commented 2 years ago

Hi Tom,

thanks for the bug report. This looks like a refactoring that comes with VS Code (built-in), not P42. P42 refactorings have a '[P42]' at the end of the action label in the context menu. If this is a P42 refactoring, please re-open the issue.

Best, Lars

ciruz commented 2 years ago

Oh, you are right, P42 does it right but vscode not.

lgrammel commented 2 years ago

Awesome, thanks for confirming!