Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Conversation

@sam-kayg
Copy link
Contributor

@sam-kayg sam-kayg commented Feb 11, 2018

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:
slow_linting

After:
debounced_linting

EDIT: Updated to include a configuration option for the delay.

src/ruby.ts Outdated
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)));

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.

Copy link
Contributor Author

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.

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).

@papa-whisky
Copy link

@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!

@wingrunr21
Copy link
Collaborator

I think it needs a config option

@doudou
Copy link
Contributor

doudou commented Mar 6, 2018

@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...

@wingrunr21
Copy link
Collaborator

I can merge it but @rebornix can you push a release?

@wingrunr21 wingrunr21 merged commit 9093440 into rubyide:master Mar 6, 2018
@sam-kayg sam-kayg deleted the debounce-linting branch March 7, 2018 10:41
@onyxraven
Copy link

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 :)

@rebornix
Copy link
Member

rebornix commented Apr 4, 2018 via email

@onyxraven
Copy link

@rebornix It looks like the release didn't happen last week. Just a friendly reminder. Thanks for your work here!

@rebornix
Copy link
Member

Didn't make that happen as promised, sorry for that. 0.18.0 is released now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants