heynote icon indicating copy to clipboard operation
heynote copied to clipboard

Add a default language setting

Open flolbr opened this issue 2 years ago • 4 comments

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.

This fixes #61

flolbr avatar Jan 02 '24 14:01 flolbr

I would wait to merge #85 before merging this, so it can already be up to date with the various block creation possibilities. Maybe also #102 in order to unify the settings.

flolbr avatar Jan 02 '24 18:01 flolbr

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 Ctrl-A Backspace) to change its language back to the default. Therefore, I think we should make sure that we revert back to the default - instead of always text - to resolve the issue of blocks getting reverted back to Plain Text (if that is the issue, I haven't confirmed it).

heyman avatar Jan 04 '24 15:01 heyman

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 ?

flolbr avatar Jan 10 '24 13:01 flolbr

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 Ctrl-A Backspace) I think it makes sense that the block reverts back to the default mode immediately (for auto blocks that is).

heyman avatar Jan 11 '24 00:01 heyman