@@ -24,7 +24,7 @@ use crate::{
2424 line_index:: { LineEndings , LineIndex , PositionEncoding } ,
2525 lsp_ext,
2626 lsp_utils:: invalid_params_error,
27- semantic_tokens, Result ,
27+ semantic_tokens,
2828} ;
2929
3030pub ( crate ) fn position ( line_index : & LineIndex , offset : TextSize ) -> lsp_types:: Position {
@@ -429,7 +429,7 @@ pub(crate) fn inlay_hint(
429429 line_index : & LineIndex ,
430430 render_colons : bool ,
431431 mut inlay_hint : InlayHint ,
432- ) -> Result < lsp_types:: InlayHint > {
432+ ) -> Cancellable < lsp_types:: InlayHint > {
433433 match inlay_hint. kind {
434434 InlayKind :: ParameterHint if render_colons => inlay_hint. label . append_str ( ":" ) ,
435435 InlayKind :: TypeHint if render_colons => inlay_hint. label . prepend_str ( ": " ) ,
@@ -522,7 +522,7 @@ pub(crate) fn inlay_hint(
522522fn inlay_hint_label (
523523 snap : & GlobalStateSnapshot ,
524524 label : InlayHintLabel ,
525- ) -> Result < lsp_types:: InlayHintLabel > {
525+ ) -> Cancellable < lsp_types:: InlayHintLabel > {
526526 Ok ( match label. as_simple_str ( ) {
527527 Some ( s) => lsp_types:: InlayHintLabel :: String ( s. into ( ) ) ,
528528 None => lsp_types:: InlayHintLabel :: LabelParts (
@@ -540,7 +540,7 @@ fn inlay_hint_label(
540540 command : None ,
541541 } )
542542 } )
543- . collect :: < Result < Vec < _ > > > ( ) ?,
543+ . collect :: < Cancellable < Vec < _ > > > ( ) ?,
544544 ) ,
545545 } )
546546}
@@ -798,7 +798,7 @@ pub(crate) fn optional_versioned_text_document_identifier(
798798pub ( crate ) fn location (
799799 snap : & GlobalStateSnapshot ,
800800 frange : FileRange ,
801- ) -> Result < lsp_types:: Location > {
801+ ) -> Cancellable < lsp_types:: Location > {
802802 let url = url ( snap, frange. file_id ) ;
803803 let line_index = snap. file_line_index ( frange. file_id ) ?;
804804 let range = range ( & line_index, frange. range ) ;
@@ -810,7 +810,7 @@ pub(crate) fn location(
810810pub ( crate ) fn location_from_nav (
811811 snap : & GlobalStateSnapshot ,
812812 nav : NavigationTarget ,
813- ) -> Result < lsp_types:: Location > {
813+ ) -> Cancellable < lsp_types:: Location > {
814814 let url = url ( snap, nav. file_id ) ;
815815 let line_index = snap. file_line_index ( nav. file_id ) ?;
816816 let range = range ( & line_index, nav. full_range ) ;
@@ -822,7 +822,7 @@ pub(crate) fn location_link(
822822 snap : & GlobalStateSnapshot ,
823823 src : Option < FileRange > ,
824824 target : NavigationTarget ,
825- ) -> Result < lsp_types:: LocationLink > {
825+ ) -> Cancellable < lsp_types:: LocationLink > {
826826 let origin_selection_range = match src {
827827 Some ( src) => {
828828 let line_index = snap. file_line_index ( src. file_id ) ?;
@@ -844,7 +844,7 @@ pub(crate) fn location_link(
844844fn location_info (
845845 snap : & GlobalStateSnapshot ,
846846 target : NavigationTarget ,
847- ) -> Result < ( lsp_types:: Url , lsp_types:: Range , lsp_types:: Range ) > {
847+ ) -> Cancellable < ( lsp_types:: Url , lsp_types:: Range , lsp_types:: Range ) > {
848848 let line_index = snap. file_line_index ( target. file_id ) ?;
849849
850850 let target_uri = url ( snap, target. file_id ) ;
@@ -858,20 +858,20 @@ pub(crate) fn goto_definition_response(
858858 snap : & GlobalStateSnapshot ,
859859 src : Option < FileRange > ,
860860 targets : Vec < NavigationTarget > ,
861- ) -> Result < lsp_types:: GotoDefinitionResponse > {
861+ ) -> Cancellable < lsp_types:: GotoDefinitionResponse > {
862862 if snap. config . location_link ( ) {
863863 let links = targets
864864 . into_iter ( )
865865 . map ( |nav| location_link ( snap, src, nav) )
866- . collect :: < Result < Vec < _ > > > ( ) ?;
866+ . collect :: < Cancellable < Vec < _ > > > ( ) ?;
867867 Ok ( links. into ( ) )
868868 } else {
869869 let locations = targets
870870 . into_iter ( )
871871 . map ( |nav| {
872872 location ( snap, FileRange { file_id : nav. file_id , range : nav. focus_or_full_range ( ) } )
873873 } )
874- . collect :: < Result < Vec < _ > > > ( ) ?;
874+ . collect :: < Cancellable < Vec < _ > > > ( ) ?;
875875 Ok ( locations. into ( ) )
876876 }
877877}
@@ -885,7 +885,7 @@ pub(crate) fn snippet_text_document_edit(
885885 is_snippet : bool ,
886886 file_id : FileId ,
887887 edit : TextEdit ,
888- ) -> Result < lsp_ext:: SnippetTextDocumentEdit > {
888+ ) -> Cancellable < lsp_ext:: SnippetTextDocumentEdit > {
889889 let text_document = optional_versioned_text_document_identifier ( snap, file_id) ;
890890 let line_index = snap. file_line_index ( file_id) ?;
891891 let mut edits: Vec < _ > =
@@ -962,7 +962,7 @@ pub(crate) fn snippet_text_document_ops(
962962pub ( crate ) fn snippet_workspace_edit (
963963 snap : & GlobalStateSnapshot ,
964964 source_change : SourceChange ,
965- ) -> Result < lsp_ext:: SnippetWorkspaceEdit > {
965+ ) -> Cancellable < lsp_ext:: SnippetWorkspaceEdit > {
966966 let mut document_changes: Vec < lsp_ext:: SnippetDocumentChangeOperation > = Vec :: new ( ) ;
967967
968968 for op in source_change. file_system_edits {
@@ -999,7 +999,7 @@ pub(crate) fn snippet_workspace_edit(
999999pub ( crate ) fn workspace_edit (
10001000 snap : & GlobalStateSnapshot ,
10011001 source_change : SourceChange ,
1002- ) -> Result < lsp_types:: WorkspaceEdit > {
1002+ ) -> Cancellable < lsp_types:: WorkspaceEdit > {
10031003 assert ! ( !source_change. is_snippet) ;
10041004 snippet_workspace_edit ( snap, source_change) . map ( |it| it. into ( ) )
10051005}
@@ -1052,7 +1052,7 @@ impl From<lsp_ext::SnippetTextEdit>
10521052pub ( crate ) fn call_hierarchy_item (
10531053 snap : & GlobalStateSnapshot ,
10541054 target : NavigationTarget ,
1055- ) -> Result < lsp_types:: CallHierarchyItem > {
1055+ ) -> Cancellable < lsp_types:: CallHierarchyItem > {
10561056 let name = target. name . to_string ( ) ;
10571057 let detail = target. description . clone ( ) ;
10581058 let kind = target. kind . map ( symbol_kind) . unwrap_or ( lsp_types:: SymbolKind :: FUNCTION ) ;
@@ -1084,7 +1084,7 @@ pub(crate) fn code_action(
10841084 snap : & GlobalStateSnapshot ,
10851085 assist : Assist ,
10861086 resolve_data : Option < ( usize , lsp_types:: CodeActionParams ) > ,
1087- ) -> Result < lsp_ext:: CodeAction > {
1087+ ) -> Cancellable < lsp_ext:: CodeAction > {
10881088 let mut res = lsp_ext:: CodeAction {
10891089 title : assist. label . to_string ( ) ,
10901090 group : assist. group . filter ( |_| snap. config . code_action_group ( ) ) . map ( |gr| gr. 0 ) ,
@@ -1117,13 +1117,13 @@ pub(crate) fn code_action(
11171117pub ( crate ) fn runnable (
11181118 snap : & GlobalStateSnapshot ,
11191119 runnable : Runnable ,
1120- ) -> Result < lsp_ext:: Runnable > {
1120+ ) -> Cancellable < lsp_ext:: Runnable > {
11211121 let config = snap. config . runnables ( ) ;
11221122 let spec = CargoTargetSpec :: for_file ( snap, runnable. nav . file_id ) ?;
11231123 let workspace_root = spec. as_ref ( ) . map ( |it| it. workspace_root . clone ( ) ) ;
11241124 let target = spec. as_ref ( ) . map ( |s| s. target . clone ( ) ) ;
11251125 let ( cargo_args, executable_args) =
1126- CargoTargetSpec :: runnable_args ( snap, spec, & runnable. kind , & runnable. cfg ) ? ;
1126+ CargoTargetSpec :: runnable_args ( snap, spec, & runnable. kind , & runnable. cfg ) ;
11271127 let label = runnable. label ( target) ;
11281128 let location = location_link ( snap, None , runnable. nav ) ?;
11291129
@@ -1146,7 +1146,7 @@ pub(crate) fn code_lens(
11461146 acc : & mut Vec < lsp_types:: CodeLens > ,
11471147 snap : & GlobalStateSnapshot ,
11481148 annotation : Annotation ,
1149- ) -> Result < ( ) > {
1149+ ) -> Cancellable < ( ) > {
11501150 let client_commands_config = snap. config . client_commands ( ) ;
11511151 match annotation. kind {
11521152 AnnotationKind :: Runnable ( run) => {
0 commit comments