дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-26 20:46:22 +02:00
feat(php): devsense-php-ls as a selectable PHP language server (#5658)
DEVSENSE PHP Tools (devsense-php-ls) is one more selectable PHP language server in Settings › Languages & Frameworks › Language Servers, after Phoxite; Intelephense stays the default. Its engine is native (only the npm launcher needs Node), and while it serves it replaces laravel-lsp, as it answers the Laravel strings itself. Docs note which features need a DEVSENSE licence. A managed install can follow. Fixes #5496 Co-authored-by: Inf1mum <[email protected]>
Цей коміт міститься в:
1 джерело
40c8e83084
коміт
fba210e22d
6 files changed
+44
-17
No files matched your search
@@ -885,10 +885,16 @@ mod tests {
|
||||
let cfg = reg.get(&LanguageId::new("php")).unwrap();
|
||||
let names: Vec<&str> = cfg.language_servers.iter().map(|s| s.name.as_str()).collect();
|
||||
// After the fallback: hover, rename and symbols stay with Intelephense.
|
||||
assert_eq!(names, ["intelephense", "phpactor", "phoxite", "laravel-lsp"]);
|
||||
assert_eq!(names, ["intelephense", "phpactor", "phoxite", "devsense-php-ls", "laravel-lsp"]);
|
||||
// Phoxite answers the Laravel strings itself.
|
||||
let phoxite = cfg.language_servers.iter().find(|s| s.name == "phoxite").unwrap();
|
||||
assert!(phoxite.fallback && phoxite.replaces == ["laravel-lsp"]);
|
||||
// DEVSENSE runs without Node or PHP of its own (the npm launcher needs Node) and
|
||||
// answers the Laravel strings itself. https://docs.devsense.com/other/lsp/docs/
|
||||
let devsense = cfg.language_servers.iter().find(|s| s.name == "devsense-php-ls").unwrap();
|
||||
assert!(devsense.fallback && devsense.replaces == ["laravel-lsp"]);
|
||||
assert_eq!(devsense.command.as_str(), "devsense-php-ls");
|
||||
assert_eq!(devsense.install_hint.as_deref(), Some("npm i -g devsense-php-ls"));
|
||||
let lsp = cfg.language_servers.iter().find(|s| s.name == "laravel-lsp").unwrap();
|
||||
assert_eq!(lsp.command.as_str(), "laravel-lsp");
|
||||
// Its `lsp` command takes no options and speaks over stdio; `--stdio` stops it at startup.
|
||||
|
||||
@@ -149,7 +149,7 @@ The table lists every built-in language definition. Server and debugger names in
|
||||
| OCaml | `ocaml` | `.ml`, `.mll`, `.mly` | Yes | Yes | ocamllsp | ocamlearlybird |
|
||||
| OCaml Interface | `ocaml.interface` | `.mli` | Yes | Yes | ocamllsp | — |
|
||||
| Perl | `perl` | `.pl`, `.pm`, `.pod`, `.psgi`, `.cgi` | Yes | — | **perlnavigator** | — |
|
||||
| PHP | `php` | `.php`, `.phtml`, `.php3`, `.php4`, `.php5`, … | Yes | Yes | **intelephense** → phpactor → **phoxite** + **laravel-lsp** | **php-debug** |
|
||||
| PHP | `php` | `.php`, `.phtml`, `.php3`, `.php4`, `.php5`, … | Yes | Yes | **intelephense** → phpactor → **phoxite** → devsense-php-ls + **laravel-lsp** | **php-debug** |
|
||||
| Plain Text | `plaintext` | `.txt`, `.text` | — | — | — | — |
|
||||
| PowerShell | `powershell` | `.ps1`, `.psm1`, `.psd1`, `.pssc`, `.psrc` | Yes | — | powershell-editor-services | — |
|
||||
| Prisma | `prisma` | `.prisma` | Yes | Yes | **prisma-language-server** | — |
|
||||
|
||||
@@ -7,14 +7,17 @@ OpenIDEA highlights PHP files (`.php`, `.phtml`, `.phpt` and older `.php3`–`.p
|
||||
|
||||
## Language servers
|
||||
|
||||
| Server | When it runs |
|
||||
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `intelephense` | Default. Workspace root: `composer.json`, `.phpactor.json` or `index.php`. |
|
||||
| `phpactor` | Fallback: used only while Intelephense is not installed. |
|
||||
| `phoxite` | Alternative with its own Laravel and Blade support: used while neither server above is installed, or when you pick it in **Settings › Languages & Frameworks › Language Servers**. |
|
||||
| `laravel-lsp` | Laravel projects only (below an `artisan` file): hover, definition and completion inside `config('…')`, `route('…')` and `view('…')`. |
|
||||
| Server | When it runs |
|
||||
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `intelephense` | Default. Workspace root: `composer.json`, `.phpactor.json` or `index.php`. |
|
||||
| `phpactor` | Fallback: used only while Intelephense is not installed. |
|
||||
| `phoxite` | Alternative with its own Laravel and Blade support: used while neither server above is installed, or when you pick it in **Settings › Languages & Frameworks › Language Servers**. |
|
||||
| `devsense-php-ls` | Alternative whose engine ships as native builds, so the server itself needs no Node or PHP: used while no server above is installed, or when you pick it in **Settings › Languages & Frameworks › Language Servers**. |
|
||||
| `laravel-lsp` | Laravel projects only (below an `artisan` file): hover, definition and completion inside `config('…')`, `route('…')` and `view('…')`. |
|
||||
|
||||
While Phoxite serves a project, `laravel-lsp` is not started: Phoxite answers the Laravel strings itself.
|
||||
While Phoxite or DEVSENSE serves a project, `laravel-lsp` is not started: they answer the Laravel strings themselves.
|
||||
|
||||
DEVSENSE is usable without a licence for everyday code insight (completion, hover, go to definition, references, diagnostics, Laravel and Blade support); its refactorings and call/type hierarchy need a DEVSENSE licence.
|
||||
|
||||
Intelephense checks code against the project's PHP version (see [Language level](#language-level)) and indexes the stubs and include paths you configure.
|
||||
|
||||
@@ -29,6 +32,7 @@ When a `.php` file opens and Intelephense is missing, a notification offers **In
|
||||
| Intelephense | npm (`intelephense`) |
|
||||
| Laravel LSP | GitHub release (`laravel/lsp`) |
|
||||
| Phoxite | GitHub release (`samehelhawary/phoxite`) |
|
||||
| DEVSENSE | npm (`devsense-php-ls`); needs Node.js to launch |
|
||||
| PHP Debug (Xdebug) | Open VSX (`xdebug.php-debug`); needs Node.js to run |
|
||||
| phpactor | Not installable from the IDE; install it yourself and put it on `PATH` |
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ IDE 安装工具从不需要 `sudo`。工具装在本地数据目录下 IDE 自
|
||||
| OCaml | `ocaml` | `.ml`, `.mll`, `.mly` | 是 | 是 | ocamllsp | ocamlearlybird |
|
||||
| OCaml Interface | `ocaml.interface` | `.mli` | 是 | 是 | ocamllsp | — |
|
||||
| Perl | `perl` | `.pl`, `.pm`, `.pod`, `.psgi`, `.cgi` | 是 | — | **perlnavigator** | — |
|
||||
| PHP | `php` | `.php`, `.phtml`, `.php3`, `.php4`, `.php5`, … | 是 | 是 | **intelephense** → phpactor → **phoxite** + **laravel-lsp** | **php-debug** |
|
||||
| PHP | `php` | `.php`, `.phtml`, `.php3`, `.php4`, `.php5`, … | 是 | 是 | **intelephense** → phpactor → **phoxite** → devsense-php-ls + **laravel-lsp** | **php-debug** |
|
||||
| Plain Text | `plaintext` | `.txt`, `.text` | — | — | — | — |
|
||||
| PowerShell | `powershell` | `.ps1`, `.psm1`, `.psd1`, `.pssc`, `.psrc` | 是 | — | powershell-editor-services | — |
|
||||
| Prisma | `prisma` | `.prisma` | 是 | 是 | **prisma-language-server** | — |
|
||||
|
||||
@@ -7,14 +7,17 @@ OpenIDEA 开箱即可高亮 PHP 文件(`.php`、`.phtml`、`.phpt` 以及老
|
||||
|
||||
## 语言服务器
|
||||
|
||||
| 服务器 | 启用条件 |
|
||||
| -------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `intelephense` | 默认。工作区根:`composer.json`、`.phpactor.json` 或 `index.php`。 |
|
||||
| `phpactor` | 备选:仅在未安装 Intelephense 时使用。 |
|
||||
| `phoxite` | 备选,自带 Laravel 和 Blade 支持:仅在以上两个服务器都未安装时使用,或在 **设置 › 语言和框架 › 语言服务器** 中选中它时使用。 |
|
||||
| `laravel-lsp` | 仅限 Laravel 项目(`artisan` 文件所在目录之下):在 `config('…')`、`route('…')`、`view('…')` 中提供悬停、跳转和补全。 |
|
||||
| 服务器 | 启用条件 |
|
||||
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `intelephense` | 默认。工作区根:`composer.json`、`.phpactor.json` 或 `index.php`。 |
|
||||
| `phpactor` | 备选:仅在未安装 Intelephense 时使用。 |
|
||||
| `phoxite` | 备选,自带 Laravel 和 Blade 支持:仅在以上两个服务器都未安装时使用,或在 **设置 › 语言和框架 › 语言服务器** 中选中它时使用。 |
|
||||
| `devsense-php-ls` | 备选,引擎为各平台原生构建,服务器本身无需 Node 或 PHP:仅在以上服务器都未安装时使用,或在 **设置 › 语言和框架 › 语言服务器** 中选中它时使用。 |
|
||||
| `laravel-lsp` | 仅限 Laravel 项目(`artisan` 文件所在目录之下):在 `config('…')`、`route('…')`、`view('…')` 中提供悬停、跳转和补全。 |
|
||||
|
||||
Phoxite 为项目提供服务时不会启动 `laravel-lsp`:Laravel 相关的字符串由 Phoxite 自己处理。
|
||||
Phoxite 或 DEVSENSE 为项目提供服务时不会启动 `laravel-lsp`:Laravel 相关的字符串由它们自己处理。
|
||||
|
||||
DEVSENSE 无需许可证即可用于日常代码智能(补全、悬停、跳转、查找引用、诊断,以及 Laravel 和 Blade 支持);其重构以及调用/类型层次结构需要 DEVSENSE 许可证。
|
||||
|
||||
Intelephense 会按项目的 PHP 版本检查代码(见下文“语言级别”),并索引你配置的 stub 和包含路径。
|
||||
|
||||
@@ -29,6 +32,7 @@ Intelephense 会按项目的 PHP 版本检查代码(见下文“语言级别
|
||||
| Intelephense | npm(`intelephense`) |
|
||||
| Laravel LSP | GitHub release(`laravel/lsp`) |
|
||||
| Phoxite | GitHub release(`samehelhawary/phoxite`) |
|
||||
| DEVSENSE | npm(`devsense-php-ls`),启动时需要 Node.js |
|
||||
| PHP Debug (Xdebug) | Open VSX(`xdebug.php-debug`),运行时需要 Node.js |
|
||||
| phpactor | IDE 不负责安装,请自行安装并放到 `PATH` 上 |
|
||||
|
||||
|
||||
@@ -37,6 +37,19 @@ root-markers = ["composer.json", "artisan", "index.php"]
|
||||
replaces = ["laravel-lsp"]
|
||||
install-hint = "Install phoxite-lsp from https://github.com/samehelhawary/phoxite/releases and put it on PATH"
|
||||
|
||||
# Alternative whose engine ships as native builds for Windows, macOS and Linux;
|
||||
# only the npm launcher needs Node. Some features (refactorings, call and type
|
||||
# hierarchy) need a DEVSENSE licence. https://docs.devsense.com/other/lsp/docs/
|
||||
[[language-servers]]
|
||||
name = "devsense-php-ls"
|
||||
fallback = true
|
||||
command = "devsense-php-ls"
|
||||
args = []
|
||||
root-markers = ["composer.json", "index.php"]
|
||||
# It answers the Laravel strings itself.
|
||||
replaces = ["laravel-lsp"]
|
||||
install-hint = "npm i -g devsense-php-ls"
|
||||
|
||||
# Laravel projects only: hover, definition and completion inside
|
||||
# config('…'), route('…') and view('…'). Last: Intelephense keeps PHP hover,
|
||||
# rename and symbols. https://github.com/laravel/lsp
|
||||
|
||||
Reference in new issue
Заблокувати користувача