Change in annotations behaviour of CodeEditor for panel >1.7.0

For an application I am developing I would like to have strict control over the annotations of a CodeEditor object. I seems that with the new minor release (v1.7.0), the internal code editors annotations take precedence over the set annotations.

Example videos showcasing the annotations behaviour between two panel versions:

panel == 1.6.3

panel == 1.7.1

Is there a way to disable this overwriting of annotations? Thanks!

The following minimal example was used in the videos above:

import panel as pn

pn.extension("codeeditor")

code = """test:
- {a: 1, b: 2}
- {c: 3, d: 4}
- {e: 5, f: 6}
"""

editor = pn.widgets.CodeEditor(
    value=code,
    language="yaml",
    width=300,
    annotations=[],
)


def add_annotations(event):
    editor.annotations = [
        {"row": 1, "column": 0, "text": "a warning", "type": "warning"},
        {"row": 2, "column": 0, "text": "an error", "type": "error"},
    ]


button = pn.widgets.Button(name="Add Annotations")

button.on_click(add_annotations)

pn.Row(editor, button).servable()

It’s likely a bug. Can you create a bug report on GitHub?

Thanks for your reply, I have created an issue here