Skip to content

Implement linting on change #408

Closed

Description

As per this comment in #28, a new feature request:

Actually implement python.linting.lintOnTextChange, to apply linting to the unsaved buffer.

This is a desirable, if nontrivial, function.

See also #313 - if this is implemented, that should be reversed.

Activity

  1. kav2k commented on Dec 12, 2017

    @kav2k
    Author

    Please update #313 to point to this issue instead, so that people can vote for it.

  2. brettcannon commented on Dec 12, 2017

    @brettcannon
    Member

    Alexander Kashev (@kav2k) you can leave a comment referencing this issue if you want; there shouldn't be anything requiring special privileges to do so.

  3. kav2k commented on Dec 12, 2017

    @kav2k
    Author

    image

    Plus, it would make sense to edit the issue text, as it explicitly says "please add your vote 👍 against the following issue #28."

  4. brettcannon commented on Dec 13, 2017

    @brettcannon
    Member

    Alexander Kashev (@kav2k) I removed the mention in the other issue.

  5. malmaud commented on Dec 15, 2017

    @malmaud

    I'll just point out that PyCharm, atom, and sublime already have this. Most language packages for VSCode also have it. So this is really an outlier in terms of missing functionality.
    Thanks!

  6. xguse commented on Dec 18, 2017

    @xguse

    PS: since I cant comment on #313...

    It advises:

    "python.linting.lintOnSave": true,
    "files.autoSave": true
    

    As far as I can tell "files.autoSave": true is not actually an expected state for this option. I may be wrong but when I look at this, the options provide are:

     // Controls auto save of dirty files. Accepted values: 
    'off', 
    'afterDelay', 
    'onFocusChange' (editor loses focus), 
    'onWindowChange' (window loses focus). If set to 'afterDelay', you can configure the delay in 'files.autoSaveDelay'.
    

    This is kind of crazy to me. I have to have my file write to disk every second in order to get linting while I write?

    I will echo Jonathan Malmaud (@malmaud) on pointing out that this doesn't seem to be a "luxury" setting for most other languages/editors. It was quite surprising to me when I encountered this in this extension.

    However, please don't misunderstand my tone: I am VERY thankful for your work so far and would like to point out that having python so well supported for the most part in VS Code was what allowed me to finally leave Atom. It have for the MOST part been a spectacular change.

    So thanks.

  7. MikhailArkhipov commented on Mar 9, 2018

    @MikhailArkhipov

    This will be done via integration of Python analysis engine from Visual Studio. You can track the project here https://github.com/Microsoft/vscode-python/projects/7#card-8034268

  8. 35 remaining items

  9. brettcannon commented on Sep 2, 2021

    @brettcannon
    Member

    Fusion-A yes, if you wanted to write your own extension to implement something because we are not moving fast enough then you certainly can; we have no special access to APIs or anything, so anything we can do anyone can do.

  10. Gabriel-p commented on Sep 20, 2021

    @Gabriel-p

    Is there any extension that implements this? This is a very basic functionality that is missing

  11. brettcannon commented on Sep 21, 2021

    @brettcannon
    Member

    Gabriel Perren (@Gabriel-p) I'm personally not aware of any, but we have started researching this ourselves. It very well might mean we end up with separate extensions for each linter, though.

  12. leopons commented on Apr 7, 2022

    @leopons

    Hi everyone, any news since September? Did anyone find another extension for this?
    I've just decided to leave Atom for VScode, and what I've seen until now is just great. But this is a dealbreaker, it is just too important for me. If anyone else went through this I'm all ears for advice/hindsight

  13. brettcannon commented on Apr 7, 2022

    @brettcannon
    Member

    Our first linter extension got announced as part of the VS Code 1.66 release: https://github.com/microsoft/vscode-pylint . If performance holds up we can consider adding this feature there. You can also turn on auto-save and that will also trigger the linter more-or-less as you type.

  14. removed their assignment
    on May 12, 2022
  15. NireBryce commented on Jun 8, 2022

    @NireBryce

    I'm still pretty new at all of this stuff so I don't know if it's appropriate to add this here, but I didn't see mention in thread yet: cornflakes, the flake8 plugin, does have lintOnType, and might be a useful reference.

  16. NireBryce commented on Jun 9, 2022

    @NireBryce

    yep -- cornflakes' lint-on-type works and has for at least a year. I don't know how it performs on larger projects, but right now it's a pretty imperceptible delay

    It breaks a bit on jupyter notebooks in the notebook view, but .py files with #%% at the top work fine

  17. karrtikr commented on Dec 21, 2022

    @karrtikr

    I encourage folks to check out #408 (comment) and see if it works for them.

  18. karthiknadig commented on Oct 24, 2023

    @karthiknadig
    Member

    Linting on change has be added to pylint: https://marketplace.visualstudio.com/items?itemName=ms-python.pylint , see readme for setting to enable this.

    Ruff linter (which has pylint, flake8, bandit, pycodestyle, pydocstyle rules) also supports this: https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff
    See astral-sh/ruff-lsp#280 for setting to enable it.

  19. luabud commented on Oct 25, 2023

    @luabud
    Member

    Now that we are dropping support for the built-in linting features, we will leave it up to each linting extension to support linting on change. Hence closing this.

  20. locked as resolved and limited conversation to collaborators on Nov 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions