Transfrom languages to use the base property#3991
Conversation
719a1d9 to
9008d86
Compare
1dc8e3a to
f57da32
Compare
9008d86 to
d1f28a5
Compare
896c34d to
b4ee0c1
Compare
| delete actionscript['parameter']; | ||
| delete actionscript['literal-property']; | ||
| delete base!['parameter']; | ||
| delete base!['literal-property']; |
There was a problem hiding this comment.
Won't this delete these from the actual base language, rather than this one?
There was a problem hiding this comment.
Also, can we somehow tell TS that if the language has a base property, then base is not null so we don't have to use base! everywhere?
There was a problem hiding this comment.
Won't this delete these from the actual base language, rather than this one?
Nope, we pass a clone of the base language as the value of base. See line 173 in #3990 (the base PR):
const baseGrammar = base && cloneGrammar(required(base.id), base.id);There was a problem hiding this comment.
Also, can we somehow tell TS that if the language has a
baseproperty, thenbaseis not null so we don't have to usebase!everywhere?
It bothers me as well. I'll take a closer look.
|
Thanks. Let's see what your TS research brings up.
|
3d72787 to
1718c95
Compare
16bdae7 to
c2b8d73
Compare
04a6940 to
51f75ea
Compare
Okay, I seem to have found a way to distinguish (on the level of TS) between cases where a language definition has a
Can't think of any. But there are a couple of languages where the |
There are some. For example, In Line 109 in 31b467f In |
Some observations. The However, after I transformed the language to use the |
Yay! Though this complexity makes me wonder once more whether we should consider switching back to JS + JSDoc. We keep spending time jumping through TS hoops. I’m also worried how the TS rewrite will affect performance, since it's a fairly significant abstraction.
They shouldn't have to. Returning |
I wonder if we end up accidentally modifying an existing object when we think we're working with a clone. |
I also think we might. However, I can't pinpoint exactly where it happens—something to explore in the next iteration. |
58a4b88 to
a9e1af3
Compare
✅ Deploy Preview for dev-prismjs-com ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
a9e1af3 to
a6003f1
Compare
a6003f1 to
eb97fb9
Compare
This is part 2 of 2 in a stack made with GitButler:
baseproperty #3991 👈simplifybranch #3990