cweagans / theforce

(DEPRECATED) An autocomplete library for PHP
18 stars 3 forks source link

Introduction

Build Status Gratipay

The Force is an autocompletion tool for PHP. It sort of works right now, and it's not very fast. It's more of a work in progress.

Eventually, I hope to get The Force to the point of feature parity with Jedi, the autocompletion library for Python.

I'll also be integrating this library with ycmd when it gets to the point of usefulness.

Architecture

The Force is essentially a socket server that can be directed by JSON commands from a code editor. It behaves very similarly to Omnisharp in that regard.

Code editors should be responsible for starting and stopping the server, as well as sending commands to it. Pretty much all of the command handling is built in the Dispatcher component, and it's all pretty straightforward.

Configuration

If you have a project with more than one directory where you want the parser to discover PHP files, or you want to use a custom filemask to tell the parser what is PHP and what isn't, you'll need to create a config file. These config files are very straightforward, and can look something like this:

paths[] = /Users/cweagans/Documents/Code/drupal
paths[] = /Users/cweagans/Documents/Code/my-other-directory
mask = "/^.+\.(php|inc|module|install)$/i"

The default behavior is to look for anything ending in .php. The regex above should be appropriate for most Drupal installations, though some tweaking may be necessary for your specific project. Note that if you have spaces or any weird characters in your paths, you may need to wrap them in double quotes.

Contributing

Pull requests, questions, comments, or suggestions are all very welcome. I want this library to be as awesome as possible, and your help could make it happen.

In particular, if you're a Python developer, I'd love some help on integration with YCMD.

Note that while the goal of this project is to provide fantastic PHP autocomplete functionality, I'm not at all interested in supporting plugins for individual editors. If you want code completion, you should integrate with YCMD instead, as that's the end-goal for this library as well.

Similar Projects

PHPCodeIntel works in a pretty similar manner to this project. Unfortunately, there were a lot of design decisions in that project that I'm not a fan of, so I'm building the tool that I want.

Known issues

Roadmap

These are the things I want to do, roughly in order of when I'm going to do them:

FAQ