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?

5 comments

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!"

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?



0

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:

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!"

>> 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?
>>


0

Hello Keith,

I believe the annotator is not re-executed and the document is not
re-lexed when modifying AST.

Nope, those should be relaunched.

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.

-


Maxim Shafirov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


0

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.


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.


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"?

0

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!"

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.
>> 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.
>>

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"?



0

Please sign in to leave a comment.