ypresto / SwiftLintXcode

An Xcode plug-in to format your code using SwiftLint.
Other
351 stars 15 forks source link

The document "doc.swift" could not be saved. The file has been changed by another application. #6

Open lakhman opened 8 years ago

lakhman commented 8 years ago

I started using SwiftLint by realm, I thought i'd give this plugin a try. It worked fine to start with but now I keep getting the following error on save:

The file for the document at “../AppDelegate.swift” has been modified by another application. There are also unsaved changes in Xcode.

I also get another error I have to click through at the same time:

The document "AppDelegate.swift" could not be saved. The file has been changed by another application. Click save anyway to keep your changes and save the changes made by the other application as a version...

These were both down to this plugin, once I removed it they disappeared. I tried reinstalling and the same errors appeared again. finally, I uninstalled for the second time, restarted and the errors disappeared.

I am using XCode 7.3

screen shot 2016-04-11 at 15 22 00

Error:

screen shot 2016-04-11 at 15 18 14

ypresto commented 8 years ago

Hmm, this plugin does not directly write to the swift file. Instead, it manipulates Xcode's text buffer. And this plugin does not change any text buffer or file if swiftlint does not correct anything. Please ensure that there is no app or xcode window opens that file?

lakhman commented 8 years ago

Just tried again, I cleared all derived cache + build files, shutdown xcode, shutdown all simulators, reopened my project, installed the plugin, restart xcode, opened appdelegate.swift, made a change, hit CMD+S, and I'm again presented with the same error.

I made sure no other files were open, only my single xcode window (no simulators or anything).

I (again) uninstalled the plugin, restarted xcode, and the error disappeared (after restarting xcode).

Is there anything I can do to help debug it?

Is it only me getting this error?

screen shot 2016-04-17 at 19 22 41

s-aska commented 8 years ago

me too.

iv-mexx commented 8 years ago

I get the same error every time I'm trying to save.

mishagray commented 8 years ago

me too! This kind of makes the plugin a no-go...

ypresto commented 8 years ago

Do you have any other plugin installed which does something on save..?

lakhman commented 8 years ago

Just checked, not that I can tell, When I uninstalled this plugin it stopped, and when I reinstalled it started.

Just went through all my installed plugins, nothing I could assume it's doing something on change, it's all editor tricks and stuff.

Sorry, Wish I could replicate this, I'll try and have a go tonight and see if I can help narrow it down, can you provide any debugging tricks? - If I do manage to replicate it, can I log it somehow?

lakhman commented 8 years ago

Just reinstalled SwiftLint from alcatraz, I get another error now, when pressing save CMD+S:

swiftlint at (B[m/usr/local/bin/swiftlint is not executable.

ls /usr/local/bin/

$ ls -al /usr/local/bin/swift*
lrwxr-xr-x  1 user  admin  40 May 17 14:42 /usr/local/bin/swiftlint -> ../Cellar/swiftlint/0.10.0/bin/swiftlint

I can run swiftlint from the command line and everything works.

Linting Swift files in current working directory
Linting 'swift-example.swift' (1/1)
~/code/examples/swift-example.swift:78:20: error: Force Try Violation: Force tries should be avoided. (force_try)
Done linting! Found 3 violations, 1 serious in 1 file.

I restarted xcode, and also uninstalled and reinstalled swiftlint via homebrew.

I was testing to see if the same save error occurred as originally reported by me, I was unable to do that due to this error. Any ideas?