Language API: Reparse not triggered after modifying ASTNodes?
Hi, I'm making some changes to ASTNode tree of custom language, and it looks
like reparse isn't triggered until I type in the editor. This is latest build,
3526. Do I need to somehow commit these changes?
Please sign in to leave a comment.
Hello Keith,
I'm not sure I understood correctly, but yes, reparse will not happen until
there are modification done to the text directly. Making changes directly
modifies parse tree so there's no need to reparse.
-
Maxim Shafirov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
I believe the annotator is not re-executed and the document is not
re-lexed when modifying AST. Modifying the PSI tree in a certain way
(accidentally) introduced a lexer-level syntax error in my tree, and I
didn't notice that the tree was invalid myself, so I went hunting for a
bug that wasn't there. Is there some solution you can think of for this?
I don't think it's right to assume AST will be modified in correct way.
Or maybe I'm looking at the situation wrong?
Maxim Shafirov wrote:
>> Hi, I'm making some changes to ASTNode tree of custom language, and it
>> looks like reparse isn't triggered until I type in the editor. This is
>> latest build, 3526. Do I need to somehow commit these changes?
>>
Hello Keith,
Nope, those should be relaunched.
No way you should do that. In other words all tree-level modifications should
leave that tree in state exactly equal to what you'll get if you parse the
text from the scratch.
-
Maxim Shafirov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Maxim Shafirov wrote:
>> introduced a lexer-level syntax error in my tree, and I
>> didn't notice that the tree was invalid myself, so I went hunting for
>> a bug that wasn't there.
I'm sorry, do you mean "should" in the sense like "you are expected to
leave the tree in a good state" or do you mean it like "IDEA will ensure
that the tree is left in a good state"?
Hello Keith,
Yep, you're expected to leave the tree in consistent state. IDEA will not
ensure that for you.
-
Maxim Shafirov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
>>> introduced a lexer-level syntax error in my tree, and I
>>> didn't notice that the tree was invalid myself, so I went hunting
>>> for
>>> a bug that wasn't there.
>> No way you should do that. In other words all tree-level
>> modifications should leave that tree in state exactly equal to what
>> you'll get if you parse the text from the scratch.
>>