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

why only focus document can be used save actions? version 0.7 #30

Closed
myoss opened this issue Feb 22, 2016 · 7 comments
Closed

why only focus document can be used save actions? version 0.7 #30

myoss opened this issue Feb 22, 2016 · 7 comments
Assignees

Comments

@myoss
Copy link

myoss commented Feb 22, 2016

before upgrade to version 0.7, i used version 0.4, the can auto format all modified file (before do make/debug/other things), today i upgrade to version 0.7 and debug the source code, now why only focus document can be used save actions? when do make/debug can not used

@Override
public void beforeDocumentSaving(@NotNull Document document) {
    if (!SaveAllAction.TRIGGERED && isDocumentActive(document)) {
        LOGGER.debug("Document " + document + " is still active, do not execute");
        return;
    }
    for (Project project : ProjectManager.getInstance().getOpenProjects()) {
        PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document);
        if (isPsiFileEligible(project, psiFile)) {
            processPsiFile(project, psiFile);
        }
    }
}

----------------Environment Version----------------
save actions plugin version 0.7
intellij idea version 15.0.3

@dubreuia
Copy link
Owner

Thanks for the issue. I'll check out if I can support both (1) reformat only the focus document (2) reformat all modified documents.

tl;dr: It's a side effect of #13

Long explanation: to fix #1, I need to make sure to reformat only the file that is opened in the current intellij (there can be multiple instances), but I can't check on file path since it breaks #13, so I'm using the current file focus to see if I need to reformat or not. It might work better if I use the current project focus instead.

@dubreuia dubreuia self-assigned this Feb 23, 2016
@dubreuia
Copy link
Owner

I might just add an option "Reformat only focus document" so I'm marking that as an enhancement since 0.7 is working as I want it to work.

@myoss
Copy link
Author

myoss commented Feb 24, 2016

I'm looking forward to it.

@sbmpost
Copy link

sbmpost commented Mar 3, 2016

@dubreuia: hi there, you may want to take a look at some code I posted here: http://stackoverflow.com/a/35727193
It solves some problems (locked files, not being able to undo, and handling multiple files).

@dubreuia
Copy link
Owner

dubreuia commented Mar 7, 2016

I like the make project / compile file options, I might steal your idea. Not sure I can use the multiple files handling part but I'll try. I'll certainly use the part on the undo and the locked files. Thanks a lot I'll keep you posted!

@sbmpost
Copy link

sbmpost commented Mar 9, 2016

You are welcome to steal ;-), thanks for working on this

@dubreuia
Copy link
Owner

dubreuia commented May 5, 2016

Corrected that behavior in 0.8. It should work as in 0.4, but works with multiple open instances too

@dubreuia dubreuia closed this as completed May 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants