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

add a throttle timeout so that we don't update to frequently #106

Closed fdncred closed 1 year ago

fdncred commented 1 year ago

This PR adds a throttle to how often the document validation happens.

I discovered we needed something like this while I was doing some script programming and watching the logs. I was adding comments to variables and custom commands when I noticed that on every single character that I typed, we called out to nushell to revalidate the document.

I found the main throttle function in jakt's extension but adjusted the timeout to 1500. I'm not sure 1500 is correct. The idea is only to update after a certain duration versus every character. We'll have to tune this over time.