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

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

Open
lakhman opened this issue Apr 11, 2016 · 8 comments

Comments

@lakhman
Copy link

lakhman commented Apr 11, 2016

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 ypresto added bug and removed bug labels Apr 14, 2016
@ypresto
Copy link
Owner

ypresto commented Apr 14, 2016

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
Copy link
Author

lakhman commented Apr 17, 2016

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
Copy link

s-aska commented Apr 18, 2016

me too.

@iv-mexx
Copy link

iv-mexx commented Apr 18, 2016

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

@mishagray
Copy link

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

@ypresto
Copy link
Owner

ypresto commented May 16, 2016

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

@lakhman
Copy link
Author

lakhman commented May 16, 2016

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
Copy link
Author

lakhman commented May 17, 2016

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?

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

No branches or pull requests

5 participants