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 11use anyhow:: Result ;
22use tower_lsp:: async_trait;
3+ use tower_lsp:: lsp_types:: Diagnostic ;
34use tower_lsp:: lsp_types:: MessageActionItem ;
45use tower_lsp:: lsp_types:: MessageType ;
6+ use tower_lsp:: lsp_types:: Url ;
57use tower_lsp:: Client ;
68
79#[ async_trait]
@@ -14,6 +16,12 @@ pub trait Notifier: Send + Sync {
1416 msg : & str ,
1517 actions : Option < Vec < MessageActionItem > > ,
1618 ) -> Result < Option < MessageActionItem > > ;
19+ fn publish_diagnostics (
20+ & self ,
21+ uri : Url ,
22+ diagnostics : Vec < Diagnostic > ,
23+ version : Option < i32 > ,
24+ ) -> Result < ( ) > ;
1725}
1826
1927pub struct TowerLspNotifier {
@@ -56,4 +64,17 @@ impl Notifier for TowerLspNotifier {
5664 let msg = msg. to_string ( ) ;
5765 Ok ( client. show_message_request ( typ, msg, actions) . await ?)
5866 }
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+ }
5980}
You can’t perform that action at this time.
0 commit comments