@@ -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 ( ": " ) ,
@@ -518,7 +518,7 @@ pub(crate) fn inlay_hint(
518
518
fn inlay_hint_label (
519
519
snap : & GlobalStateSnapshot ,
520
520
label : InlayHintLabel ,
521
- ) -> Result < lsp_types:: InlayHintLabel > {
521
+ ) -> Cancellable < lsp_types:: InlayHintLabel > {
522
522
Ok ( match label. as_simple_str ( ) {
523
523
Some ( s) => lsp_types:: InlayHintLabel :: String ( s. into ( ) ) ,
524
524
None => lsp_types:: InlayHintLabel :: LabelParts (
@@ -536,7 +536,7 @@ fn inlay_hint_label(
536
536
command : None ,
537
537
} )
538
538
} )
539
- . collect :: < Result < Vec < _ > > > ( ) ?,
539
+ . collect :: < Cancellable < Vec < _ > > > ( ) ?,
540
540
) ,
541
541
} )
542
542
}
@@ -794,7 +794,7 @@ pub(crate) fn optional_versioned_text_document_identifier(
794
794
pub ( crate ) fn location (
795
795
snap : & GlobalStateSnapshot ,
796
796
frange : FileRange ,
797
- ) -> Result < lsp_types:: Location > {
797
+ ) -> Cancellable < lsp_types:: Location > {
798
798
let url = url ( snap, frange. file_id ) ;
799
799
let line_index = snap. file_line_index ( frange. file_id ) ?;
800
800
let range = range ( & line_index, frange. range ) ;
@@ -806,7 +806,7 @@ pub(crate) fn location(
806
806
pub ( crate ) fn location_from_nav (
807
807
snap : & GlobalStateSnapshot ,
808
808
nav : NavigationTarget ,
809
- ) -> Result < lsp_types:: Location > {
809
+ ) -> Cancellable < lsp_types:: Location > {
810
810
let url = url ( snap, nav. file_id ) ;
811
811
let line_index = snap. file_line_index ( nav. file_id ) ?;
812
812
let range = range ( & line_index, nav. full_range ) ;
@@ -818,7 +818,7 @@ pub(crate) fn location_link(
818
818
snap : & GlobalStateSnapshot ,
819
819
src : Option < FileRange > ,
820
820
target : NavigationTarget ,
821
- ) -> Result < lsp_types:: LocationLink > {
821
+ ) -> Cancellable < lsp_types:: LocationLink > {
822
822
let origin_selection_range = match src {
823
823
Some ( src) => {
824
824
let line_index = snap. file_line_index ( src. file_id ) ?;
@@ -840,7 +840,7 @@ pub(crate) fn location_link(
840
840
fn location_info (
841
841
snap : & GlobalStateSnapshot ,
842
842
target : NavigationTarget ,
843
- ) -> Result < ( lsp_types:: Url , lsp_types:: Range , lsp_types:: Range ) > {
843
+ ) -> Cancellable < ( lsp_types:: Url , lsp_types:: Range , lsp_types:: Range ) > {
844
844
let line_index = snap. file_line_index ( target. file_id ) ?;
845
845
846
846
let target_uri = url ( snap, target. file_id ) ;
@@ -854,20 +854,20 @@ pub(crate) fn goto_definition_response(
854
854
snap : & GlobalStateSnapshot ,
855
855
src : Option < FileRange > ,
856
856
targets : Vec < NavigationTarget > ,
857
- ) -> Result < lsp_types:: GotoDefinitionResponse > {
857
+ ) -> Cancellable < lsp_types:: GotoDefinitionResponse > {
858
858
if snap. config . location_link ( ) {
859
859
let links = targets
860
860
. into_iter ( )
861
861
. map ( |nav| location_link ( snap, src, nav) )
862
- . collect :: < Result < Vec < _ > > > ( ) ?;
862
+ . collect :: < Cancellable < Vec < _ > > > ( ) ?;
863
863
Ok ( links. into ( ) )
864
864
} else {
865
865
let locations = targets
866
866
. into_iter ( )
867
867
. map ( |nav| {
868
868
location ( snap, FileRange { file_id : nav. file_id , range : nav. focus_or_full_range ( ) } )
869
869
} )
870
- . collect :: < Result < Vec < _ > > > ( ) ?;
870
+ . collect :: < Cancellable < Vec < _ > > > ( ) ?;
871
871
Ok ( locations. into ( ) )
872
872
}
873
873
}
@@ -881,7 +881,7 @@ pub(crate) fn snippet_text_document_edit(
881
881
is_snippet : bool ,
882
882
file_id : FileId ,
883
883
edit : TextEdit ,
884
- ) -> Result < lsp_ext:: SnippetTextDocumentEdit > {
884
+ ) -> Cancellable < lsp_ext:: SnippetTextDocumentEdit > {
885
885
let text_document = optional_versioned_text_document_identifier ( snap, file_id) ;
886
886
let line_index = snap. file_line_index ( file_id) ?;
887
887
let mut edits: Vec < _ > =
@@ -958,7 +958,7 @@ pub(crate) fn snippet_text_document_ops(
958
958
pub ( crate ) fn snippet_workspace_edit (
959
959
snap : & GlobalStateSnapshot ,
960
960
source_change : SourceChange ,
961
- ) -> Result < lsp_ext:: SnippetWorkspaceEdit > {
961
+ ) -> Cancellable < lsp_ext:: SnippetWorkspaceEdit > {
962
962
let mut document_changes: Vec < lsp_ext:: SnippetDocumentChangeOperation > = Vec :: new ( ) ;
963
963
964
964
for op in source_change. file_system_edits {
@@ -995,7 +995,7 @@ pub(crate) fn snippet_workspace_edit(
995
995
pub ( crate ) fn workspace_edit (
996
996
snap : & GlobalStateSnapshot ,
997
997
source_change : SourceChange ,
998
- ) -> Result < lsp_types:: WorkspaceEdit > {
998
+ ) -> Cancellable < lsp_types:: WorkspaceEdit > {
999
999
assert ! ( !source_change. is_snippet) ;
1000
1000
snippet_workspace_edit ( snap, source_change) . map ( |it| it. into ( ) )
1001
1001
}
@@ -1048,7 +1048,7 @@ impl From<lsp_ext::SnippetTextEdit>
1048
1048
pub ( crate ) fn call_hierarchy_item (
1049
1049
snap : & GlobalStateSnapshot ,
1050
1050
target : NavigationTarget ,
1051
- ) -> Result < lsp_types:: CallHierarchyItem > {
1051
+ ) -> Cancellable < lsp_types:: CallHierarchyItem > {
1052
1052
let name = target. name . to_string ( ) ;
1053
1053
let detail = target. description . clone ( ) ;
1054
1054
let kind = target. kind . map ( symbol_kind) . unwrap_or ( lsp_types:: SymbolKind :: FUNCTION ) ;
@@ -1080,7 +1080,7 @@ pub(crate) fn code_action(
1080
1080
snap : & GlobalStateSnapshot ,
1081
1081
assist : Assist ,
1082
1082
resolve_data : Option < ( usize , lsp_types:: CodeActionParams ) > ,
1083
- ) -> Result < lsp_ext:: CodeAction > {
1083
+ ) -> Cancellable < lsp_ext:: CodeAction > {
1084
1084
let mut res = lsp_ext:: CodeAction {
1085
1085
title : assist. label . to_string ( ) ,
1086
1086
group : assist. group . filter ( |_| snap. config . code_action_group ( ) ) . map ( |gr| gr. 0 ) ,
@@ -1113,13 +1113,13 @@ pub(crate) fn code_action(
1113
1113
pub ( crate ) fn runnable (
1114
1114
snap : & GlobalStateSnapshot ,
1115
1115
runnable : Runnable ,
1116
- ) -> Result < lsp_ext:: Runnable > {
1116
+ ) -> Cancellable < lsp_ext:: Runnable > {
1117
1117
let config = snap. config . runnables ( ) ;
1118
1118
let spec = CargoTargetSpec :: for_file ( snap, runnable. nav . file_id ) ?;
1119
1119
let workspace_root = spec. as_ref ( ) . map ( |it| it. workspace_root . clone ( ) ) ;
1120
1120
let target = spec. as_ref ( ) . map ( |s| s. target . clone ( ) ) ;
1121
1121
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 ) ;
1123
1123
let label = runnable. label ( target) ;
1124
1124
let location = location_link ( snap, None , runnable. nav ) ?;
1125
1125
@@ -1142,7 +1142,7 @@ pub(crate) fn code_lens(
1142
1142
acc : & mut Vec < lsp_types:: CodeLens > ,
1143
1143
snap : & GlobalStateSnapshot ,
1144
1144
annotation : Annotation ,
1145
- ) -> Result < ( ) > {
1145
+ ) -> Cancellable < ( ) > {
1146
1146
let client_commands_config = snap. config . client_commands ( ) ;
1147
1147
match annotation. kind {
1148
1148
AnnotationKind :: Runnable ( run) => {
0 commit comments