codemirror / dev

Development repository for the CodeMirror editor project
https://codemirror.net/
Other
5.94k stars 377 forks source link

python highlighting fails with initial blank line or comment #1397

Closed leeharr closed 2 months ago

leeharr commented 4 months ago

Describe the issue

Codemirror 6, very basic setup with python highlighting.

Everything works fine, unless the first line is blank or a comment.

If the first line is a comment, that line is highlighted, but the rest of the text is rendered plain. If the first line is blank, none of the text gets highlighted.

Browser and platform

No response

Reproduction link

No response

marijnh commented 4 months ago

If I try to reproduce this, I don't see the issue.

leeharr commented 4 months ago

Ok. I'm not using the module method. I have a bundle.js that I built following the steps in codemirror-quickstart [https://github.com/RPGillespie6/codemirror-quickstart].

Maybe I need to learn how to use the module method.

Thanks for looking at this!

leeharr commented 4 months ago

I'm starting to understand this more now.

This Try Codemirror gives a better description of what I actually have.

I just copied the editor.js from the bundle building instructions and changed the one thing (javascript for python) and added a bit at the bottom to display the editor in the document.body for Try.

Unfortunately (or fortunately) comments are working fine in the Try Codemirror.

Any hints as to why it would not work the same when the bundle is loaded into my app?

marijnh commented 4 months ago

I really don't know what could cause this. Without a way to reproduce it I don't think I can help much.