定制 tsufeki/tenkawa-php-language-server 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tsufeki/tenkawa-php-language-server

Composer 安装命令:

composer require tsufeki/tenkawa-php-language-server

包简介

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

README 文档

README

Tenkawa

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

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

Installation

Requires PHP >= 7.1 with pdo_sqlite extension.

For Visual Studio Code extension, see here.

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

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

Or by cloning the repo:

$ 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:

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

Now configure your client to start the server with this command to use stdio:

php ~/tenkawa/bin/tenkawa.php

Or to connect to a TCP socket:

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

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

Recognized options:

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

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.

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.

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

tsufeki/tenkawa-php-language-server 适用场景与选型建议

tsufeki/tenkawa-php-language-server 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 895 次下载、GitHub Stars 达 82, 最近一次更新时间为 2018 年 01 月 19 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 tsufeki/tenkawa-php-language-server 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 tsufeki/tenkawa-php-language-server 我们能提供哪些服务?
定制开发 / 二次开发

基于 tsufeki/tenkawa-php-language-server 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 895
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 82
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 82
  • Watchers: 2
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2018-01-19