Merge pull request #276 from zed-industries/markdown
Add basic markdown highlighting
This commit is contained in:
Generated
+15
-6
@@ -5135,18 +5135,28 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tree-sitter"
|
name = "tree-sitter"
|
||||||
version = "0.19.5"
|
version = "0.20.1"
|
||||||
source = "git+https://github.com/tree-sitter/tree-sitter?rev=d72771a19f4143530b1cfd23808e344f1276e176#d72771a19f4143530b1cfd23808e344f1276e176"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9394e9dbfe967b5f3d6ab79e302e78b5fb7b530c368d634ff3b8d67ede138bf1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"regex",
|
"regex",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tree-sitter-markdown"
|
||||||
|
version = "0.0.1"
|
||||||
|
source = "git+https://github.com/maxbrunsfeld/tree-sitter-markdown?rev=b2b4eefd51ada972ef8bb581b83b6b8e7a28c7a6#b2b4eefd51ada972ef8bb581b83b6b8e7a28c7a6"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
"tree-sitter",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tree-sitter-rust"
|
name = "tree-sitter-rust"
|
||||||
version = "0.19.0"
|
version = "0.20.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "784f7ef9cdbd4c895dc2d4bb785e95b4a5364a602eec803681db83d1927ddf15"
|
checksum = "3df540a493d754015d22eaf57c38f58804be3713a22f6062db983ec15f85c3c9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"tree-sitter",
|
"tree-sitter",
|
||||||
@@ -5643,8 +5653,6 @@ dependencies = [
|
|||||||
"project",
|
"project",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"theme",
|
"theme",
|
||||||
"tree-sitter",
|
|
||||||
"tree-sitter-rust",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -5731,6 +5739,7 @@ dependencies = [
|
|||||||
"tiny_http",
|
"tiny_http",
|
||||||
"toml",
|
"toml",
|
||||||
"tree-sitter",
|
"tree-sitter",
|
||||||
|
"tree-sitter-markdown",
|
||||||
"tree-sitter-rust",
|
"tree-sitter-rust",
|
||||||
"unindent",
|
"unindent",
|
||||||
"url",
|
"url",
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ default-members = ["crates/zed"]
|
|||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
async-task = { git = "https://github.com/zed-industries/async-task", rev = "341b57d6de98cdfd7b418567b8de2022ca993a6e" }
|
async-task = { git = "https://github.com/zed-industries/async-task", rev = "341b57d6de98cdfd7b418567b8de2022ca993a6e" }
|
||||||
tree-sitter = { git = "https://github.com/tree-sitter/tree-sitter", rev = "d72771a19f4143530b1cfd23808e344f1276e176" }
|
|
||||||
# TODO - Remove when a version is released with this PR: https://github.com/servo/core-foundation-rs/pull/457
|
# TODO - Remove when a version is released with this PR: https://github.com/servo/core-foundation-rs/pull/457
|
||||||
cocoa = { git = "https://github.com/servo/core-foundation-rs", rev = "025dcb3c0d1ef01530f57ef65f3b1deb948f5737" }
|
cocoa = { git = "https://github.com/servo/core-foundation-rs", rev = "025dcb3c0d1ef01530f57ef65f3b1deb948f5737" }
|
||||||
cocoa-foundation = { git = "https://github.com/servo/core-foundation-rs", rev = "025dcb3c0d1ef01530f57ef65f3b1deb948f5737" }
|
cocoa-foundation = { git = "https://github.com/servo/core-foundation-rs", rev = "025dcb3c0d1ef01530f57ef65f3b1deb948f5737" }
|
||||||
|
|||||||
@@ -41,5 +41,5 @@ ctor = "0.1"
|
|||||||
env_logger = "0.8"
|
env_logger = "0.8"
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
unindent = "0.1.7"
|
unindent = "0.1.7"
|
||||||
tree-sitter = "0.19"
|
tree-sitter = "0.20"
|
||||||
tree-sitter-rust = "0.19"
|
tree-sitter-rust = "0.20"
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ smallvec = { version = "1.6", features = ["union"] }
|
|||||||
smol = "1.2"
|
smol = "1.2"
|
||||||
time = { version = "0.3" }
|
time = { version = "0.3" }
|
||||||
tiny-skia = "0.5"
|
tiny-skia = "0.5"
|
||||||
tree-sitter = "0.19"
|
tree-sitter = "0.20"
|
||||||
usvg = "0.14"
|
usvg = "0.14"
|
||||||
waker-fn = "1.1.0"
|
waker-fn = "1.1.0"
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ include = ["bindings/rust/*", "grammar.js", "queries/*", "src/*"]
|
|||||||
path = "bindings/rust/lib.rs"
|
path = "bindings/rust/lib.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tree-sitter = "0.19.3"
|
tree-sitter = "0.20"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
cc = "1.0"
|
cc = "1.0"
|
||||||
|
|||||||
@@ -32,13 +32,13 @@ rand = { version = "0.8.3", optional = true }
|
|||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
similar = "1.3"
|
similar = "1.3"
|
||||||
smol = "1.2"
|
smol = "1.2"
|
||||||
tree-sitter = "0.19.5"
|
tree-sitter = "0.20.0"
|
||||||
tree-sitter-rust = { version = "0.19.0", optional = true }
|
tree-sitter-rust = { version = "0.20.0", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
text = { path = "../text", features = ["test-support"] }
|
text = { path = "../text", features = ["test-support"] }
|
||||||
gpui = { path = "../gpui", features = ["test-support"] }
|
gpui = { path = "../gpui", features = ["test-support"] }
|
||||||
lsp = { path = "../lsp", features = ["test-support"] }
|
lsp = { path = "../lsp", features = ["test-support"] }
|
||||||
rand = "0.8.3"
|
rand = "0.8.3"
|
||||||
tree-sitter-rust = "0.19.0"
|
tree-sitter-rust = "0.20.0"
|
||||||
unindent = "0.1.7"
|
unindent = "0.1.7"
|
||||||
|
|||||||
@@ -7,12 +7,7 @@ edition = "2018"
|
|||||||
path = "src/workspace.rs"
|
path = "src/workspace.rs"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
test-support = [
|
test-support = ["client/test-support", "project/test-support"]
|
||||||
"client/test-support",
|
|
||||||
"project/test-support",
|
|
||||||
"tree-sitter",
|
|
||||||
"tree-sitter-rust",
|
|
||||||
]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
client = { path = "../client" }
|
client = { path = "../client" }
|
||||||
@@ -23,13 +18,9 @@ theme = { path = "../theme" }
|
|||||||
anyhow = "1.0.38"
|
anyhow = "1.0.38"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
postage = { version = "0.4.1", features = ["futures-traits"] }
|
postage = { version = "0.4.1", features = ["futures-traits"] }
|
||||||
tree-sitter = { version = "0.19.5", optional = true }
|
|
||||||
tree-sitter-rust = { version = "0.19.0", optional = true }
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
client = { path = "../client", features = ["test-support"] }
|
client = { path = "../client", features = ["test-support"] }
|
||||||
gpui = { path = "../gpui", features = ["test-support"] }
|
gpui = { path = "../gpui", features = ["test-support"] }
|
||||||
project = { path = "../project", features = ["test-support"] }
|
project = { path = "../project", features = ["test-support"] }
|
||||||
serde_json = { version = "1.0.64", features = ["preserve_order"] }
|
serde_json = { version = "1.0.64", features = ["preserve_order"] }
|
||||||
tree-sitter = "0.19.5"
|
|
||||||
tree-sitter-rust = "0.19.0"
|
|
||||||
|
|||||||
@@ -84,8 +84,9 @@ thiserror = "1.0.29"
|
|||||||
time = "0.3"
|
time = "0.3"
|
||||||
tiny_http = "0.8"
|
tiny_http = "0.8"
|
||||||
toml = "0.5"
|
toml = "0.5"
|
||||||
tree-sitter = "0.19.5"
|
tree-sitter = "0.20.0"
|
||||||
tree-sitter-rust = "0.19.0"
|
tree-sitter-rust = "0.20.0"
|
||||||
|
tree-sitter-markdown = { git = "https://github.com/maxbrunsfeld/tree-sitter-markdown", rev = "b2b4eefd51ada972ef8bb581b83b6b8e7a28c7a6" }
|
||||||
url = "2.2"
|
url = "2.2"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|||||||
@@ -50,3 +50,10 @@ comment = "#6a9955"
|
|||||||
property = "#4e94ce"
|
property = "#4e94ce"
|
||||||
variant = "#4fc1ff"
|
variant = "#4fc1ff"
|
||||||
constant = "#9cdcfe"
|
constant = "#9cdcfe"
|
||||||
|
|
||||||
|
title = { color = "#9cdcfe", weight = "bold" }
|
||||||
|
emphasis = "#4ec9b0"
|
||||||
|
"emphasis.strong" = { color = "#4ec9b0", weight = "bold" }
|
||||||
|
link_uri = { color = "#6a9955", underline = true }
|
||||||
|
link_text = { color = "#cb8f77", italic = true }
|
||||||
|
list_marker = "#4e94ce"
|
||||||
|
|||||||
@@ -50,3 +50,10 @@ comment = "#6a9955"
|
|||||||
property = "#4e94ce"
|
property = "#4e94ce"
|
||||||
variant = "#4fc1ff"
|
variant = "#4fc1ff"
|
||||||
constant = "#9cdcfe"
|
constant = "#9cdcfe"
|
||||||
|
|
||||||
|
title = { color = "#9cdcfe", weight = "bold" }
|
||||||
|
emphasis = "#4ec9b0"
|
||||||
|
"emphasis.strong" = { color = "#4ec9b0", weight = "bold" }
|
||||||
|
link_uri = { color = "#6a9955", underline = true }
|
||||||
|
link_text = { color = "#cb8f77", italic = true }
|
||||||
|
list_marker = "#4e94ce"
|
||||||
|
|||||||
@@ -49,4 +49,11 @@ number = "#b5cea8"
|
|||||||
comment = "#6a9955"
|
comment = "#6a9955"
|
||||||
property = "#4e94ce"
|
property = "#4e94ce"
|
||||||
variant = "#4fc1ff"
|
variant = "#4fc1ff"
|
||||||
constant = "#9cdcfe"
|
constant = "#5a9ccc"
|
||||||
|
|
||||||
|
title = { color = "#5a9ccc", weight = "bold" }
|
||||||
|
emphasis = "#267f29"
|
||||||
|
"emphasis.strong" = { color = "#267f29", weight = "bold" }
|
||||||
|
link_uri = { color = "#6a9955", underline = true }
|
||||||
|
link_text = { color = "#a82121", italic = true }
|
||||||
|
list_marker = "#4e94ce"
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
(emphasis) @emphasis
|
||||||
|
(strong_emphasis) @emphasis.strong
|
||||||
|
|
||||||
|
[
|
||||||
|
(atx_heading)
|
||||||
|
(setext_heading)
|
||||||
|
] @title
|
||||||
|
|
||||||
|
[
|
||||||
|
(list_marker_plus)
|
||||||
|
(list_marker_minus)
|
||||||
|
(list_marker_star)
|
||||||
|
(list_marker_dot)
|
||||||
|
(list_marker_parenthesis)
|
||||||
|
] @list_marker
|
||||||
|
|
||||||
|
[
|
||||||
|
(indented_code_block)
|
||||||
|
(fenced_code_block)
|
||||||
|
(code_span)
|
||||||
|
] @text.literal
|
||||||
|
|
||||||
|
(link_destination) @link_uri
|
||||||
|
(link_text) @link_text
|
||||||
@@ -27,8 +27,11 @@ fn rust() -> Language {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn markdown() -> Language {
|
fn markdown() -> Language {
|
||||||
|
let grammar = tree_sitter_markdown::language();
|
||||||
let config = toml::from_slice(&LanguageDir::get("markdown/config.toml").unwrap().data).unwrap();
|
let config = toml::from_slice(&LanguageDir::get("markdown/config.toml").unwrap().data).unwrap();
|
||||||
Language::new(config, None)
|
Language::new(config, Some(grammar))
|
||||||
|
.with_highlights_query(load_query("markdown/highlights.scm").as_ref())
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_query(path: &str) -> Cow<'static, str> {
|
fn load_query(path: &str) -> Cow<'static, str> {
|
||||||
|
|||||||
Reference in New Issue
Block a user