DPF-Widgets icon indicating copy to clipboard operation
DPF-Widgets copied to clipboard

Add setLanguageDefinition to the text editor

Open TristanCacqueray opened this issue 6 months ago • 3 comments
trafficstars

This change enables changing the language definition.

TristanCacqueray avatar May 11 '25 08:05 TristanCacqueray

Hello, first time contributor to DISTRHO, hope that's ok to make such PR!

TristanCacqueray avatar May 11 '25 08:05 TristanCacqueray

Too bad there are only a few languages available: https://github.com/DISTRHO/DPF-Widgets/blob/main/opengl/DearImGuiColorTextEditor/TextEditor.h#L185-L191

But I did a quick test by modifying the test. Might be worth to add:

win.editor.setLanguageDefinition(TextEditor::LanguageDefinition::Lua());

or something, to show how it's used.

dromer avatar May 11 '25 08:05 dromer

I see, thanks! In my project, I used an existing definition and changed its name like that:

        auto ldef = TextEditor::LanguageDefinition::HLSL();
        ldef.mName = "UZU";
        setLanguageDefinition(ldef);

TristanCacqueray avatar May 11 '25 09:05 TristanCacqueray