panel icon indicating copy to clipboard operation
panel copied to clipboard

Change in annotations behaviour of CodeEditor for panel >1.7.0

Open SBlokhuizen opened this issue 6 months ago • 2 comments

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. This question was first posted to the discourse, but I was asked to create a bug report instead.

Example videos showcasing the annotations behaviour between two panel versions:

panel == 1.6.3

panel == 1.6.3

panel == 1.7.1

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()

SBlokhuizen avatar Jun 05 '25 07:06 SBlokhuizen

This issue has been mentioned on HoloViz Discourse. There might be relevant details there:

https://discourse.holoviz.org/t/change-in-annotations-behaviour-of-codeeditor-for-panel-1-7-0/8801/3

holovizbot avatar Jun 05 '25 07:06 holovizbot

Thanks for the issue. We upgraded the version of Ace and that likely caused this regression. Will have to investigate if it can easily be reversed.

philippjfr avatar Jun 05 '25 11:06 philippjfr