phpactor/language-server-protocol
Composer 安装命令:
composer require phpactor/language-server-protocol
包简介
Langauge Server Protocol for PHP (transpiled)
README 文档
README
This package transpiles the vscode-language-server-protocol library to PHP,
providing the protocol classes required to create Language Server
with PHP.
Notes on using the library
Most (if not all) of the upstream Typescript types have no constructors, therefore the argument order of the constructors can change on every release.
It is therefore strongly recommended to use named arguments.
Generation
Generating the code:
npm run generate: Build and transpilenpm run watch: Watch and compile on Typescript changes.
Running the PHP tests:
composer integrate
Usage
Deserialization
This library will use the type information form typescript to generate
fromArray static constructors for each type:
$item = CompletionItem::fromArray([ 'label' => 'Foobar', 'kind' => 1, 'detail' => 'This is foobar', 'documentation' => [ 'kind' => 'markdown', 'value' => 'Foobar', ], 'additionalTextEdits' => [ [ 'range' => [ 'start' => [ 'line' => 5, 'character' => 10, ], 'end' => [ 'line' => 10, 'character' => 10, ], ], 'newText' => 'Foobar', ], ], 'command' => [ 'title' => 'Foobar', 'command' => 'my.command', ], ]);
Will return a fully hydrated completion item with concrete sub-types.
NOTE: that when deserializing from a language server client request, it is
probably a good idea to ignore additional parameters (the second argument to
fromArray). This is because it is perfectly valid to pass unknown properties
to some of the LSP objects.
Serialization
Properties in classes are public to enable JSON serialization. Call
json_encode($lspObject) to get the valid LSP JSON object.
Contributing
This package is open source and welcomes contributions! Feel free to open a pull request on this repository.
Support
- Create an issue on the main Phpactor repository.
- Join the
#phpactorchannel on the Slack Symfony Devs channel.
phpactor/language-server-protocol 适用场景与选型建议
phpactor/language-server-protocol 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 522.24k 次下载、GitHub Stars 达 12, 最近一次更新时间为 2020 年 06 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 phpactor/language-server-protocol 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 phpactor/language-server-protocol 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 522.24k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 12
- 点击次数: 12
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-06-23