File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 1
1
use anyhow:: Result ;
2
2
use tower_lsp:: async_trait;
3
+ use tower_lsp:: lsp_types:: Diagnostic ;
3
4
use tower_lsp:: lsp_types:: MessageActionItem ;
4
5
use tower_lsp:: lsp_types:: MessageType ;
6
+ use tower_lsp:: lsp_types:: Url ;
5
7
use tower_lsp:: Client ;
6
8
7
9
#[ async_trait]
@@ -14,6 +16,12 @@ pub trait Notifier: Send + Sync {
14
16
msg : & str ,
15
17
actions : Option < Vec < MessageActionItem > > ,
16
18
) -> Result < Option < MessageActionItem > > ;
19
+ fn publish_diagnostics (
20
+ & self ,
21
+ uri : Url ,
22
+ diagnostics : Vec < Diagnostic > ,
23
+ version : Option < i32 > ,
24
+ ) -> Result < ( ) > ;
17
25
}
18
26
19
27
pub struct TowerLspNotifier {
@@ -56,4 +64,17 @@ impl Notifier for TowerLspNotifier {
56
64
let msg = msg. to_string ( ) ;
57
65
Ok ( client. show_message_request ( typ, msg, actions) . await ?)
58
66
}
67
+
68
+ fn publish_diagnostics (
69
+ & self ,
70
+ uri : Url ,
71
+ diagnostics : Vec < Diagnostic > ,
72
+ version : Option < i32 > ,
73
+ ) -> Result < ( ) > {
74
+ let client = self . client . clone ( ) ;
75
+ tokio:: spawn ( async move {
76
+ client. publish_diagnostics ( uri, diagnostics, version) . await ;
77
+ } ) ;
78
+ Ok ( ( ) )
79
+ }
59
80
}
You can’t perform that action at this time.
0 commit comments