Adding a new filter predicate
FilterChain.kt is the place.
- Add a new
EntryPredicateimplementation:class ChatIdPredicate(private val chatId: String) : EntryPredicate { override fun accepts(entry: LogEntry, formatted: String): Boolean { if (chatId.isEmpty()) return true val el = entry.fields["chat_id"] ?: return false return el.asString == chatId } } - Add session state: extend
JsonlSessionwith the new filter value. - Include it in
JsonlRebuilder’s chain construction (conditionally, keyed on whether the value is the sentinel “inactive” value). - Update
isFilterActive()to account for the new filter. - Add UI in
JsonlEditor.installToolbar()— either aComboBoxAction(likeTargetSelectorAction) or aSearchTextField-style control. - Persist it in
JsonlFileEditorState+ provider’sreadState/writeState. - Add a test in
JsonlRebuilderTest.
Adding a new highlight colour
- Declare the key in
JsonlColors.kt:val SPAN_ID: TextAttributesKey = TextAttributesKey.createTextAttributesKey( "JSONL_SPAN_ID", DefaultLanguageHighlighterColors.METADATA ) - Register it with the Color Scheme page — add an
AttributesDescriptorinJsonlColorSettingsPage.ktand a tag ingetAdditionalHighlightingTagToDescriptorMap(). - Have the Formatter emit a range for the token (add a new
IntRange?onFormattedLine, populate it inFormatter). - Teach
HighlightSpanBuilder.collectLineSpansto emit a span for the new range with the new key.
No markup-model changes needed — the sidecar highlighter picks up the new span type automatically.
Adding support for a new log format
Usually a pure configuration change: Settings → Tools → JSONL Log Viewer → Field mapping. Use dotted paths. See the Field-mapping reference for canonical examples.
If your format has exotic semantics (timestamps in an unusual encoding, severity as a number rather than a string, etc.), you may need to extend LogEntryParser.parseInstant or introduce an alias table for severity levels. Both are localized to small pieces of LogEntryParser.kt.
Adding a new per-file state field
- Add a
vartoJsonlFileEditorStatewith a default value. Primitives and enums serialize natively; other types need areadState/writeStatecontribution. - Write the value in
JsonlEditor.getState(), apply it inJsonlEditor.setState(). - Add attribute serialization in
JsonlSplitEditorProvider.writeState/readState.
Adding a new settings toggle
- Add a
vartoJsonlSettings.Statewith a default. - Expose in
JsonlConfigurable.createPanel()(one-linerow { checkBox(...).bindSelected(state::name) }). - Consume wherever relevant — usually in
HighlightSpanBuilder(if it affects rendering) orJsonlRebuilder’s use ofFormatConfig.