Skip to content

No such label 'onDefinition' for console.timeEnd() #132

@gaetschwartz

Description

@gaetschwartz

While using the extension I get an error No such label 'onDefinition' for console.timeEnd() appearing every few seconds.

Output:

 Warning: Label 'onDefinition' already exists for console.time()
[...]
Finished  (node:7660) Warning: No such label 'onDefinition' for console.timeEnd()
stdout: {}

Infos

❯ nu --version
0.80.0
Edition	Windows 11 Pro Insider Preview
Version	22H2
OS build	23471.1000
Experience	Windows Feature Experience Pack 1000.23471.1000.0

Probable issue

Issue seems to come from this function

async function durationLogWrapper<T>(
label: string,
fn: () => Promise<T>
): Promise<T> {
console.log("Triggered " + label + ": ...");
console.time(label);
const result = await fn();
// This purposefully has the same prefix length as the "Triggered " log above,
// also does not add a newline at the end.
process.stdout.write("Finished ");
console.timeEnd(label);
return new Promise<T>((resolve) => resolve(result));
}

Indeed, console.time(label) and console.timeEnd(label) take unique labels, but here the same label is being reused everytime:
return await durationLogWrapper(`onDefinition`, async () => {

hence the warning Warning: Label 'onDefinition' already exists for console.time()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions