diff --git a/crates/language/src/buffer.rs b/crates/language/src/buffer.rs index 69d51ce9db..7fb414166d 100644 --- a/crates/language/src/buffer.rs +++ b/crates/language/src/buffer.rs @@ -1902,7 +1902,7 @@ impl BufferSnapshot { } 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(); } diff --git a/crates/zed/src/languages/python/brackets.scm b/crates/zed/src/languages/python/brackets.scm new file mode 100644 index 0000000000..191fd9c084 --- /dev/null +++ b/crates/zed/src/languages/python/brackets.scm @@ -0,0 +1,3 @@ +("(" @open ")" @close) +("[" @open "]" @close) +("{" @open "}" @close) diff --git a/crates/zed/src/languages/python/outline.scm b/crates/zed/src/languages/python/outline.scm new file mode 100644 index 0000000000..373c7c7c68 --- /dev/null +++ b/crates/zed/src/languages/python/outline.scm @@ -0,0 +1,9 @@ +(class_definition + "class" @context + name: (identifier) @name + ) @item + +(function_definition + "async"? @context + "def" @context + name: (_) @name) @item \ No newline at end of file