logiguard fork v3: full patch set on verified 8c74db0 tree
Includes prior-session patches (carry forward so the app compiles): - crates/gpui/build.rs: cross-compile manifest fix - crates/gpui/src/platform.rs: PlatformWindow::activate_with_token trait method - crates/gpui/src/window.rs: Window::activate_with_token public API - crates/gpui_linux/src/linux/wayland/window.rs: WaylandWindow::activate_with_token + activate() keyboard-serial fix Plus the focus-serial fix: - serial.rs: SerialKind::KeyboardEnter - client.rs: store wl_keyboard.enter serial; latest_serial_of() Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
16
extensions/html/Cargo.toml
Normal file
16
extensions/html/Cargo.toml
Normal file
@@ -0,0 +1,16 @@
|
||||
[package]
|
||||
name = "zed_html"
|
||||
version = "0.3.1"
|
||||
edition.workspace = true
|
||||
publish.workspace = true
|
||||
license = "Apache-2.0"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[lib]
|
||||
path = "src/html.rs"
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
zed_extension_api = "0.7.0"
|
||||
1
extensions/html/LICENSE-APACHE
Symbolic link
1
extensions/html/LICENSE-APACHE
Symbolic link
@@ -0,0 +1 @@
|
||||
../../LICENSE-APACHE
|
||||
19
extensions/html/extension.toml
Normal file
19
extensions/html/extension.toml
Normal file
@@ -0,0 +1,19 @@
|
||||
id = "html"
|
||||
name = "HTML"
|
||||
description = "HTML support."
|
||||
version = "0.3.1"
|
||||
schema_version = 1
|
||||
authors = ["Isaac Clayton <slightknack@gmail.com>"]
|
||||
repository = "https://github.com/zed-industries/zed"
|
||||
|
||||
[language_servers.vscode-html-language-server]
|
||||
name = "vscode-html-language-server"
|
||||
language = "HTML"
|
||||
|
||||
[language_servers.vscode-html-language-server.language_ids]
|
||||
"HTML" = "html"
|
||||
"CSS" = "css"
|
||||
|
||||
[grammars.html]
|
||||
repository = "https://github.com/tree-sitter/tree-sitter-html"
|
||||
commit = "bfa075d83c6b97cd48440b3829ab8d24a2319809"
|
||||
21
extensions/html/languages/html/brackets.scm
Normal file
21
extensions/html/languages/html/brackets.scm
Normal file
@@ -0,0 +1,21 @@
|
||||
(("<" @open
|
||||
"/>" @close)
|
||||
(#set! rainbow.exclude))
|
||||
|
||||
(("<" @open
|
||||
">" @close)
|
||||
(#set! rainbow.exclude))
|
||||
|
||||
(("</" @open
|
||||
">" @close)
|
||||
(#set! rainbow.exclude))
|
||||
|
||||
(("\"" @open
|
||||
"\"" @close)
|
||||
(#set! rainbow.exclude))
|
||||
|
||||
((element
|
||||
(start_tag) @open
|
||||
(end_tag) @close)
|
||||
(#set! newline.only)
|
||||
(#set! rainbow.exclude))
|
||||
19
extensions/html/languages/html/config.toml
Normal file
19
extensions/html/languages/html/config.toml
Normal file
@@ -0,0 +1,19 @@
|
||||
name = "HTML"
|
||||
grammar = "html"
|
||||
path_suffixes = ["html", "htm", "shtml"]
|
||||
autoclose_before = ">})"
|
||||
block_comment = { start = "<!--", prefix = "", end = "-->", tab_size = 0 }
|
||||
wrap_characters = { start_prefix = "<", start_suffix = ">", end_prefix = "</", end_suffix = ">" }
|
||||
brackets = [
|
||||
{ start = "{", end = "}", close = true, newline = true },
|
||||
{ start = "[", end = "]", close = true, newline = true },
|
||||
{ start = "(", end = ")", close = true, newline = true },
|
||||
{ start = "\"", end = "\"", close = true, newline = false, not_in = ["comment", "string"] },
|
||||
{ start = "<", end = ">", close = false, newline = true, not_in = ["comment", "string"] },
|
||||
{ start = "!--", end = " --", close = true, newline = false, not_in = ["comment", "string"] },
|
||||
]
|
||||
completion_query_characters = ["-"]
|
||||
prettier_parser_name = "html"
|
||||
|
||||
[overrides.default]
|
||||
linked_edit_characters = ["-"]
|
||||
25
extensions/html/languages/html/highlights.scm
Normal file
25
extensions/html/languages/html/highlights.scm
Normal file
@@ -0,0 +1,25 @@
|
||||
(tag_name) @tag
|
||||
|
||||
(doctype) @tag.doctype
|
||||
|
||||
(attribute_name) @attribute
|
||||
|
||||
[
|
||||
"\""
|
||||
"'"
|
||||
(attribute_value)
|
||||
] @string
|
||||
|
||||
(comment) @comment
|
||||
|
||||
(entity) @string.special
|
||||
|
||||
"=" @punctuation.delimiter.html
|
||||
|
||||
[
|
||||
"<"
|
||||
">"
|
||||
"<!"
|
||||
"</"
|
||||
"/>"
|
||||
] @punctuation.bracket.html
|
||||
9
extensions/html/languages/html/indents.scm
Normal file
9
extensions/html/languages/html/indents.scm
Normal file
@@ -0,0 +1,9 @@
|
||||
(start_tag
|
||||
">" @end) @indent
|
||||
|
||||
(self_closing_tag
|
||||
"/>" @end) @indent
|
||||
|
||||
(element
|
||||
(start_tag) @start
|
||||
(end_tag)? @end) @indent
|
||||
24
extensions/html/languages/html/injections.scm
Normal file
24
extensions/html/languages/html/injections.scm
Normal file
@@ -0,0 +1,24 @@
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
(script_element
|
||||
(raw_text) @injection.content
|
||||
(#set! injection.language "javascript"))
|
||||
|
||||
(style_element
|
||||
(raw_text) @injection.content
|
||||
(#set! injection.language "css"))
|
||||
|
||||
(attribute
|
||||
(attribute_name) @_attribute_name
|
||||
(#match? @_attribute_name "^style$")
|
||||
(quoted_attribute_value
|
||||
(attribute_value) @injection.content)
|
||||
(#set! injection.language "css"))
|
||||
|
||||
(attribute
|
||||
(attribute_name) @_attribute_name
|
||||
(#match? @_attribute_name "^on[a-z]+$")
|
||||
(quoted_attribute_value
|
||||
(attribute_value) @injection.content)
|
||||
(#set! injection.language "javascript"))
|
||||
5
extensions/html/languages/html/outline.scm
Normal file
5
extensions/html/languages/html/outline.scm
Normal file
@@ -0,0 +1,5 @@
|
||||
(comment) @annotation
|
||||
|
||||
(element
|
||||
(start_tag
|
||||
(tag_name) @name)) @item
|
||||
8
extensions/html/languages/html/overrides.scm
Normal file
8
extensions/html/languages/html/overrides.scm
Normal file
@@ -0,0 +1,8 @@
|
||||
(comment) @comment
|
||||
|
||||
(quoted_attribute_value) @string
|
||||
|
||||
[
|
||||
(start_tag)
|
||||
(end_tag)
|
||||
] @default
|
||||
112
extensions/html/src/html.rs
Normal file
112
extensions/html/src/html.rs
Normal file
@@ -0,0 +1,112 @@
|
||||
use std::{env, fs};
|
||||
use zed::settings::LspSettings;
|
||||
use zed_extension_api::{self as zed, LanguageServerId, Result, serde_json::json};
|
||||
|
||||
const BINARY_NAME: &str = "vscode-html-language-server";
|
||||
const SERVER_PATH: &str =
|
||||
"node_modules/@zed-industries/vscode-langservers-extracted/bin/vscode-html-language-server";
|
||||
const PACKAGE_NAME: &str = "@zed-industries/vscode-langservers-extracted";
|
||||
|
||||
struct HtmlExtension {
|
||||
cached_binary_path: Option<String>,
|
||||
}
|
||||
|
||||
impl HtmlExtension {
|
||||
fn server_exists(&self) -> bool {
|
||||
fs::metadata(SERVER_PATH).is_ok_and(|stat| stat.is_file())
|
||||
}
|
||||
|
||||
fn server_script_path(&mut self, language_server_id: &LanguageServerId) -> Result<String> {
|
||||
let server_exists = self.server_exists();
|
||||
if self.cached_binary_path.is_some() && server_exists {
|
||||
return Ok(SERVER_PATH.to_string());
|
||||
}
|
||||
|
||||
zed::set_language_server_installation_status(
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::CheckingForUpdate,
|
||||
);
|
||||
let version = zed::npm_package_latest_version(PACKAGE_NAME)?;
|
||||
|
||||
if !server_exists
|
||||
|| zed::npm_package_installed_version(PACKAGE_NAME)?.as_ref() != Some(&version)
|
||||
{
|
||||
zed::set_language_server_installation_status(
|
||||
language_server_id,
|
||||
&zed::LanguageServerInstallationStatus::Downloading,
|
||||
);
|
||||
let result = zed::npm_install_package(PACKAGE_NAME, &version);
|
||||
match result {
|
||||
Ok(()) => {
|
||||
if !self.server_exists() {
|
||||
Err(format!(
|
||||
"installed package '{PACKAGE_NAME}' did not contain expected path '{SERVER_PATH}'",
|
||||
))?;
|
||||
}
|
||||
}
|
||||
Err(error) => {
|
||||
if !self.server_exists() {
|
||||
Err(error)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(SERVER_PATH.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl zed::Extension for HtmlExtension {
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
cached_binary_path: None,
|
||||
}
|
||||
}
|
||||
|
||||
fn language_server_command(
|
||||
&mut self,
|
||||
language_server_id: &LanguageServerId,
|
||||
worktree: &zed::Worktree,
|
||||
) -> Result<zed::Command> {
|
||||
let server_path = if let Some(path) = worktree.which(BINARY_NAME) {
|
||||
return Ok(zed::Command {
|
||||
command: path,
|
||||
args: vec!["--stdio".to_string()],
|
||||
env: Default::default(),
|
||||
});
|
||||
} else {
|
||||
let server_path = self.server_script_path(language_server_id)?;
|
||||
env::current_dir()
|
||||
.unwrap()
|
||||
.join(&server_path)
|
||||
.to_string_lossy()
|
||||
.to_string()
|
||||
};
|
||||
self.cached_binary_path = Some(server_path.clone());
|
||||
|
||||
Ok(zed::Command {
|
||||
command: zed::node_binary_path()?,
|
||||
args: vec![server_path, "--stdio".to_string()],
|
||||
env: Default::default(),
|
||||
})
|
||||
}
|
||||
|
||||
fn language_server_workspace_configuration(
|
||||
&mut self,
|
||||
server_id: &LanguageServerId,
|
||||
worktree: &zed::Worktree,
|
||||
) -> Result<Option<zed::serde_json::Value>> {
|
||||
LspSettings::for_worktree(server_id.as_ref(), worktree)
|
||||
.map(|lsp_settings| lsp_settings.settings)
|
||||
}
|
||||
|
||||
fn language_server_initialization_options(
|
||||
&mut self,
|
||||
_server_id: &LanguageServerId,
|
||||
_worktree: &zed_extension_api::Worktree,
|
||||
) -> Result<Option<zed_extension_api::serde_json::Value>> {
|
||||
let initialization_options = json!({"provideFormatter": true });
|
||||
Ok(Some(initialization_options))
|
||||
}
|
||||
}
|
||||
|
||||
zed::register_extension!(HtmlExtension);
|
||||
Reference in New Issue
Block a user