2017 © Pedro Pelรกez
 

library tenkawa-php-language-server

Language server for PHP, with powerful static analysis and type inference

image

tsufeki/tenkawa-php-language-server

Language server for PHP, with powerful static analysis and type inference

  • Tuesday, July 3, 2018
  • by tsufeki
  • Repository
  • 1 Watchers
  • 3 Stars
  • 177 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 9 Versions
  • 21 % Grown

The README.md

Tenkawa PHP Language Server

Tenkawa, (*1)

Tenkawa is a language server for PHP, with powerful static analysis and type inference engine borrowed without asking from PHPStan., (*2)

Still experimental, but should be usable. Any bug reports, feature requests, suggestions, questions are welcome., (*3)

Installation

Requires PHP >= 7.1 with pdo_sqlite extension., (*4)

For Visual Studio Code extension, see here., (*5)

Either with composer create-project (~ directory is an example):, (*6)

$ cd ~
$ composer create-project --no-dev --keep-vcs \
    tsufeki/tenkawa-php-language-server tenkawa/

Or by cloning the repo:, (*7)

$ cd ~
$ git clone https://github.com/tsufeki/tenkawa-php-language-server.git tenkawa/
$ cd tenkawa/
$ composer install --no-dev
$ cd ..

Build index of the standard library:, (*8)

$ php ~/tenkawa/bin/tenkawa.php --build-index

Now configure your client to start the server with this command to use stdio:, (*9)

php ~/tenkawa/bin/tenkawa.php

Or to connect to a TCP socket:, (*10)

php ~/tenkawa/bin/tenkawa.php --socket=tcp://127.0.0.1:12345

Features

  • โœ” Autocompletion
    • โœ” Classes/functions (also with automatic import and within doc comments)
    • โœ” Class members
    • โœ” Local variables
  • โœ” Diagnostics
  • โœ” Go to definition
  • โœ” Go to implementation
  • โœ” Hover info
  • โœ” Signature help
  • โœ” References
  • โœ” Document symbols
  • โœ” Workspace symbols
    • โœ” Classes/functions/consts
    • โœ˜ Class members (not yet)
  • โœ” Code actions
    • โœ” Import class/function
    • โœ” Fix wrong autoloaded class/namespace name
    • โœ˜ More to come...
  • โœ” Multi-root workspace
  • โœ” Snippets
    • โœ” Class/interface/trait
  • โœ” Dynamic configuration

Unimplemented (yet?):, (*11)

  • โœ˜ Go to type definition
  • โœ˜ Go to declaration
  • โœ˜ Document highlight
  • โœ˜ Document link
  • โœ˜ Code lens
  • โœ˜ Formatting
    • โœ˜ document
    • โœ˜ range
    • โœ˜ on type
  • โœ˜ Rename
  • โœ˜ Folding range

Known issues

  • Many features don't work inside traits. This is caused by PHPStan's design.
  • Refactors are not 100% bullet-proof.
  • Performance & long indexing times.

Command line options

  • --socket=<socket> - connect to a socket instead of communicating through STDIO. Allowed format: tcp://127.0.0.1:12345 or unix:///path/to/socket.
  • --log-stderr - log to stderr.
  • --log-file=<file> - log to the given file.
  • --log-client - log using window/logMessage protocol method.
  • --log-level=<level> - log only messages of the given level and up. <level> can be one of emergency, alert, critical, error, warning, notice, info, debug. Defaults to info.
  • --build-index - build standard library index instead of starting the server.
  • --config-json=<json> - default options, see Configuration. Example: --config-json={"completion":{"autoImport":false}}.

Configuration

You can pass configuration options to the server through initializationOptions parameter of initialize protocol method or by implementing workspace/configuration request and sending workspace/didChangeConfiguration notifications from client., (*12)

Recognized options:, (*13)

{
  "tenkawaphp": {
    "diagnostics": {
      "phpstan": {
        // Enable PHPStan diagnostics.
        "enabled": true
      }
    },
    "completion": {
      // Enable automatic import (use) of completed classes.
      "autoImport": true,
      // By default, only some PHP extensions are used for autocompletion.
      // Additional ones can be enabled here.
      "extensions": ["mysqli", "redis"]
    },
    "index": {
      // Additional stubs directories
      "stubs": ["/path/to/stubs/dir"]
    }
  }
}

Licence

Copyright (c) 2017 tsufeki, (*14)

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version., (*15)

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details., (*16)

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/., (*17)

The Versions

30/04 2018

dev-dependabot/composer/tsufeki/react-filesystem-monitor-0.4.0

dev-dependabot/composer/tsufeki/react-filesystem-monitor-0.4.0

Language server for PHP, with powerful static analysis and type inference

  Sources   Download

GPL-3.0-or-later

The Requires

 

The Development Requires

by Avatar tsufeki