How to control the execution sequence of parser and completion extension points when modifying a file

Answered

Hello,

I have implement parserDefinition and CompletionContributor these tow extension point . I found the parser extension point will excute before the completion extension point ,But now I am going to implement completion on the server that is not depend on AST. When the current document is large , the parse operation takes a lot of time and block the completion operation.As a result, the completion operation takes a longer time. How can I control the parserDefinition extension poniter not executed or executed after completion extension point?

<completion.contributor language= "ExtendJavaScript" className = "com.xxx.ExtendJavaScriptCompletionContributor">

<lang.parserDefinition language = "ExtendJavaScript" implementionClass="com.xxx.ExtendJavaScriptParserDefinition" 

Thank you!

0
3 comments

CompletionContributor requires PSI to be built, so parser must finish first. Parser must never "take a lot of time", as most features in IDE including highlighting will depend on its performance.

0

Hello, Yann Cebron

Thank you for answering this! In my situation, completion is implemented by language server which depend on source file(provided by typescript,like AST) ,my client is based on intellij platform and lsp4intellij , AST is only used for formatting and highlighting ,so parsing is not required for completion in my situation . Is there any API or method help change the execution order of extension points ,Or can I  do that by modifying intellij-community source code?

0

I'm afraid there is no ready-made solution for this. Technically, one could evaluate and patch IJ Platform itself, but this would surely be a huge and complex task.

0

Please sign in to leave a comment.