php: Add syntax highlighting for Intelephense completions (#18774)
Release Notes: - N/A This PR introduces syntax highlighting for intelephense autocomple. The styling was selected to roughly match PHPStorm's default scheme. Please note that I'm not very familiar with writing Rust, but I'm happy to adapt to any requested changes! ## Examples ### Object attributes, methods and constants   ### Typed enum members   ### Variables Includes altered highlighting for [reserved variable names](https://www.php.net/manual/en/reserved.variables.php).  --------- Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This commit is contained in:
co-authored by
Marshall Bowers
parent
8376dd2011
commit
200b2bf70a
@@ -1,5 +1,6 @@
|
||||
mod language_servers;
|
||||
|
||||
use zed::CodeLabel;
|
||||
use zed_extension_api::{self as zed, serde_json, LanguageServerId, Result};
|
||||
|
||||
use crate::language_servers::{Intelephense, Phpactor};
|
||||
@@ -53,6 +54,19 @@ impl zed::Extension for PhpExtension {
|
||||
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
fn label_for_completion(
|
||||
&self,
|
||||
language_server_id: &zed::LanguageServerId,
|
||||
completion: zed::lsp::Completion,
|
||||
) -> Option<CodeLabel> {
|
||||
match language_server_id.as_ref() {
|
||||
Intelephense::LANGUAGE_SERVER_ID => {
|
||||
self.intelephense.as_ref()?.label_for_completion(completion)
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
zed::register_extension!(PhpExtension);
|
||||
|
||||
Reference in New Issue
Block a user