-
Notifications
You must be signed in to change notification settings - Fork 203
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 a default language setting #112
base: main
Are you sure you want to change the base?
Conversation
ecb1609
to
f7d4b41
Compare
This commit introduces the ability to set and use a default programming language for new editor blocks. Key changes include: - Adding a sorted list of languages and a `defaultLanguage` setting in the configuration. - Propagating the `defaultLanguage` setting to relevant components and functions. - Enabling users to select and update the default language in the settings UI.
f7d4b41
to
084ba28
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I test this, it's not woking for me. It seems like the the block immediately changes back to Plain Text (auto)
. IIRC there might be some code that automatically resets an auto-block to text-a
if the content is empty.
Maybe it would make sense to also include a setting for if new blocks should have auto detection turned on?
Maybe also #102 in order to unify the settings.
I've merged #102 where I also added an Editing tab in the settings, as well as some tests. This PR should get some tests as well.
@@ -1,5 +1,36 @@ | |||
import Store from "electron-store" | |||
|
|||
let sortedLanguages = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we build this list from src/editor/languages.js
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to, but ended up having issues because the editor
subdirectory belongs to the view, whereas the config is the electron side. Ideally, the way I would want it to work is to do a static generation at build time, like I did for the README/initial-content.
As for the text reverting back to plain text, I guess we could only append -a
at the end of a new block if the default language is set to Plain Text.
I think it makes sense to be able to change the default mode for newly created blocks but still have auto-detection turned on for them (but we should have a setting for this). I also think it makes sense for an auto block that is emptied (e.g. uses presses |
Isn't the issue that it reverts to Plain Text too early, while there aren't enough characters for the "syntax matcher" to work properly ? |
When a block is "cleared" (e.g. the user press |
This commit introduces the ability to set and use a default programming language for new editor blocks. Key changes include:
defaultLanguage
setting in the configuration.defaultLanguage
setting to relevant components and functions.This fixes #61