Chakroun-Anas / turbo-console-log

591 stars 141 forks source link

When press Crtl + Alt + L ==> Console log will appear in the last line of script in .vue file #108

Closed harrytran998 closed 1 year ago

harrytran998 commented 3 years ago

It's an example. After I update the Extention and reload, this stuff happen. And only in Vue file, I checked another file like .ts or .js it's totally ok! Vue file have the structure like this.

<template></template>
<script>
export default defineComponent({
 setup() {
  function foo() {}
  return { foo }
 }
})
</script>

image

praburangki commented 3 years ago

This is also happening on a .ts file. I've downgraded to v2.1.0 and it's back to normal.

chakroun-anas-contentsquare commented 3 years ago

Hello, a fix is coming soon 🙂

harrytran998 commented 3 years ago

Hello, a fix is coming soon 🙂

Thank you for your work ❤️.

PeterLAxakon commented 3 years ago

This is also happening on a .ts file. I've downgraded to v2.1.0 and it's back to normal.

can confirm this, not working as expected in .ts files

Chakroun-Anas commented 3 years ago

Hello guys,

I need you please to share with me the snippet of code where the extension is not inserting the log message in the right line, this will help me check if the fix is covering all cases (each different case will have its test scenario).

Thx in advance.

Chakroun-Anas commented 3 years ago

I just pushed a version that should deal with this (2.1.4), but as i said above, i need you please to verify again and share with me the snippet of code where the extension wasn’t or isn’t working properly so that we create test cases for each different scenario and make it more robust 😉, thx.

itsalb3rt commented 3 years ago

And simple js file. I press Crtl + Alt + L in line 82 error and the out put in 97 and 98 line. In another function.

image

v2.1.5

lawson-ng commented 3 years ago

The same issue (v2.1.5)

lawson-ng commented 3 years ago

This is also happening on a .ts file. I've downgraded to v2.1.0 and it's back to normal.

Got into the situation with v2.1.0 . It works well with v2.0.4

PeterLAxakon commented 3 years ago

@Chakroun-Anas I'm glad you are working on this, unfortunately this is still an issue in typescript. 1 error in this function I want to console log the parameter, I'm using the Crtl + Alt + L In the first example the console log is inserted under the function itself.

However if I start the function with a new/blank line it seems to insert the console log at the right place: 2 works

Chakroun-Anas commented 3 years ago

@PeterLAxakon I just pushed a version (v2.1.6) that deals with this, please test again and give me your feedback, thank you for making the extension better.

@itsalb3rt Unfortunately i need the whole context of the variable so that i can help you, anyway, hopefully that the last version (v2.1.6) that i just pushed deals with your use case, if not please share with me the whole context of the variable so that i can fix that, thank you.

lawson-ng commented 3 years ago

@PeterLAxakon I just pushed a version (v2.1.6) that deals with this, please test again and give me your feedback, thank you for making the extension better.

@itsalb3rt Unfortunately i need the whole context of the variable so that i can help you, anyway, hopefully that the last version (v2.1.6) that i just pushed deals with your use case, if not please share with me the whole context of the variable so that i can fix that, thank you.

Confirm : It works

Screen Shot 2020-12-07 at 12 14 15
itsalb3rt commented 3 years ago

@PeterLAxakon I just pushed a version (v2.1.6) that deals with this, please test again and give me your feedback, thank you for making the extension better.

@itsalb3rt Unfortunately i need the whole context of the variable so that i can help you, anyway, hopefully that the last version (v2.1.6) that i just pushed deals with your use case, if not please share with me the whole context of the variable so that i can fix that, thank you.

In my case it has not been solved but I have discovered that if the functions have similar names (like the code that I will put below) the output of Crtl + Alt + L jumps to the other function.

/**
 * Get extensions by account number
 */
function* fetchExtensions(action) {
    try {
    } catch (error) {
        // dispatch a failure action to the store with the error
        yield put(actions.error(types.FETCH_EXTENSIONS.ERROR, error, true));
        yield cps({ context, fn }, { redirect: false });
    }
}

/**
 * Get extension by id
 */
function* fetchExtension(action) {
    try {
    } catch (error) {
        if (error.hasOwnProperty('code') && error.code === 400) {
            yield put(actions.error(types.FETCH_EXTENSION.ERROR, error, true));
        } else {
            yield put(actions.error(types.FETCH_EXTENSION.ERROR));
        }
    }
}

Note: This is a sagas (simple js file) but even removing the atherists (*) from the functions it continues to work incorrectly

image

PeterLAxakon commented 3 years ago

@PeterLAxakon I just pushed a version (v2.1.6) that deals with this, please test again and give me your feedback, thank you for making the extension better.

@itsalb3rt Unfortunately i need the whole context of the variable so that i can help you, anyway, hopefully that the last version (v2.1.6) that i just pushed deals with your use case, if not please share with me the whole context of the variable so that i can fix that, thank you.

thank you, it now works with parameters.