nushell / vscode-nushell-lang

A Nushell grammar for Visual Studio Code with IDE support
https://www.nushell.sh/
MIT License
122 stars 27 forks source link

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

Closed gaetschwartz closed 1 year ago

gaetschwartz commented 1 year ago

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 https://github.com/nushell/vscode-nushell-lang/blob/f657b9a71ef21599f10ed8423776600a6af52727/server/src/server.ts#L113-L126 Indeed, console.time(label) and console.timeEnd(label) take unique labels, but here the same label is being reused everytime: https://github.com/nushell/vscode-nushell-lang/blob/f657b9a71ef21599f10ed8423776600a6af52727/server/src/server.ts#L565

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

fdncred commented 1 year ago

very strange. i've never seen these errors. i stole that code from the jakt extension. i'm surprised it works there and not here, but then again, i know very little about typescript and had no clue that it requires something unique.

thanks for the pr.