GithubHelp home page GithubHelp logo

Comments (12)

dubreuia avatar dubreuia commented on July 20, 2024

Thanks for that. Can you give me your plugin version, idea version and the last lines of your ~/.IntelliJIdea2016.1/system/log/idea.log please I'll check it out

from intellij-plugin-save-actions.

dubreuia avatar dubreuia commented on July 20, 2024

I can reproduce, don't worry about what I asked you, I'll be able to manage without it.

edit: I went back as far as v0.4, and that bug was always there and it is pretty serious. The problem is that I don't know when the file is written to disk, it seems like it is written too soon (before the plugin has finished working on the file) because it is done async.

edit2: actually not too bad since in the end the correct content is written to disk, but a bit later, I'll see if I can force it

from intellij-plugin-save-actions.

bradcupit avatar bradcupit commented on July 20, 2024

I've seen the same thing, but when I save the file the unformatted version gets written to disk.

First save: writes unformatted version to disk
Second save: writes formatted version to disk.

This only happens when the code needs to be formatted. If I type out a line of code and got the formatting correct myself, then it properly writes to disk the first time.

IntelliJ 2017.2
Save Action 0.16

Relevant preferences: Reformat File and Reformat only changed code (only if VCS configured) are both checked

from intellij-plugin-save-actions.

dubreuia avatar dubreuia commented on July 20, 2024

Thanks for the comment. I know this issue still exists but I haven't got around to fixing it. It also doesn't seem to happen all the time, but I definitely see it once in a while (when I commit to git then see a formatting change after the commit).

I'm pretty sure it has to do with multiple save event being thrown. I'm linking this old PR that filters duplicate events, it might help in that case: https://github.com/dubreuia/intellij-plugin-save-actions/pull/46/commits

from intellij-plugin-save-actions.

dubreuia avatar dubreuia commented on July 20, 2024

This is a problem also when building / executing tests. It does: "build -> save actions -> tests -> fail with stack trace -> the stack trace lines are the old ones" (meaning the file was not saved at the proper time)

from intellij-plugin-save-actions.

blowsie avatar blowsie commented on July 20, 2024

I also have this issue with the most basic of settings
image

from intellij-plugin-save-actions.

dubreuia avatar dubreuia commented on July 20, 2024

Hey @blowsie, thanks for reporting.

I know about this problem but I've been unable to fix it. It has something to do with how Intellij handles a file's life cycle. I'll probably find a way at some point but for now it doesn't work.

You can also see the problem with "Organize imports": if you have an unused import that is also a compile error (for example on a class that doesn't exists anymore), building the project will trigger save actions, that will clean the unused (and erroneous) import, but the build will still fail on the import that doesn't exist anymore. It happens to me a lot when I refactor code.

This is really annoying. If I get time at some point I'll seek help from Jetbrains.

from intellij-plugin-save-actions.

sniffertine avatar sniffertine commented on July 20, 2024

Hey folks. This probably also happens when you use the feature to undo changes ("Rollback Lines") on the left panel. With this technique I can reproduce the described behaviour very consistently.

So maybe this helps to debug?

  1. Open a file that is commited to VCS
  2. Write a new line: new MalformedParameterizedTypeException();
  3. Notice on the left a green mark that there is a new added line
  4. Click on the green mark and undo the changes
  5. The now unused import of MalformedParameterizedTypeException will stay

from intellij-plugin-save-actions.

dubreuia avatar dubreuia commented on July 20, 2024

Thanks for the information @sniffertine. It is similar to the fact that the plugin triggers only once per file. I'm pretty sure intellij keeps a list of dirty files, and removing a line from VCS (green square on the left) probably doesn't make the file dirty. No sure it is a save action bug in that case.

from intellij-plugin-save-actions.

sniffertine avatar sniffertine commented on July 20, 2024

I don‘t know if thats an auto save bug. There is definitely a file saved to the FS, but if IntelliJ doesn‘t trigger an event for plugins you cannot do much indeed.

Maybe you could subscribe to VFS changes using an event listener and be notified on more detailed file events that the usage of FILE_DOCUMENT_SYNC through message bus.
--> https://www.jetbrains.org/intellij/sdk/docs/basics/virtual_file_system.html#virtual-file-system-events

from intellij-plugin-save-actions.

dubreuia avatar dubreuia commented on July 20, 2024

Might be fixed by #207, reopen if necessary

from intellij-plugin-save-actions.

dubreuia avatar dubreuia commented on July 20, 2024

Released in https://github.com/dubreuia/intellij-plugin-save-actions/releases/tag/v1.3.0

from intellij-plugin-save-actions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.