File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ ARG BASE_IMAGE=mcr.microsoft.com/devcontainers/base:trixie
33FROM $BASE_IMAGE
44
55LABEL org.opencontainers.image.source=https://github.com/coder3101/protols
6+ LABEL org.opencontainers.image.description="Development container for protols"
67
78RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
89 && apt-get install -y --no-install-recommends \
Original file line number Diff line number Diff line change @@ -59,6 +59,9 @@ impl ParsedTree {
5959 let name = node. utf8_text ( content) . unwrap ( ) ;
6060 let kind = NodeKind :: to_symbolkind ( & node) ;
6161 let detail = self . find_preceding_comments ( node. id ( ) , content) ;
62+
63+ // Safety: Userdefined nodes usually have a parent as
64+ // the document itself.
6265 let message = node. parent ( ) . unwrap ( ) ;
6366
6467 // https://github.com/rust-lang/rust/issues/102777
Original file line number Diff line number Diff line change @@ -10,7 +10,9 @@ impl ParsedTree {
1010 self . get_node_at_position ( pos)
1111 . filter ( NodeKind :: is_identifier)
1212 . and_then ( |n| {
13- if n. parent ( ) . is_some ( ) && NodeKind :: is_userdefined ( & n. parent ( ) . unwrap ( ) ) {
13+ if let Some ( parent) = n. parent ( )
14+ && NodeKind :: is_userdefined ( & parent)
15+ {
1416 Some ( Range {
1517 start : ts_to_lsp_position ( & n. start_position ( ) ) ,
1618 end : ts_to_lsp_position ( & n. end_position ( ) ) ,
Original file line number Diff line number Diff line change @@ -136,11 +136,11 @@ impl ParsedTree {
136136
137137 pub fn get_user_defined_node < ' a > ( & ' a self , pos : & Position ) -> Option < Node < ' a > > {
138138 self . get_node_at_position ( pos)
139- . map ( |n| {
139+ . and_then ( |n| {
140140 if NodeKind :: is_actionable ( & n) {
141- n
141+ Some ( n )
142142 } else {
143- n. parent ( ) . unwrap ( )
143+ n. parent ( )
144144 }
145145 } )
146146 . filter ( NodeKind :: is_actionable)
You can’t perform that action at this time.
0 commit comments