-
Notifications
You must be signed in to change notification settings - Fork 286
Debounce linting to prevent running on every keypress #264
Conversation
src/ruby.ts
Outdated
@@ -120,7 +121,8 @@ function registerLinters(ctx: ExtensionContext) { | |||
} | |||
|
|||
ctx.subscriptions.push(vscode.window.onDidChangeActiveTextEditor(executeLinting)); | |||
ctx.subscriptions.push(vscode.workspace.onDidChangeTextDocument(executeLinting)); | |||
// Debounce linting to prevent running on every keypress, only run when typing has stopped | |||
ctx.subscriptions.push(vscode.workspace.onDidChangeTextDocument(debounce(executeLinting, 500))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might make the debounce delay configurable? Some of the other delays (eg autocomplete recommendations) are configurable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hardcoded it as I didn't think there would be too much need to change it, and didn't want to needlessly add extra config options.
If it would be useful for some to be able to configure it though, I'm happy to do so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ultimately up to maintainers, but any time I see a delay I like it to be configurable (unit testing, different user preferences, etc).
@rebornix or @wingrunr21 is there any chance of getting this merged? This and the broken syntax highlighting has made writing ruby in VSCode pretty painful for the past month or so Appreciate all your efforts on the extension! |
I think it needs a config option |
@rebornix, @wingrunr21 the OP added the configuration option ... could we get this merged now ? I can't use rubocop at all without it, and it's getting hard to track all these PRs I add on top of my local vscode-ruby package... |
I can merge it but @rebornix can you push a release? |
This fixed my issues and made this plugin completely great again (especially with the solargraph additions) - any chance we can get an official release so I don't have to run it from the 'master' branch locally? @rebornix :) |
I’ll do a release today.
…On Wed, Apr 4, 2018 at 8:07 AM Justin Hart ***@***.***> wrote:
This fixed my issues and made this plugin completely great again
(especially with the solargraph additions) - any chance we can get an
official release so I don't have to run it from the 'master' branch
locally? @rebornix </~https://github.com/rebornix> :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#264 (comment)>,
or mute the thread
</~https://github.com/notifications/unsubscribe-auth/AA1heGQc-woLJHg_gl2KxSEXgFVj2IHcks5tlOG8gaJpZM4SBXjy>
.
|
@rebornix It looks like the release didn't happen last week. Just a friendly reminder. Thanks for your work here! |
Didn't make that happen as promised, sorry for that. 0.18.0 is released now. |
I've been having this issue #252 where the linters run after every keypress and cause significant input lag.
This PR makes the linters only run when typing has finished, instead of after each letter.
Before:
After:
EDIT: Updated to include a configuration option for the delay.