mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-24 02:46:43 +00:00
Add text objects to extensions (#21488)
Release Notes: - Adds textobject support to erlang, haskell, lua, php, prisma, proto, toml, and zig
This commit is contained in:
parent
463c99b503
commit
1fccda7b8d
26 changed files with 170 additions and 25 deletions
16
Cargo.lock
generated
16
Cargo.lock
generated
|
@ -15768,7 +15768,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zed_erlang"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"zed_extension_api 0.1.0",
|
||||
]
|
||||
|
@ -15802,7 +15802,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zed_haskell"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
dependencies = [
|
||||
"zed_extension_api 0.1.0",
|
||||
]
|
||||
|
@ -15816,28 +15816,28 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zed_lua"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"zed_extension_api 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zed_php"
|
||||
version = "0.2.2"
|
||||
version = "0.2.3"
|
||||
dependencies = [
|
||||
"zed_extension_api 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zed_prisma"
|
||||
version = "0.0.3"
|
||||
version = "0.0.4"
|
||||
dependencies = [
|
||||
"zed_extension_api 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zed_proto"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
dependencies = [
|
||||
"zed_extension_api 0.1.0",
|
||||
]
|
||||
|
@ -15880,7 +15880,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zed_toml"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
dependencies = [
|
||||
"zed_extension_api 0.1.0",
|
||||
]
|
||||
|
@ -15894,7 +15894,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "zed_zig"
|
||||
version = "0.3.1"
|
||||
version = "0.3.2"
|
||||
dependencies = [
|
||||
"zed_extension_api 0.1.0",
|
||||
]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "zed_erlang"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
license = "Apache-2.0"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
id = "erlang"
|
||||
name = "Erlang"
|
||||
description = "Erlang support."
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
schema_version = 1
|
||||
authors = ["Dairon M <dairon.medina@gmail.com>", "Fabian Bergström <fabian@fmbb.se>"]
|
||||
repository = "https://github.com/zed-industries/zed"
|
||||
|
|
6
extensions/erlang/languages/erlang/textobjects.scm
Normal file
6
extensions/erlang/languages/erlang/textobjects.scm
Normal file
|
@ -0,0 +1,6 @@
|
|||
(function_clause
|
||||
body: (_ "->" (_)* @function.inside)) @function.around
|
||||
|
||||
(type_alias ty: (_) @class.inside) @class.around
|
||||
|
||||
(comment)+ @comment.around
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "zed_haskell"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
license = "Apache-2.0"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
id = "haskell"
|
||||
name = "Haskell"
|
||||
description = "Haskell support."
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
schema_version = 1
|
||||
authors = [
|
||||
"Pocæus <github@pocaeus.com>",
|
||||
|
|
12
extensions/haskell/languages/haskell/textobjects.scm
Normal file
12
extensions/haskell/languages/haskell/textobjects.scm
Normal file
|
@ -0,0 +1,12 @@
|
|||
(comment)+ @comment.around
|
||||
|
||||
[
|
||||
(adt)
|
||||
(type_alias)
|
||||
(newtype)
|
||||
] @class.around
|
||||
|
||||
(record_fields "{" (_)* @class.inside "}")
|
||||
|
||||
((signature)? (function)+) @function.around
|
||||
(function rhs:(_) @function.inside)
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "zed_lua"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
license = "Apache-2.0"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
id = "lua"
|
||||
name = "Lua"
|
||||
description = "Lua support."
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
schema_version = 1
|
||||
authors = ["Max Brunsfeld <max@zed.dev>"]
|
||||
repository = "https://github.com/zed-industries/zed"
|
||||
|
|
7
extensions/lua/languages/lua/textobjects.scm
Normal file
7
extensions/lua/languages/lua/textobjects.scm
Normal file
|
@ -0,0 +1,7 @@
|
|||
(function_definition
|
||||
body: (_) @function.inside) @function.around
|
||||
|
||||
(function_declaration
|
||||
body: (_) @function.inside) @function.around
|
||||
|
||||
(comment)+ @comment.around
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "zed_php"
|
||||
version = "0.2.2"
|
||||
version = "0.2.3"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
license = "Apache-2.0"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
id = "php"
|
||||
name = "PHP"
|
||||
description = "PHP support."
|
||||
version = "0.2.2"
|
||||
version = "0.2.3"
|
||||
schema_version = 1
|
||||
authors = ["Piotr Osiewicz <piotr@zed.dev>"]
|
||||
repository = "https://github.com/zed-industries/zed"
|
||||
|
|
45
extensions/php/languages/php/textobjects.scm
Normal file
45
extensions/php/languages/php/textobjects.scm
Normal file
|
@ -0,0 +1,45 @@
|
|||
(function_definition
|
||||
body: (_
|
||||
"{"
|
||||
(_)* @function.inside
|
||||
"}" )) @function.around
|
||||
|
||||
(method_declaration
|
||||
body: (_
|
||||
"{"
|
||||
(_)* @function.inside
|
||||
"}" )) @function.around
|
||||
|
||||
(method_declaration) @function.around
|
||||
|
||||
(class_declaration
|
||||
body: (_
|
||||
"{"
|
||||
(_)* @class.inside
|
||||
"}")) @class.around
|
||||
|
||||
(interface_declaration
|
||||
body: (_
|
||||
"{"
|
||||
(_)* @class.inside
|
||||
"}")) @class.around
|
||||
|
||||
(trait_declaration
|
||||
body: (_
|
||||
"{"
|
||||
(_)* @class.inside
|
||||
"}")) @class.around
|
||||
|
||||
(enum_declaration
|
||||
body: (_
|
||||
"{"
|
||||
(_)* @class.inside
|
||||
"}")) @class.around
|
||||
|
||||
(namespace_definition
|
||||
body: (_
|
||||
"{"
|
||||
(_)* @class.inside
|
||||
"}")) @class.around
|
||||
|
||||
(comment)+ @comment.around
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "zed_prisma"
|
||||
version = "0.0.3"
|
||||
version = "0.0.4"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
license = "Apache-2.0"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
id = "prisma"
|
||||
name = "Prisma"
|
||||
description = "Prisma support."
|
||||
version = "0.0.3"
|
||||
version = "0.0.4"
|
||||
schema_version = 1
|
||||
authors = ["Matthew Gramigna <matthewgramigna@gmail.com>"]
|
||||
repository = "https://github.com/zed-industries/zed"
|
||||
|
|
25
extensions/prisma/languages/prisma/textobjects.scm
Normal file
25
extensions/prisma/languages/prisma/textobjects.scm
Normal file
|
@ -0,0 +1,25 @@
|
|||
(model_declaration
|
||||
(statement_block
|
||||
"{"
|
||||
(_)* @class.inside
|
||||
"}")) @class.around
|
||||
|
||||
(datasource_declaration
|
||||
(statement_block
|
||||
"{"
|
||||
(_)* @class.inside
|
||||
"}")) @class.around
|
||||
|
||||
(generator_declaration
|
||||
(statement_block
|
||||
"{"
|
||||
(_)* @class.inside
|
||||
"}")) @class.around
|
||||
|
||||
(enum_declaration
|
||||
(enum_block
|
||||
"{"
|
||||
(_)* @class.inside
|
||||
"}")) @class.around
|
||||
|
||||
(developer_comment)+ @comment.around
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "zed_proto"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
license = "Apache-2.0"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
id = "proto"
|
||||
name = "Proto"
|
||||
description = "Protocol Buffers support."
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
schema_version = 1
|
||||
authors = ["Zed Industries <support@zed.dev>"]
|
||||
repository = "https://github.com/zed-industries/zed"
|
||||
|
|
18
extensions/proto/languages/proto/textobjects.scm
Normal file
18
extensions/proto/languages/proto/textobjects.scm
Normal file
|
@ -0,0 +1,18 @@
|
|||
(message (message_body
|
||||
"{"
|
||||
(_)* @class.inside
|
||||
"}")) @class.around
|
||||
(enum (enum_body
|
||||
"{"
|
||||
(_)* @class.inside
|
||||
"}")) @class.around
|
||||
(service
|
||||
"service"
|
||||
(_)
|
||||
"{"
|
||||
(_)* @class.inside
|
||||
"}") @class.around
|
||||
|
||||
(rpc) @function.around
|
||||
|
||||
(comment)+ @comment.around
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "zed_toml"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
license = "Apache-2.0"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
id = "toml"
|
||||
name = "TOML"
|
||||
description = "TOML support."
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
schema_version = 1
|
||||
authors = [
|
||||
"Max Brunsfeld <max@zed.dev>",
|
||||
|
|
6
extensions/toml/languages/toml/textobjects.scm
Normal file
6
extensions/toml/languages/toml/textobjects.scm
Normal file
|
@ -0,0 +1,6 @@
|
|||
(comment)+ @comment
|
||||
(table "[" (_) "]"
|
||||
(_)* @class.inside) @class.around
|
||||
|
||||
(table_array_element "[[" (_) "]]"
|
||||
(_)* @class.inside) @class.around
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "zed_zig"
|
||||
version = "0.3.1"
|
||||
version = "0.3.2"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
license = "Apache-2.0"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
id = "zig"
|
||||
name = "Zig"
|
||||
description = "Zig support."
|
||||
version = "0.3.1"
|
||||
version = "0.3.2"
|
||||
schema_version = 1
|
||||
authors = ["Allan Calix <contact@acx.dev>"]
|
||||
repository = "https://github.com/zed-industries/zed"
|
||||
|
|
27
extensions/zig/languages/zig/textobjects.scm
Normal file
27
extensions/zig/languages/zig/textobjects.scm
Normal file
|
@ -0,0 +1,27 @@
|
|||
(function_declaration
|
||||
body: (_
|
||||
"{"
|
||||
(_)* @function.inside
|
||||
"}")) @function.around
|
||||
|
||||
(test_declaration
|
||||
(block
|
||||
"{"
|
||||
(_)* @function.inside
|
||||
"}")) @function.around
|
||||
|
||||
(variable_declaration
|
||||
(struct_declaration
|
||||
"struct"
|
||||
"{"
|
||||
[(_) ","]* @class.inside
|
||||
"}")) @class.around
|
||||
|
||||
(variable_declaration
|
||||
(enum_declaration
|
||||
"enum"
|
||||
"{"
|
||||
(_)* @class.inside
|
||||
"}")) @class.around
|
||||
|
||||
(comment)+ @comment.around
|
|
@ -26,4 +26,3 @@ fi
|
|||
|
||||
sed -i '' -e "s/^version = \".*\"/version = \"$VERSION\"/" "$EXTENSION_TOML"
|
||||
sed -i '' -e "s/^version = \".*\"/version = \"$VERSION\"/" "$CARGO_TOML"
|
||||
cargo check
|
||||
|
|
Loading…
Reference in a new issue