File tree Expand file tree Collapse file tree 2 files changed +4
-8
lines changed
pgt_treesitter/src/context Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ pub fn on_hover(params: OnHoverParams) -> Vec<String> {
109109 . find_schema ( & schema_name)
110110 . map ( Hoverable :: from)
111111 . map ( |s| vec ! [ s] )
112- . unwrap_or ( vec ! [ ] ) ,
112+ . unwrap_or_default ( ) ,
113113
114114 _ => vec ! [ ] ,
115115 } ,
Original file line number Diff line number Diff line change @@ -831,13 +831,9 @@ impl<'a> TreesitterContext<'a> {
831831 NodeUnderCursor :: TsNode ( node) => {
832832 let mut cursor = node. walk ( ) ;
833833 node. parent ( ) . is_some_and ( |p| {
834- for ( i, child) in p. children ( & mut cursor) . enumerate ( ) {
835- if i + 1 == nth && child. id ( ) == node. id ( ) {
836- return true ;
837- }
838- }
839-
840- false
834+ p. children ( & mut cursor)
835+ . nth ( nth - 1 )
836+ . is_some_and ( |n| n. id ( ) == node. id ( ) )
841837 } )
842838 }
843839 NodeUnderCursor :: CustomNode { .. } => false ,
You can’t perform that action at this time.
0 commit comments