mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-05 10:20:51 +00:00
Add python outline and bracket queries
This commit is contained in:
parent
074caa09c2
commit
c0dbd8f9b9
3 changed files with 13 additions and 1 deletions
|
@ -1902,7 +1902,7 @@ impl BufferSnapshot {
|
||||||
}
|
}
|
||||||
|
|
||||||
while stack.last().map_or(false, |prev_range| {
|
while stack.last().map_or(false, |prev_range| {
|
||||||
!prev_range.contains(&item_range.start) || !prev_range.contains(&item_range.end)
|
prev_range.start > item_range.start || prev_range.end < item_range.end
|
||||||
}) {
|
}) {
|
||||||
stack.pop();
|
stack.pop();
|
||||||
}
|
}
|
||||||
|
|
3
crates/zed/src/languages/python/brackets.scm
Normal file
3
crates/zed/src/languages/python/brackets.scm
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
("(" @open ")" @close)
|
||||||
|
("[" @open "]" @close)
|
||||||
|
("{" @open "}" @close)
|
9
crates/zed/src/languages/python/outline.scm
Normal file
9
crates/zed/src/languages/python/outline.scm
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
(class_definition
|
||||||
|
"class" @context
|
||||||
|
name: (identifier) @name
|
||||||
|
) @item
|
||||||
|
|
||||||
|
(function_definition
|
||||||
|
"async"? @context
|
||||||
|
"def" @context
|
||||||
|
name: (_) @name) @item
|
Loading…
Reference in a new issue