html: release 0.1.0 (#12083)

Add config for tag autoclosing: add following to lsp section of your
settings:
    "vscode-html-language-server": {
      "settings": {
        "html": { "tagAutoclosing": true }
      }
    }

It also accepts `css`, `js/ts` and `javascript` as options.

Disable HTML language server in JS/TS/TSX files for now. I decided to
disable it for now as it caused excessive edits in these types of files
(as reported by @mariansimecek in
https://github.com/zed-industries/zed/pull/11761#issuecomment-2122038107);
it looks like HTML language server tries to track language ranges (e.g.
whether a particular span is TS/HTML fragment etc) just like we do.
However in plain JS/TSX files it seems like it treats the whole file as
one big chunk of HTML, which is.. not right, to say the least.

No release note, as HTML extension goodies are not on Preview yet.

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2024-05-21 14:04:02 +02:00 committed by GitHub
parent a5b14de401
commit 7a90b1124f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 19 additions and 12 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "zed_html"
version = "0.0.2"
version = "0.1.0"
edition = "2021"
publish = false
license = "Apache-2.0"

View file

@ -1,7 +1,7 @@
id = "html"
name = "HTML"
description = "HTML support."
version = "0.0.2"
version = "0.1.0"
schema_version = 1
authors = ["Isaac Clayton <slightknack@gmail.com>"]
repository = "https://github.com/zed-industries/zed"
@ -9,14 +9,9 @@ repository = "https://github.com/zed-industries/zed"
[language_servers.vscode-html-language-server]
name = "vscode-html-language-server"
language = "HTML"
languages = ["TypeScript", "HTML", "TSX", "JavaScript", "JSDoc"]
[language_servers.vscode-html-language-server.language_ids]
"HTML" = "html"
"PHP" = "php"
"ERB" = "eruby"
"JavaScript" = "javascriptreact"
"TSX" = "typescriptreact"
"CSS" = "css"
[grammars.html]

View file

@ -1,3 +1,4 @@
use crate::zed::settings::LspSettings;
use std::{env, fs, path::PathBuf};
use zed_extension_api::{self as zed, Result};
@ -95,6 +96,17 @@ impl zed::Extension for HtmlExtension {
env: Default::default(),
})
}
fn language_server_workspace_configuration(
&mut self,
server_id: &zed::LanguageServerId,
worktree: &zed::Worktree,
) -> Result<Option<zed::serde_json::Value>> {
let settings = LspSettings::for_worktree(server_id.as_ref(), worktree)
.ok()
.and_then(|lsp_settings| lsp_settings.settings.clone())
.unwrap_or_default();
Ok(Some(settings))
}
}
zed::register_extension!(HtmlExtension);