[editor] set manually JSON language

Hi,

I am the author of the mongo plugin and I succeeded to open mongo results in a editor tab (like any source file) thanks for the tips.

For Ultimate Edition users, JSON files are supported so I would like the mongo query editor to have the same behavior that a classical JSON file editor

I attach the JSONHighlighter in this way :

private void attachHighlighter(final EditorEx editor) {
    EditorColorsScheme scheme = editor.getColorsScheme();
    scheme.setColor(EditorColors.CARET_ROW_COLOR, null);
    editor.setHighlighter(createHighlighter(scheme));
}

private EditorHighlighter createHighlighter(EditorColorsScheme settings) {
    Language language = Language.findLanguageByID("JSON");
    if (language == null) {
        language = Language.ANY;
    }
    return new LexerEditorHighlighter(PlainTextSyntaxHighlighterFactory.getSyntaxHighlighter(language, null, null), settings);
}


It is incomplete and the question is : how to programmatically bind CodeFolding, CodeCompletion and other features to the editor?

editor_settings.png

Thanks,

David

Please sign in to leave a comment.