@@ -24,7 +24,7 @@ use crate::{
24
24
line_index:: { LineEndings , LineIndex , PositionEncoding } ,
25
25
lsp_ext,
26
26
lsp_utils:: invalid_params_error,
27
- semantic_tokens, Result ,
27
+ semantic_tokens,
28
28
} ;
29
29
30
30
pub ( crate ) fn position ( line_index : & LineIndex , offset : TextSize ) -> lsp_types:: Position {
@@ -429,7 +429,7 @@ pub(crate) fn inlay_hint(
429
429
line_index : & LineIndex ,
430
430
render_colons : bool ,
431
431
mut inlay_hint : InlayHint ,
432
- ) -> Result < lsp_types:: InlayHint > {
432
+ ) -> Cancellable < lsp_types:: InlayHint > {
433
433
match inlay_hint. kind {
434
434
InlayKind :: ParameterHint if render_colons => inlay_hint. label . append_str ( ":" ) ,
435
435
InlayKind :: TypeHint if render_colons => inlay_hint. label . prepend_str ( ": " ) ,
@@ -522,7 +522,7 @@ pub(crate) fn inlay_hint(
522
522
fn inlay_hint_label (
523
523
snap : & GlobalStateSnapshot ,
524
524
label : InlayHintLabel ,
525
- ) -> Result < lsp_types:: InlayHintLabel > {
525
+ ) -> Cancellable < lsp_types:: InlayHintLabel > {
526
526
Ok ( match label. as_simple_str ( ) {
527
527
Some ( s) => lsp_types:: InlayHintLabel :: String ( s. into ( ) ) ,
528
528
None => lsp_types:: InlayHintLabel :: LabelParts (
@@ -540,7 +540,7 @@ fn inlay_hint_label(
540
540
command : None ,
541
541
} )
542
542
} )
543
- . collect :: < Result < Vec < _ > > > ( ) ?,
543
+ . collect :: < Cancellable < Vec < _ > > > ( ) ?,
544
544
) ,
545
545
} )
546
546
}
@@ -798,7 +798,7 @@ pub(crate) fn optional_versioned_text_document_identifier(
798
798
pub ( crate ) fn location (
799
799
snap : & GlobalStateSnapshot ,
800
800
frange : FileRange ,
801
- ) -> Result < lsp_types:: Location > {
801
+ ) -> Cancellable < lsp_types:: Location > {
802
802
let url = url ( snap, frange. file_id ) ;
803
803
let line_index = snap. file_line_index ( frange. file_id ) ?;
804
804
let range = range ( & line_index, frange. range ) ;
@@ -810,7 +810,7 @@ pub(crate) fn location(
810
810
pub ( crate ) fn location_from_nav (
811
811
snap : & GlobalStateSnapshot ,
812
812
nav : NavigationTarget ,
813
- ) -> Result < lsp_types:: Location > {
813
+ ) -> Cancellable < lsp_types:: Location > {
814
814
let url = url ( snap, nav. file_id ) ;
815
815
let line_index = snap. file_line_index ( nav. file_id ) ?;
816
816
let range = range ( & line_index, nav. full_range ) ;
@@ -822,7 +822,7 @@ pub(crate) fn location_link(
822
822
snap : & GlobalStateSnapshot ,
823
823
src : Option < FileRange > ,
824
824
target : NavigationTarget ,
825
- ) -> Result < lsp_types:: LocationLink > {
825
+ ) -> Cancellable < lsp_types:: LocationLink > {
826
826
let origin_selection_range = match src {
827
827
Some ( src) => {
828
828
let line_index = snap. file_line_index ( src. file_id ) ?;
@@ -844,7 +844,7 @@ pub(crate) fn location_link(
844
844
fn location_info (
845
845
snap : & GlobalStateSnapshot ,
846
846
target : NavigationTarget ,
847
- ) -> Result < ( lsp_types:: Url , lsp_types:: Range , lsp_types:: Range ) > {
847
+ ) -> Cancellable < ( lsp_types:: Url , lsp_types:: Range , lsp_types:: Range ) > {
848
848
let line_index = snap. file_line_index ( target. file_id ) ?;
849
849
850
850
let target_uri = url ( snap, target. file_id ) ;
@@ -858,20 +858,20 @@ pub(crate) fn goto_definition_response(
858
858
snap : & GlobalStateSnapshot ,
859
859
src : Option < FileRange > ,
860
860
targets : Vec < NavigationTarget > ,
861
- ) -> Result < lsp_types:: GotoDefinitionResponse > {
861
+ ) -> Cancellable < lsp_types:: GotoDefinitionResponse > {
862
862
if snap. config . location_link ( ) {
863
863
let links = targets
864
864
. into_iter ( )
865
865
. map ( |nav| location_link ( snap, src, nav) )
866
- . collect :: < Result < Vec < _ > > > ( ) ?;
866
+ . collect :: < Cancellable < Vec < _ > > > ( ) ?;
867
867
Ok ( links. into ( ) )
868
868
} else {
869
869
let locations = targets
870
870
. into_iter ( )
871
871
. map ( |nav| {
872
872
location ( snap, FileRange { file_id : nav. file_id , range : nav. focus_or_full_range ( ) } )
873
873
} )
874
- . collect :: < Result < Vec < _ > > > ( ) ?;
874
+ . collect :: < Cancellable < Vec < _ > > > ( ) ?;
875
875
Ok ( locations. into ( ) )
876
876
}
877
877
}
@@ -885,7 +885,7 @@ pub(crate) fn snippet_text_document_edit(
885
885
is_snippet : bool ,
886
886
file_id : FileId ,
887
887
edit : TextEdit ,
888
- ) -> Result < lsp_ext:: SnippetTextDocumentEdit > {
888
+ ) -> Cancellable < lsp_ext:: SnippetTextDocumentEdit > {
889
889
let text_document = optional_versioned_text_document_identifier ( snap, file_id) ;
890
890
let line_index = snap. file_line_index ( file_id) ?;
891
891
let mut edits: Vec < _ > =
@@ -962,7 +962,7 @@ pub(crate) fn snippet_text_document_ops(
962
962
pub ( crate ) fn snippet_workspace_edit (
963
963
snap : & GlobalStateSnapshot ,
964
964
source_change : SourceChange ,
965
- ) -> Result < lsp_ext:: SnippetWorkspaceEdit > {
965
+ ) -> Cancellable < lsp_ext:: SnippetWorkspaceEdit > {
966
966
let mut document_changes: Vec < lsp_ext:: SnippetDocumentChangeOperation > = Vec :: new ( ) ;
967
967
968
968
for op in source_change. file_system_edits {
@@ -999,7 +999,7 @@ pub(crate) fn snippet_workspace_edit(
999
999
pub ( crate ) fn workspace_edit (
1000
1000
snap : & GlobalStateSnapshot ,
1001
1001
source_change : SourceChange ,
1002
- ) -> Result < lsp_types:: WorkspaceEdit > {
1002
+ ) -> Cancellable < lsp_types:: WorkspaceEdit > {
1003
1003
assert ! ( !source_change. is_snippet) ;
1004
1004
snippet_workspace_edit ( snap, source_change) . map ( |it| it. into ( ) )
1005
1005
}
@@ -1052,7 +1052,7 @@ impl From<lsp_ext::SnippetTextEdit>
1052
1052
pub ( crate ) fn call_hierarchy_item (
1053
1053
snap : & GlobalStateSnapshot ,
1054
1054
target : NavigationTarget ,
1055
- ) -> Result < lsp_types:: CallHierarchyItem > {
1055
+ ) -> Cancellable < lsp_types:: CallHierarchyItem > {
1056
1056
let name = target. name . to_string ( ) ;
1057
1057
let detail = target. description . clone ( ) ;
1058
1058
let kind = target. kind . map ( symbol_kind) . unwrap_or ( lsp_types:: SymbolKind :: FUNCTION ) ;
@@ -1084,7 +1084,7 @@ pub(crate) fn code_action(
1084
1084
snap : & GlobalStateSnapshot ,
1085
1085
assist : Assist ,
1086
1086
resolve_data : Option < ( usize , lsp_types:: CodeActionParams ) > ,
1087
- ) -> Result < lsp_ext:: CodeAction > {
1087
+ ) -> Cancellable < lsp_ext:: CodeAction > {
1088
1088
let mut res = lsp_ext:: CodeAction {
1089
1089
title : assist. label . to_string ( ) ,
1090
1090
group : assist. group . filter ( |_| snap. config . code_action_group ( ) ) . map ( |gr| gr. 0 ) ,
@@ -1117,13 +1117,13 @@ pub(crate) fn code_action(
1117
1117
pub ( crate ) fn runnable (
1118
1118
snap : & GlobalStateSnapshot ,
1119
1119
runnable : Runnable ,
1120
- ) -> Result < lsp_ext:: Runnable > {
1120
+ ) -> Cancellable < lsp_ext:: Runnable > {
1121
1121
let config = snap. config . runnables ( ) ;
1122
1122
let spec = CargoTargetSpec :: for_file ( snap, runnable. nav . file_id ) ?;
1123
1123
let workspace_root = spec. as_ref ( ) . map ( |it| it. workspace_root . clone ( ) ) ;
1124
1124
let target = spec. as_ref ( ) . map ( |s| s. target . clone ( ) ) ;
1125
1125
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 ) ;
1127
1127
let label = runnable. label ( target) ;
1128
1128
let location = location_link ( snap, None , runnable. nav ) ?;
1129
1129
@@ -1146,7 +1146,7 @@ pub(crate) fn code_lens(
1146
1146
acc : & mut Vec < lsp_types:: CodeLens > ,
1147
1147
snap : & GlobalStateSnapshot ,
1148
1148
annotation : Annotation ,
1149
- ) -> Result < ( ) > {
1149
+ ) -> Cancellable < ( ) > {
1150
1150
let client_commands_config = snap. config . client_commands ( ) ;
1151
1151
match annotation. kind {
1152
1152
AnnotationKind :: Runnable ( run) => {
0 commit comments