Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to connect to php parser in netbeans platform

I am writing a code completion plugin for a PHP library in Java / Netbeans Platform. I need to find a way to obtain a reference to one of the PHP modules so I can interpret part of the source, anyone experience with this kind of problem?

  • How do I obtain a reference to the PHP module (for code completion plugin module)
  • What is the recommended approach to integrate a code completer with PHP module on the NetBeans platform?

Cheers and thanks in advance Gabor

like image 755
Gabor de Mooij Avatar asked May 22 '12 19:05

Gabor de Mooij


1 Answers

You would use the org.netbeans.modules.php.api and some other core stuff and implement a new CompletionProvider. (MyCompleter implements CompletionProvider)

import org.netbeans.modules.php.api.phpmodule.PhpModule;
import org.netbeans.modules.php.api.util.UiUtils;
import org.netbeans.modules.php.api.executable.PhpInterpreter;

and maybe Tokenizer and Completion could be usefull

Tokenizer

import org.netbeans.api.lexer.Token;
import org.netbeans.api.lexer.TokenSequence;

Completion

import org.netbeans.spi.editor.completion.CompletionProvider;
import org.netbeans.spi.editor.completion.CompletionResultSet;
import org.netbeans.spi.editor.completion.CompletionTask;
import org.netbeans.spi.editor.completion.support.AsyncCompletionQuery;
import org.netbeans.spi.editor.completion.support.AsyncCompletionTask;
like image 141
Jens A. Koch Avatar answered Oct 21 '22 10:10

Jens A. Koch