Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to only lint on save #28

Closed
averms opened this issue Mar 2, 2018 · 9 comments
Closed

Is there a way to only lint on save #28

averms opened this issue Mar 2, 2018 · 9 comments

Comments

@averms
Copy link

averms commented Mar 2, 2018

It seems a lot of VS Code native linters and microsoft-sponsored extensions have this option, the python extension has "python.linting.lintOnSave": true

Would it be possible to add this or is there an option already there that I haven't noticed?

@DavidAnson
Copy link
Owner

This extension lints as you type, so the list of violations is already correct when you save. How do you see this feature working differently?

@DavidAnson
Copy link
Owner

Sorry, missed the word “only”. Okay, then my question is why is that better than linting as you type? Unlike some other tools, this one throttles itself a bit to minimize impact. Are you finding it slows things down?

@averms
Copy link
Author

averms commented Mar 2, 2018

Well the main reason is customizability, it gives more options to the end user. I just like the manual feeling of having to press a button to get run the linter.

@DavidAnson
Copy link
Owner

The way I read the docs I could find, lint-on-save exists for projects that are not able to lint interactively - and they recommend using auto-save in conjunction as a way to approximate it.

If I added the option to this extension, either it would not do anything (file already linted automatically) or it would need to also disable interactive linting so it would have something to do. Neither seems useful until/unless interactive linting becomes impractical.

I’ll leave this issue open for a while to see if there are further requests.

@robwalton
Copy link

robwalton commented Mar 16, 2018

I think that being able to either lint only on save, or enable/disable linting is important while writing (maybe I've missed this option). More precisely, it would be nice to have a way of hiding, or pausing linter highlighting in the editor.

Two reasons why:

  1. While writing creatively it is just nice not to be interrupted by the linter. This is why its nice to be able to disable live spell checking for example. (Thanks for providing a way to disable the lightbulb! Thats made it much less distracting.)
  2. With MD009/no-trailing-spaces enabled you get a lint warning every time you press the space bar while writing and pause for ~ 1/3 of a second. I have this off now as its just too distracting, but would like to reanable it.

So although its awesome to have the linter, I find that having it marking up the editor all the time to be distracting. I'm not sure if enable/disable or lint only on save would be a better way of solving this.

@robwalton
Copy link

Another annoying one while working live is MD032/blanks-around-lists, which pops up after you've made a new list item but have paused before writing into it. I'm starting to think that lint-on-save is batter than disable/enable as you don't need to remember to reenable.

@DavidAnson
Copy link
Owner

Got it. I’ll look into this soon.

@robwalton
Copy link

Thats great thanks! Open source is a funny old thing with strangers demanding free improvements eh?!

If it helps, these are the settings for the linters that came built in (I'm pretty sure):

// Whether the linter is run on save or on type.
"php.validate.run": "onSave",

// Run the linter on save (onSave) or on type (onType)
"eslint.run": "onType"

@robwalton
Copy link

Awesome Thanks. Re-enabling markdown linting now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants