Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add text objects to extensions #21488

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion extensions/erlang/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zed_erlang"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
publish = false
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion extensions/erlang/extension.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
6 changes: 6 additions & 0 deletions extensions/erlang/languages/erlang/textobjects.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(function_clause
body: (_ "->" (_)* @function.inside)) @function.around

(type_alias ty: (_) @class.inside) @class.around

(comment)+ @comment.around
2 changes: 1 addition & 1 deletion extensions/haskell/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zed_haskell"
version = "0.1.1"
version = "0.1.2"
edition = "2021"
publish = false
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion extensions/haskell/extension.toml
Original file line number Diff line number Diff line change
@@ -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>",
Expand Down
12 changes: 12 additions & 0 deletions extensions/haskell/languages/haskell/textobjects.scm
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion extensions/lua/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zed_lua"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
publish = false
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion extensions/lua/extension.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
7 changes: 7 additions & 0 deletions extensions/lua/languages/lua/textobjects.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(function_definition
body: (_) @function.inside) @function.around

(function_declaration
body: (_) @function.inside) @function.around

(comment)+ @comment.around
2 changes: 1 addition & 1 deletion extensions/php/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zed_php"
version = "0.2.2"
version = "0.2.3"
edition = "2021"
publish = false
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion extensions/php/extension.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
45 changes: 45 additions & 0 deletions extensions/php/languages/php/textobjects.scm
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion extensions/prisma/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zed_prisma"
version = "0.0.3"
version = "0.0.4"
edition = "2021"
publish = false
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion extensions/prisma/extension.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
25 changes: 25 additions & 0 deletions extensions/prisma/languages/prisma/textobjects.scm
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion extensions/proto/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zed_proto"
version = "0.2.0"
version = "0.2.1"
edition = "2021"
publish = false
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion extensions/proto/extension.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
18 changes: 18 additions & 0 deletions extensions/proto/languages/proto/textobjects.scm
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion extensions/toml/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zed_toml"
version = "0.1.1"
version = "0.1.2"
edition = "2021"
publish = false
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion extensions/toml/extension.toml
Original file line number Diff line number Diff line change
@@ -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>",
Expand Down
6 changes: 6 additions & 0 deletions extensions/toml/languages/toml/textobjects.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(comment)+ @comment
(table "[" (_) "]"
(_)* @class.inside) @class.around

(table_array_element "[[" (_) "]]"
(_)* @class.inside) @class.around
2 changes: 1 addition & 1 deletion extensions/zig/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zed_zig"
version = "0.3.1"
version = "0.3.2"
edition = "2021"
publish = false
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion extensions/zig/extension.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
27 changes: 27 additions & 0 deletions extensions/zig/languages/zig/textobjects.scm
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion script/language-extension-version
Original file line number Diff line number Diff line change
Expand Up @@ -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