posit-dev / positron

Positron, a next-generation data science IDE
Other
2.26k stars 67 forks source link

Set default (or persist previous) language for a project #4028

Closed andrewheiss closed 1 month ago

andrewheiss commented 1 month ago

Related to #4011 and #3575, a feature that lets users set the default language interpreter for a project could be nice. I keep finding that when I open R-only projects, the R and Python terminals both start up (which is fine), but 90% of the time, the Python console remains active and I have to switch it in the Console pane (either manually or by executing a line of R code from the editor).

For instance, here I have a folder named positron-r that contains test.R. When I start Positron, the Python console is active. I can switch it just fine, but the switch isn't persistent.

https://github.com/user-attachments/assets/8a880c95-4c43-44b5-ac8e-e4835199c3a9

I'm looking ahead to eventually teaching with Positron and I worry that having the Python console consistently open will confuse new R students.

jennybc commented 1 month ago

Loosely related to my sense that we need a way, externally and internally, to detect or declare whether something is an R project or a Python project, where these are not mutually exclusive, which is somewhat related to #2637.

MikeJohnPage commented 1 month ago

Could positron use a .positron file in the root of the project folder to store this information, similar to .Rproj.user?

@andrewheiss as a temporary work-around, I've found that if the incorrect interpreter is started, if it is immediately shut down, it does not restart next time the project is opened.

jennybc commented 1 month ago

Could positron use a .positron file in the root of the project folder to store this information, similar to .Rproj.user?

Side comment: I think what you really mean is the .Rproj file, not .Rproj.user. But I know what you're getting at.

There have been internal discussions along the way about having such a file, which is also quite advantageous for project discovery/access via tools like Alfred. But the current thinking is that Positron will not necessarily place a file or folder along these lines.

MikeJohnPage commented 1 month ago

Sorry, yes you are quite right, that is what I meant :)

Perhaps a simpler solution is for Positron to just expose a workspace setting?

jennybc commented 1 month ago

Well, yes, if you set any workspace-specific configuration, it will cause a .vscode/settings.json to appear in the folder. But at this point we are not committed to necessarily, i.e. always, placing such a file.

andrewheiss commented 1 month ago

Does (or could?) Positron have an exposed setting for a default interpreter, similar to "python.defaultInterpreterPath"? It could be included either in .vscode/settings.json or in a workspace file like whatever.code-workspace, and then be project-specific

image
jmcphers commented 1 month ago

I keep finding that when I open R-only projects, the R and Python terminals both start up (which is fine), but 90% of the time, the Python console remains active and I have to switch it in the Console pane (either manually or by executing a line of R code from the editor).

We do plan to make this better (independent of any work to let you specify the default interpreter in a settings file). It's tracked in https://github.com/posit-dev/positron/issues/1044 and https://github.com/posit-dev/positron/issues/3432.

juliasilge commented 1 month ago

We believe this request is covered in #1044 and #3432.