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

enable linting on file open #1052

Closed
garretwilson opened this issue Jan 21, 2016 · 13 comments
Closed

enable linting on file open #1052

garretwilson opened this issue Jan 21, 2016 · 13 comments
Assignees

Comments

@garretwilson
Copy link

The linter-tidy plugin has a very strange behavior, and @Arcanemagus tells me it is an issue with linter itself and that I should file a bug here.

If I open an HTML file, linter-tidy doesn't kick in... until I modify the file and save it! I'm not talking about dynamic lint-as-I-type---I'm talking about just opening the file! It seems there's no way to know what is wrong with my file unless I pretend to edit it (perhaps add a line) and then save it. I'm not aware of any tool (Komodo, Eclipse, etc.) that works that way---they just do the syntax checking immediately when I open the file.

@Arcanemagus tells me this is a limitation of linter. See AtomLinter/linter-tidy#25 (comment)

@steelbrain
Copy link
Owner

I'm personally 👎 on this as I often open third-party code in my editor to find our their APIs and internal workings. This would show me a lot of unnecessary stuff

@Arcanemagus
Copy link
Collaborator

FYI @garretwilson you can save a file even without making changes to the code, this still triggers the save event.

I wouldn't be against an option to enable always linting all files on open, as long as the default was off.

@garretwilson
Copy link
Author

you can save a file even without making changes to the code, this still triggers the save event.

But seriously, what an awkward workaround! I have to rewrite bytes to a file---even identical ones---just to trigger a file check?? That could not be called anything but "kludge".

Why are we making the edge cases govern the default behavior? If there are some files you want to ignore, make a feature to ignore certain files.

@steelbrain
Copy link
Owner

@garretwilson

PS. Just press ctrl+s without any change at all and it'll lint your code

@florianb
Copy link

I think the user should be able to choose if opening triggers a lint, too. So i'm for a config-option here: 👍

@azawawi
Copy link

azawawi commented Mar 30, 2016

A config option is the best solution imho 👍

@steelbrain
Copy link
Owner

I don't mind a config if it's disabled by default

@julesjulian
Copy link

My understanding is that linters specifying lintOnFly as true check the files when they are opened anyway. How do you deal with this, @steelbrain? Or do you just not use any of those linters?

@steelbrain
Copy link
Owner

@julesjulian I do use one of those linters and lintOnFly ones don't really trigger automatically on open, they trigger on text manipulation even without save. So I would say that's the expected behavior

@Arcanemagus
Copy link
Collaborator

@julesjulian I just put something together in my head that might explain something... I have editorconfig installed on my Atom instance and there are a few bugs on it's repo mentioning that it is modifying the text on open no matter what... I normally only see that when it has to fix the line endings but maybe it's triggering a lint even though the contents don't change so Atom doesn't show the file as modified?

That might explain why I see files linted on open with lintOnFly linters.

@BrownBear2
Copy link

I agree with @garretwilson that this should be default (but you should be able to turn it off).
The linter also should probably turn itself off by default for 3rd party applications as determined by Atoms "ignored names" setting.

@dirk-thomas
Copy link

We ran into a similar case where a new editor tab (which hasn't been saved yet) is not being linted either. If that is a use case some of you are also interested in please consider commenting on #1235.

@4refael
Copy link

4refael commented Oct 24, 2016

Just wanted to add my +1 for this feature. I switched from another editor and really used to this behavior.

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

9 participants