Closed StoneCypher closed 2 years ago
I was hoping to ask for help? I can't find a discord or an irc channel, and I'm not sure what to do next.
There's a forum for this kind of thing.
Language tests tend to test for parse structure. In-editor highlighting also requires highlight tags to be set up correctly. Do the names in your styleTags
call match the node names in the syntax tree? Are you actually using any of those styled nodes in your test editor?
Do the names in your styleTags call match the node names in the syntax tree?
They do.
Are you actually using any of those styled nodes in your test editor?
Yes.
In case someone else finds this, the problem was simple. CodeMirror only highlights the topmost, exposed rule.
Unfortunately, my language needs a superior rule to disambiguate between barewords and keywords, which in my highlighter is called "Chain," so I don't know how to highlight the things it's made from. If I assign a color to Chain
it works as expected. The problem was that I was trying to highlight String
, Atom
, Arrow
, and so on, and the editor isn't distinguishing those.
As far as I can tell, the things beneath the top level production aren't actually exposed, even if they're capitalized. I don't really understand how that can be the case; I would have expected it to highlight all the way down through the rule to its subordinate pieces, so that an expr could have strings and numbers inside, or what have you.
Hm. It seems like it ought to be, but also, I'm not able to make that work out.
I did as you asked, and made a forum thread (although I see you responded there as well.) I'll consolidate there.
I'm trying to create an FSL language plugin for CodeMirror.
I have a decent set of test cases that cover the basic common sense first steps of the language. It appears to parse happily, and the way that I expect.
I was trying to add a demo editor. The editor itself works: it has the characteristic CodeMirror appearance, the line highlight moves with the cursor, braces and parentheses match, et cetera.
However, it's treating the text as if it was plain text. The language itself isn't being invoked.
I do not believe that it's a question of the language being recognized and going unstyled. In the browser inspector, in j mode, there are spans in common sense places to apply styling. There are none where I'd expect for my language; only rows.
I believe the editor invocation is correct because if I install the j language plugin and switch to that, J code highlights as expected.
It's not clear to me what I could do wrong, that the test cases would pass, but a working editor would not adopt my language plugin.
I've done my best to stay within the vanilla guidelines of your lang example. Most of the code is unchanged, and the grammar is currently very simple.
There are no errors in the console.
All three of these breakpoints land:
I was hoping to ask for help? I can't find a discord or an irc channel, and I'm not sure what to do next.