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

Playground: Add Copy as pyproject.toml/ruff.toml and paste from TOML #13328

Merged
merged 1 commit into from
Sep 13, 2024

Conversation

MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Sep 11, 2024

Summary

This PR extends our playground so that you can paste a pyproject.toml or ruff.toml configuration into the settings panel and
it automatically converts it to the JSON configuration.

This PR also adds a Copy as pyproject.toml and Copy as ruff.toml action that converts the JSON configuration to a TOML confguration.

The motivation for extending the playground is that it makes it easier to try out configurations provided by users and to share configurations verified in the playground in a format that's familiar to users.
I considered changing the settings a TOML file instead. However, monaco has no autocompletion or schema support for TOML files, which means that switching to TOML would lead to a worse overall editing experience.

The pasting could be "nicer" because the implementation let's monaco handle the paste and then replaces the pasted content if it is a TOML setting.
Users can see how the content change. I spent quiet a bit of time trying to figure out if there's a more official way of handling
pasting from the clip board in monaco and customizing the behavior by either overriding the standard paste operation or
adding a cutom paste action but was unsuccessful. That's why I ultimately went with the solution in this PR.

Test Plan

Screen.Recording.2024-09-11.at.14.47.42.mov

@MichaReiser MichaReiser added the playground A playground-specific issue label Sep 11, 2024
@MichaReiser MichaReiser force-pushed the micha/playground-copy-paste-toml branch from a2d7185 to d6dc2c2 Compare September 11, 2024 18:49
@MichaReiser MichaReiser merged commit 21bfab9 into main Sep 13, 2024
20 checks passed
@MichaReiser MichaReiser deleted the micha/playground-copy-paste-toml branch September 13, 2024 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
playground A playground-specific issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant