Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prettier autoformat breaks TurboConsoleLog #17

Closed
jon301 opened this issue Aug 3, 2018 · 7 comments
Closed

Prettier autoformat breaks TurboConsoleLog #17

jon301 opened this issue Aug 3, 2018 · 7 comments

Comments

@jon301
Copy link

jon301 commented Aug 3, 2018

Hi

I noticed that sometimes, if the console.log statement is very long then Prettier autoformats the statement in multiple lines
It looks like TurboConsoleLog is not able to track those console.log anymore, meaning that Comment All | Uncomment All | Delete All comments does not affect those console.log formatted by Prettier.

A workaround would be to able to define a custom prefix for each console.log, something like

// prettier-ignore
console.log('...')

What do you think ?
Thanks for this very handy extension ! 👍

@Chakroun-Anas
Copy link
Owner

Hello,

Thank you very much for bringing up this issue;

The log messages were inserted each with a transparent character to mark them for commenting, uncommenting and deleting;

Apparently prettier remove the transparent characters while formatting the files, so in order to solve the issue once for all i decided to change the log message format to the following:

console.log('TCL: SelectedVariableEnclosingClassName -> SelectedVariableEnclosingFunctionName -> SelectedVariable', SelectedVariable).

Thx again and happy coding.

@jon301
Copy link
Author

jon301 commented Sep 5, 2018

Hi @Chakroun-Anas,

Thanks for the update, still it does not seem to fix the issue :/

Given this code :

    console.log('TCL: ClassicComponent -> constructor -> this.store', this.store);

When I save it, prettier re-formats it to :

    console.log(
      'TCL: ClassicComponent -> constructor -> this.store',
      this.store
    );

Then after that, TurboConsoleLog does not recognize this log anymore thus it's not possible to comment/uncomment or delete via the extension.

@Chakroun-Anas Chakroun-Anas reopened this Sep 11, 2018
@Chakroun-Anas
Copy link
Owner

Chakroun-Anas commented Sep 16, 2018

Hello @jon301 ,

Thank you for your feedback, this is really a big deal so i promise that i will work on it soon.

@Chakroun-Anas
Copy link
Owner

Hello,

I have just published an update that ensure the compatibilty with prettier.

Please check again so that we can close this issue.

@jon301
Copy link
Author

jon301 commented Nov 16, 2018

Hi @Chakroun-Anas
It works like a charm in the latest version (1.2.11) !

Thanks <3

@HiChen404
Copy link

I configured the preitter, but still have the same problem.

TurboConsoleLog does not recognize this log anymore thus it's not possible to comment/uncomment or delete via the extension,Even though 'console.log()'show on one line.

As you said:

Apparently prettier remove the transparent characters while formatting the files

I think that's the problem,too.

TurboConsoleLog v2.1.7

Thank you!

@bsitruk
Copy link

bsitruk commented Jun 7, 2022

Changing the quote to the one that prettier's using fixed the issue for me:
"turboConsoleLog.quote": "'" in my case.

Maybe we could make the behavior more generic as it seems to rely on the quote style used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants