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

Disable preview of csproj files / select default mode #2273

Open
puschie286 opened this issue Sep 30, 2024 · 7 comments
Open

Disable preview of csproj files / select default mode #2273

puschie286 opened this issue Sep 30, 2024 · 7 comments
Labels
intellij Issues related to the Jetbrains plugin type: feature New feature or request

Comments

@puschie286
Copy link

puschie286 commented Sep 30, 2024

The main purpose of opening a csproj file is to manual edit something - the preview mode is not useful most of the time, its just adds an additional click to change the view mode to "Editor". Please make the default mode "Editor" or add an configurable option for this.

Current Behavior

csproj files are always open in "Editor and Preview" mode.

Expected Behavior

csproj files should open in "Editor" mode.

Steps to Reproduce

  1. Open a csproj file

Environment

JetBrains Rider 2024.2.5

@puschie286 puschie286 added the type: bug Something isn't working label Sep 30, 2024
@MaxKless MaxKless added type: feature New feature or request intellij Issues related to the Jetbrains plugin and removed type: bug Something isn't working labels Oct 1, 2024
@MaxKless
Copy link
Collaborator

MaxKless commented Oct 1, 2024

Hmmm okay I see the point to have this configurable. I can think of some solutions, what do you think about this?

  • Have a global setting to toggle the preview mode to always Editor or always Editor and Preview by default
  • Have a more complicated settnig where you can specify globs to match files that should open as Editor or Editor and Preview
  • Remember the every manual expansion / closing of the editor. So when you go from Editor and Preview to just Editor once, it will remember that choice and stick with Editor the next time.

The last one requires no manual configuration so it's probably best.... You will just need to close the PDV preview once and then it won't open by itself anymore.

@puschie286
Copy link
Author

The last option sounds like the most intuitive behavior to me. In the edge case of having multiple csproj files open and changing a single of them to another mode, it might feels like an bug.

So a complete solution could be an combination of the last two points. Therefore the option 'project file view mode' should consist of 4 entries: "Editor", "Editor and Preview", "Preview" and "Last used mode". The "Last used mode" should probably be the default

This should would cover all possible cases of usage i can think of

@MaxKless
Copy link
Collaborator

MaxKless commented Oct 1, 2024

#i would save the last opened editor state by file path so you can have individual preferences per file, even different ones for multiple .csproj files. That way no extra setting would be required, it can all be saved in the background.

@puschie286
Copy link
Author

puschie286 commented Oct 1, 2024

Well, how would i set the default mode ? (or change it later on).
I think that is the main use case.

If you dont want to add an option (which seems the most clean solution to me), please make the last selection the global state - file specific state would not add much help to the current situation when you may have 100+ projects in your mono repo and need to edit a few now and then

@MaxKless
Copy link
Collaborator

MaxKless commented Oct 1, 2024

Yeah that's a good point, adding a default mode setting is a good idea, let's do it!
Would you be interested in contributing here? It shouldn't be too difficult and I can help point you to the right places :)

@puschie286
Copy link
Author

Yeah, i will try it - but it will probably take me some days as my schedule is pretty tight.

Thanks for the offer, i will come back to you if I have any problems :)

@MaxKless
Copy link
Collaborator

MaxKless commented Oct 1, 2024

no worries, I look forward to what you cook up :)
Have a look at the apps/intellij/src/main/kotlin/dev/nx/console/settings folder for previous art on building a setting.
You'll need to look into the Kotlin UI DSL to build the setting form fields.
You'll probably need to use the PropertiesComponent class to save the last used state information in a local file in the .idea folder.
You can read the setting & last opened state in apps/intellij/src/main/kotlin/dev/nx/console/project_details/ProjectDetailsEditorWithPreview.kt where the initial layout is set.

Hope that helps :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
intellij Issues related to the Jetbrains plugin type: feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants