Skip to content

In normal mode, no variable insert ... #4

@ChrisGitIt

Description

@ChrisGitIt

Hi and thanks for this nice plugin (don't know how many time i have written "console.log").

Somehow, its not working for me. When I'm in insert or normal mode and I do "cll", only "console.log({})" is printed out with no vars included (yes, my cursor was over a variable).

Any clues how I could debug this issue und see what's going wrong?

Also some suggestions:

  • Using "console" is actually a bad practice and its probably better to use a logging library like "Pino" or something alike. I think it would be nice if there could be "snippets" for the four different logging mechanisms. like "let lognroll_console_log = 'pino.log($$)'" OR "let lognroll_console_warning = 'pino.warning($$)'"....

  • Would it be possible to log several vars at once? I often have functions/methods with more than one parameter and I would like to log them in one go. So "function(var1, var2)" would / should resolve to "console.log(var1, var2)", maybe with something like "clla" (log all) or "cll2" (log two vars) ...

  • Would it be possible to include the "calling function" if its used on functions vars?
    Like "function myFunc(var1, var2)" would result in "console.log('myFunc:', var1, var2)"

Also some questions:

  • What are the curly brackets supposed to do in "console.log({})" ?? When I use them in the browser (FF), I will get an object for my string variable (var a = 'test'; console.log({a})) => {a:test})). In older browsers (especially mobil), this results in an error.

Okay, I think that's all for now.

Greetings,

Chris

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions