Skip to content

Commit

Permalink
feat(tree-sitter): Add XML support (lapce#1554)
Browse files Browse the repository at this point in the history
* Added XML syntax highlighting support.

* feat(tree_sitter_xml); Updated CHANGELOG.md

Co-authored-by: Dorian 'RenjiSann' Péron <dodo.savenay@gmail.com>
  • Loading branch information
RenjiSann and Dorian 'RenjiSann' Péron authored Oct 19, 2022
1 parent 64bf5eb commit b0f1620
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Features/Changes

- [#272](https://github.com/lapce/issue/272): Added XML language support
- [#1472](https://github.com/lapce/lapce/pull/1472) Added SQL language support
- [#1531](https://github.com/lapce/lapce/pull/1531): Improved Ctrl+Left command on spaces at the beginning of a line
- [#1491](https://github.com/lapce/lapce/pull/1491): Added Vim shift+c to delete remainder of line
Expand Down
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions lapce-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ tree-sitter-toml = { version = "0.20.0", optional = true }
tree-sitter-typescript = { version = "0.20.0", optional = true }
tree-sitter-vue = { version = "0.0.3", optional = true }
tree-sitter-wgsl = { git = "https://github.com/szebniok/tree-sitter-wgsl", branch = "master", optional = true }
tree-sitter-xml = { git = "https://github.com/RenjiSann/tree-sitter-xml", branch = "main", optional = true}
tree-sitter-yaml = { git = "https://github.com/panekj/tree-sitter-yaml", branch = "master", optional = true }
tree-sitter-zig = { git = "https://github.com/maxxnino/tree-sitter-zig", branch = "main", optional = true }
# switch to upstream version after this is merged https://github.com/m-novikov/tree-sitter-sql/pull/68
Expand Down Expand Up @@ -118,5 +119,6 @@ lang-typescript = ["dep:tree-sitter-typescript"]
lang-vue = ["dep:tree-sitter-vue"]
lang-wgsl = ["dep:tree-sitter-wgsl"]
lang-yaml = ["dep:tree-sitter-yaml"]
lang-xml = ["dep:tree-sitter-xml"]
lang-zig = ["dep:tree-sitter-zig"]
lang-sql = ["dep:tree-sitter-sql"]
14 changes: 14 additions & 0 deletions lapce-core/src/language.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ pub enum LapceLanguage {
Vue,
#[cfg(feature = "lang-wgsl")]
Wgsl,
#[cfg(feature = "lang-xml")]
Xml,
#[cfg(feature = "lang-yaml")]
Yaml,
#[cfg(feature = "lang-zig")]
Expand Down Expand Up @@ -793,6 +795,18 @@ const LANGUAGES: &[SyntaxProperties] = &[
sticky_headers: &[],
extensions: &["wgsl"],
},
#[cfg(feature = "lang-xml")]
SyntaxProperties {
id: LapceLanguage::Xml,
language: tree_sitter_xml::language,
highlight: tree_sitter_xml::HIGHLIGHTS_QUERY,
injection: None,
comment: "//",
indent: " ",
code_lens: (DEFAULT_CODE_LENS_LIST, DEFAULT_CODE_LENS_IGNORE_LIST),
sticky_headers: &[],
extensions: &["xml"],
},
#[cfg(feature = "lang-yaml")]
SyntaxProperties {
id: LapceLanguage::Yaml,
Expand Down
1 change: 1 addition & 0 deletions lapce-core/src/syntax/highlight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ declare_language_highlights!(
Typescript: "lang-typescript",
Vue: "lang-vue",
Wgsl: "lang-wgsl",
Xml: "lang-xml",
Yaml: "lang-yaml",
Zig: "lang-zig",
);
Expand Down
2 changes: 2 additions & 0 deletions lapce-ui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ all-languages = [
"lang-typescript",
"lang-vue",
"lang-wgsl",
"lang-xml",
"lang-yaml",
"lang-zig",
"lang-sql",
Expand Down Expand Up @@ -136,5 +137,6 @@ lang-toml = ["lapce-core/lang-toml"]
lang-typescript = ["lapce-core/lang-typescript"]
lang-vue = ["lapce-core/lang-vue"]
lang-wgsl = ["lapce-core/lang-wgsl"]
lang-xml = ["lapce-core/lang-xml"]
lang-yaml = ["lapce-core/lang-yaml"]
lang-zig = ["lapce-core/lang-zig"]

0 comments on commit b0f1620

Please sign in to comment.