@@ -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 ( ": " ) ,
@@ -518,7 +518,7 @@ pub(crate) fn inlay_hint(
518518fn inlay_hint_label (
519519 snap : & GlobalStateSnapshot ,
520520 label : InlayHintLabel ,
521- ) -> Result < lsp_types:: InlayHintLabel > {
521+ ) -> Cancellable < lsp_types:: InlayHintLabel > {
522522 Ok ( match label. as_simple_str ( ) {
523523 Some ( s) => lsp_types:: InlayHintLabel :: String ( s. into ( ) ) ,
524524 None => lsp_types:: InlayHintLabel :: LabelParts (
@@ -536,7 +536,7 @@ fn inlay_hint_label(
536536 command : None ,
537537 } )
538538 } )
539- . collect :: < Result < Vec < _ > > > ( ) ?,
539+ . collect :: < Cancellable < Vec < _ > > > ( ) ?,
540540 ) ,
541541 } )
542542}
@@ -794,7 +794,7 @@ pub(crate) fn optional_versioned_text_document_identifier(
794794pub ( crate ) fn location (
795795 snap : & GlobalStateSnapshot ,
796796 frange : FileRange ,
797- ) -> Result < lsp_types:: Location > {
797+ ) -> Cancellable < lsp_types:: Location > {
798798 let url = url ( snap, frange. file_id ) ;
799799 let line_index = snap. file_line_index ( frange. file_id ) ?;
800800 let range = range ( & line_index, frange. range ) ;
@@ -806,7 +806,7 @@ pub(crate) fn location(
806806pub ( crate ) fn location_from_nav (
807807 snap : & GlobalStateSnapshot ,
808808 nav : NavigationTarget ,
809- ) -> Result < lsp_types:: Location > {
809+ ) -> Cancellable < lsp_types:: Location > {
810810 let url = url ( snap, nav. file_id ) ;
811811 let line_index = snap. file_line_index ( nav. file_id ) ?;
812812 let range = range ( & line_index, nav. full_range ) ;
@@ -818,7 +818,7 @@ pub(crate) fn location_link(
818818 snap : & GlobalStateSnapshot ,
819819 src : Option < FileRange > ,
820820 target : NavigationTarget ,
821- ) -> Result < lsp_types:: LocationLink > {
821+ ) -> Cancellable < lsp_types:: LocationLink > {
822822 let origin_selection_range = match src {
823823 Some ( src) => {
824824 let line_index = snap. file_line_index ( src. file_id ) ?;
@@ -840,7 +840,7 @@ pub(crate) fn location_link(
840840fn location_info (
841841 snap : & GlobalStateSnapshot ,
842842 target : NavigationTarget ,
843- ) -> Result < ( lsp_types:: Url , lsp_types:: Range , lsp_types:: Range ) > {
843+ ) -> Cancellable < ( lsp_types:: Url , lsp_types:: Range , lsp_types:: Range ) > {
844844 let line_index = snap. file_line_index ( target. file_id ) ?;
845845
846846 let target_uri = url ( snap, target. file_id ) ;
@@ -854,20 +854,20 @@ pub(crate) fn goto_definition_response(
854854 snap : & GlobalStateSnapshot ,
855855 src : Option < FileRange > ,
856856 targets : Vec < NavigationTarget > ,
857- ) -> Result < lsp_types:: GotoDefinitionResponse > {
857+ ) -> Cancellable < lsp_types:: GotoDefinitionResponse > {
858858 if snap. config . location_link ( ) {
859859 let links = targets
860860 . into_iter ( )
861861 . map ( |nav| location_link ( snap, src, nav) )
862- . collect :: < Result < Vec < _ > > > ( ) ?;
862+ . collect :: < Cancellable < Vec < _ > > > ( ) ?;
863863 Ok ( links. into ( ) )
864864 } else {
865865 let locations = targets
866866 . into_iter ( )
867867 . map ( |nav| {
868868 location ( snap, FileRange { file_id : nav. file_id , range : nav. focus_or_full_range ( ) } )
869869 } )
870- . collect :: < Result < Vec < _ > > > ( ) ?;
870+ . collect :: < Cancellable < Vec < _ > > > ( ) ?;
871871 Ok ( locations. into ( ) )
872872 }
873873}
@@ -881,7 +881,7 @@ pub(crate) fn snippet_text_document_edit(
881881 is_snippet : bool ,
882882 file_id : FileId ,
883883 edit : TextEdit ,
884- ) -> Result < lsp_ext:: SnippetTextDocumentEdit > {
884+ ) -> Cancellable < lsp_ext:: SnippetTextDocumentEdit > {
885885 let text_document = optional_versioned_text_document_identifier ( snap, file_id) ;
886886 let line_index = snap. file_line_index ( file_id) ?;
887887 let mut edits: Vec < _ > =
@@ -958,7 +958,7 @@ pub(crate) fn snippet_text_document_ops(
958958pub ( crate ) fn snippet_workspace_edit (
959959 snap : & GlobalStateSnapshot ,
960960 source_change : SourceChange ,
961- ) -> Result < lsp_ext:: SnippetWorkspaceEdit > {
961+ ) -> Cancellable < lsp_ext:: SnippetWorkspaceEdit > {
962962 let mut document_changes: Vec < lsp_ext:: SnippetDocumentChangeOperation > = Vec :: new ( ) ;
963963
964964 for op in source_change. file_system_edits {
@@ -995,7 +995,7 @@ pub(crate) fn snippet_workspace_edit(
995995pub ( crate ) fn workspace_edit (
996996 snap : & GlobalStateSnapshot ,
997997 source_change : SourceChange ,
998- ) -> Result < lsp_types:: WorkspaceEdit > {
998+ ) -> Cancellable < lsp_types:: WorkspaceEdit > {
999999 assert ! ( !source_change. is_snippet) ;
10001000 snippet_workspace_edit ( snap, source_change) . map ( |it| it. into ( ) )
10011001}
@@ -1048,7 +1048,7 @@ impl From<lsp_ext::SnippetTextEdit>
10481048pub ( crate ) fn call_hierarchy_item (
10491049 snap : & GlobalStateSnapshot ,
10501050 target : NavigationTarget ,
1051- ) -> Result < lsp_types:: CallHierarchyItem > {
1051+ ) -> Cancellable < lsp_types:: CallHierarchyItem > {
10521052 let name = target. name . to_string ( ) ;
10531053 let detail = target. description . clone ( ) ;
10541054 let kind = target. kind . map ( symbol_kind) . unwrap_or ( lsp_types:: SymbolKind :: FUNCTION ) ;
@@ -1080,7 +1080,7 @@ pub(crate) fn code_action(
10801080 snap : & GlobalStateSnapshot ,
10811081 assist : Assist ,
10821082 resolve_data : Option < ( usize , lsp_types:: CodeActionParams ) > ,
1083- ) -> Result < lsp_ext:: CodeAction > {
1083+ ) -> Cancellable < lsp_ext:: CodeAction > {
10841084 let mut res = lsp_ext:: CodeAction {
10851085 title : assist. label . to_string ( ) ,
10861086 group : assist. group . filter ( |_| snap. config . code_action_group ( ) ) . map ( |gr| gr. 0 ) ,
@@ -1113,13 +1113,13 @@ pub(crate) fn code_action(
11131113pub ( crate ) fn runnable (
11141114 snap : & GlobalStateSnapshot ,
11151115 runnable : Runnable ,
1116- ) -> Result < lsp_ext:: Runnable > {
1116+ ) -> Cancellable < lsp_ext:: Runnable > {
11171117 let config = snap. config . runnables ( ) ;
11181118 let spec = CargoTargetSpec :: for_file ( snap, runnable. nav . file_id ) ?;
11191119 let workspace_root = spec. as_ref ( ) . map ( |it| it. workspace_root . clone ( ) ) ;
11201120 let target = spec. as_ref ( ) . map ( |s| s. target . clone ( ) ) ;
11211121 let ( cargo_args, executable_args) =
1122- CargoTargetSpec :: runnable_args ( snap, spec, & runnable. kind , & runnable. cfg ) ? ;
1122+ CargoTargetSpec :: runnable_args ( snap, spec, & runnable. kind , & runnable. cfg ) ;
11231123 let label = runnable. label ( target) ;
11241124 let location = location_link ( snap, None , runnable. nav ) ?;
11251125
@@ -1142,7 +1142,7 @@ pub(crate) fn code_lens(
11421142 acc : & mut Vec < lsp_types:: CodeLens > ,
11431143 snap : & GlobalStateSnapshot ,
11441144 annotation : Annotation ,
1145- ) -> Result < ( ) > {
1145+ ) -> Cancellable < ( ) > {
11461146 let client_commands_config = snap. config . client_commands ( ) ;
11471147 match annotation. kind {
11481148 AnnotationKind :: Runnable ( run) => {
0 commit comments