File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ use crate::{
1010 from_json,
1111 global_state:: GlobalStateSnapshot ,
1212 line_index:: { LineIndex , OffsetEncoding } ,
13- lsp_ext, Result ,
13+ lsp_ext, LspError , Result ,
1414} ;
1515
1616pub ( crate ) fn abs_path ( url : & lsp_types:: Url ) -> Result < AbsPathBuf > {
@@ -85,7 +85,10 @@ pub(crate) fn annotation(
8585 snap : & GlobalStateSnapshot ,
8686 code_lens : lsp_types:: CodeLens ,
8787) -> Result < Annotation > {
88- let data = code_lens. data . unwrap ( ) ;
88+ let data = code_lens. data . ok_or_else ( || LspError {
89+ code : lsp_server:: ErrorCode :: InvalidParams as i32 ,
90+ message : "code lens without data" . to_string ( ) ,
91+ } ) ;
8992 let resolve = from_json :: < lsp_ext:: CodeLensResolveData > ( "CodeLensResolveData" , data) ?;
9093
9194 match resolve {
Original file line number Diff line number Diff line change @@ -1038,7 +1038,10 @@ pub(crate) fn handle_code_action_resolve(
10381038 let _p = profile:: span ( "handle_code_action_resolve" ) ;
10391039 let params = match code_action. data . take ( ) {
10401040 Some ( it) => it,
1041- None => Err ( "can't resolve code action without data" ) ?,
1041+ None => Err ( LspError {
1042+ code : lsp_server:: ErrorCode :: InvalidParams as i32 ,
1043+ message : format ! ( "code action without data" ) ,
1044+ } ) ?,
10421045 } ;
10431046
10441047 let file_id = from_proto:: file_id ( & snap, & params. code_action_params . text_document . uri ) ?;
You can’t perform that action at this time.
0 commit comments