bealex / SwiftLintAppCode

Provides highlighting of the SwiftLint errors in the AppCode
MIT License
52 stars 8 forks source link

Swiftlint plugin is triggering the plugin File Watcher #51

Closed vegidio closed 3 years ago

vegidio commented 3 years ago

I recently installed the SwiftLint plugin in AppCode and I noticed that when I turn on the code inspection Editor > Inspections > SwiftLint then the watcher that I created on my File Watcher for .swift files is triggered automatically, as if the file is saved after every code inspection which is not the expected behavior

When SwiftLint inspection is off the File Watcher is not triggered.

This is my Inspections configuration:

Inspections

And this is my File Watcher configuration:

File Watcher

bealex commented 3 years ago

Hi, thanks for the issue. Does this occur when you launch command line swiftlint for your project?

Plugin, basically, runs swiftlint on a current file when it is changed, and parses the result. Before running SwiftLint I have to dump caches to the file system, because swiftlint command works with a file itself.

I will see what I can do, but answer will help me to narrow down my options.

vegidio commented 3 years ago

Hi,

This is what I did to test:

  1. I disabled the Swiftlint inspection on Editor > Inspections > SwiftLint and I also disabled the option Save files when switching to a different application (this is enabled by default on Appcode), otherwise Appcode would save the file automatically for me when I switch to the terminal do run swiftlint there.
autosave
  1. I made sure that my file watcher is configured to be triggered by external changes, done outside Appcode (second screenshot in my first message).

  2. I opened the terminal, I went to the project's folder and I ran swiftlint. I came back to Appcode and the File Watcher had not been triggered.

Before running SwiftLint I have to dump caches to the file system, because swiftlint command works with a file itself.

One suggestion: maybe your plugin could save the changes in a temporary file in the file system and run swiftlint against this file? This way the original file will remain unaltered and the File Watcher will not be triggered.

bealex commented 3 years ago

Thanks a lot for the investigation. Will think what I can do with that.

bealex commented 3 years ago

Please check after updating to 1.13. Please check (update should be available after JB review)