boltex / leojs

Leo Literate Editor with Outline in Typescript
https://boltex.github.io/leojs/
MIT License
34 stars 2 forks source link

Support text wrap and honor the @wrap directive #112

Closed boltex closed 10 months ago

boltex commented 10 months ago

Since there's no way to change / open a document with wrap already turned on, (other than the generic command the toggles wrap on the currently selected editor), another way to do it would be to define a 'wrapped' language to mirror each supported language by LeoJS , and, have the extension make sure at startup that the user's settings contain a specific entry for those languages to have editor.wordWrap set to true. (loop for each of LeoJS languages bodyPlain -> bodyPlainWrap, bodyC - > bodyCWrap, etc... )

And upon checking for language when refreshing the states of a body pane, the 'wrap' state will affect the chosen language. (language will now have the 'wrap' state embedded in them)

    const config = vscode.workspace.getConfiguration();
    const languageWrapSetting = config.inspect('[your-language].editor.wordWrap');

    // Check if the user has already set a preference
    if (!languageWrapSetting || !languageWrapSetting.globalValue) {
        config.update('[your-language]', { 'editor.wordWrap': 'on' }, vscode.ConfigurationTarget.Global);
    }
boltex commented 10 months ago

This should be tracked in https://github.com/boltex/leointeg/issues/224 also.