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

Add support for Rider #310

Open
dubreuia opened this issue Apr 6, 2020 · 21 comments
Open

Add support for Rider #310

dubreuia opened this issue Apr 6, 2020 · 21 comments

Comments

@dubreuia
Copy link
Owner

dubreuia commented Apr 6, 2020

See #18 : Rider (settings OK - reformat KO)

@heschtag
Copy link

This would be amazing. The only issue I've had with Rider is that I can't use a plugin like this.

@dubreuia dubreuia added the next label Apr 23, 2020
@giuliano-barberi-tf
Copy link

@van800 any chance you could issue a PR with that workaround you mentioned in the other issue so this will work on Rider? It's definitely a huge missing gap that we don't have format on save on Rider. Thanks!

@dubreuia
Copy link
Owner Author

dubreuia commented Jun 1, 2020

I've just tested in Rider, the plugin is called, the reformat is called, but nothing happens.

1328 2020-06-01 13:33:40,851 | INFO  | SaveActionManager              | [+] Start SaveActionManager#beforeAllDocumentsSaving
1329 2020-06-01 13:33:40,851 | INFO  | SaveActionManager              | Locating psi files for 1 documents: [DocumentImpl[file:///home/alex/Projects/rider-test/rider-test/ClassLibrary1/Class1.cs]]
1330 2020-06-01 13:33:40,851 | INFO  | SaveActionManager              | Processing Project (name=rider-test, containerState=ACTIVE, componentStore=/home/alex/Projects/rider-test/rider-test)  files [CSharpFile] mode saveAll
1331 2020-06-01 13:33:40,851 | INFO  | SaveActionManager              | Valid files [CSharpFile]
1332 2020-06-01 13:33:40,851 | INFO  | SaveActionManager              | Start processors (7)
1333 2020-06-01 13:33:40,851 | INFO  | SaveActionManager              | Filtered processors [reformat]
1334 2020-06-01 13:33:40,851 | INFO  | SaveActionManager              | Execute command reformat on 1 files
1335 2020-06-01 13:33:40,852 | INFO  | SaveActionManager              | Exit engine with results [reformat:OK]
1336 2020-06-01 13:33:40,853 | INFO  | SaveActionManager              | End SaveActionManager#beforeAllDocumentsSaving

@bobvandevijver
Copy link

That would probably be due to the research I did earlier... See #18 (comment).

@dubreuia
Copy link
Owner Author

dubreuia commented Jun 1, 2020

I completely forgot about that discussion we had. There is also #198

@dubreuia
Copy link
Owner Author

dubreuia commented Jun 1, 2020

Wow, it is working using "Build Actions". But I'd need to detect if the IDE is Rider, disable the "Reformat" action or something, else the users will get confused as I don't expect them to read the docs for Rider specificities.

Screenshot from 2020-06-01 14-01-25
Screenshot from 2020-06-01 13-59-36

@giuliano-barberi-tf
Copy link

giuliano-barberi-tf commented Jun 1, 2020

Wow, it is working using "Build Actions". But I'd need to detect if the IDE is Rider, disable the "Reformat" action or something, else the users will get confused as I don't expect them to read the docs for Rider specificities.

I just tried that but it seems to only actually format the currently focused file

@dubreuia
Copy link
Owner Author

dubreuia commented Jun 1, 2020

Oh no

I was almost ready to push the fix. I've disabled the reformat buttons for Rider with a message. Maybe I can use data.put(VIRTUAL_FILE_ARRAY.getName(), ...); and PsiDocumentManager.getInstance(null).getUncommittedDocuments() to force the thing to operate on mutiple files. I've tried to reformat multiple files by selecting them in the explorer and it works, so I'm pretty sure we can make it work.

@dubreuia
Copy link
Owner Author

dubreuia commented Jun 1, 2020

Rider UI

Screenshot from 2020-06-01 15-29-58

@giuliano-barberi-tf
Copy link

That's awesome. The plugin also does not currently show up on the marketplace for Rider, could you include it once this is fixed?

@dubreuia
Copy link
Owner Author

dubreuia commented Jun 1, 2020

Yes, if I can make it work... I'll add it to the marketplace.

@dubreuia
Copy link
Owner Author

dubreuia commented Jun 1, 2020

I can't make it work. I've also tried with the "Code Cleanup" action, either it doesn't work, or it only works on 1 file, or it pops up a dialog.

EDIT: see code in https://github.com/dubreuia/intellij-plugin-save-actions/tree/issue_310_support_rider

dubreuia added a commit that referenced this issue Jun 1, 2020
@giuliano-barberi-tf
Copy link

Did you try using the "Silent Code Cleanup" option? The user would have to set which option to use for silent code cleanup though.

@dubreuia
Copy link
Owner Author

dubreuia commented Jun 2, 2020

Yes @giuliano-barberi-tf, unfortunately it doesn't work (works only for the current file).

@MostHated
Copy link

MostHated commented Jul 4, 2020

I, too, am interested in this for Rider. I made a small script to run rclone to make a more permanent local history style file backup but would like some additional options over just the file watcher.

@dubreuia dubreuia added this to the 2.1.0 milestone Sep 11, 2020
@dubreuia
Copy link
Owner Author

dubreuia commented Sep 11, 2020

I'm releasing a partial fix in 2.1.0, it might work for the current file. Please let me know if it does

@dubreuia dubreuia added this to testing in Save Actions - Board Sep 11, 2020
@sgaertner
Copy link

I've tested 2.1.0 in Rider (2020.2.2) using a Quick List with just the "Reformat Code" action.
Got this exception:

java.lang.ClassCastException: class com.intellij.openapi.fileEditor.impl.text.PsiAwareTextEditorImpl cannot be cast to class com.intellij.openapi.editor.Editor (com.intellij.openapi.fileEditor.impl.text.PsiAwareTextEditorImpl and com.intellij.openapi.editor.Editor are in unnamed module of loader com.intellij.util.lang.UrlClassLoader @6f7fd0e6)
	at com.jetbrains.rdclient.actions.ActionCallPolicy.getElement(ActionCallStrategy.kt:61)
	at com.jetbrains.rider.actions.RiderActionCallPolicy.getActionCallStrategy(RiderActionCallPolicy.kt:31)
	at com.jetbrains.rdclient.actions.base.FrontendActionUpdateTrait$DefaultImpls.frontendUpdate(FrontendActionUpdateTrait.kt:14)
	at com.jetbrains.rdclient.actions.base.IBackendDelegatingActionOverride$DefaultImpls.frontendUpdate(IBackendDelegatingActionOverride.kt)
	at com.jetbrains.rdclient.actions.base.BackendDelegatingAction.frontendUpdate(BackendDelegatingAction.kt:126)
	at com.jetbrains.rdclient.actions.base.BackendDelegatingAction.actionPerformed(BackendDelegatingAction.kt:92)
	at com.dubreuia.processors.BuildProcessor.lambda$static$4(BuildProcessor.java:119)
	at com.dubreuia.processors.SaveReadCommand.execute(SaveReadCommand.java:50)
	at com.dubreuia.core.component.Engine.lambda$processPsiFiles$5(Engine.java:106)

BTW: Awesome plugin! I enjoy using it in WebStorm and would love to have it in Rider as well.

@dubreuia
Copy link
Owner Author

Hey @sgaertner thank you so much for testing. I would also love to see the plugin work in Rider, but I'll have to debug more how the formatter works.

@dubreuia dubreuia moved this from testing to doing in Save Actions - Board Sep 14, 2020
@andgeno
Copy link

andgeno commented Jan 21, 2021

I'd also love to see this plugin to work in Rider. 😁

@kimpenhaus
Copy link

kimpenhaus commented Apr 18, 2021

tried latetst (v 2.2.0) with installation from disk - but can't get it work (not even for the current file) - unfortunately

image

tried also the experimental from quick list

image

would love to see this plugin working in rider

@jlKampos
Copy link

Not working for me either, instalation from disk Reformat Code

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

No branches or pull requests

9 participants