@ -24,12 +24,14 @@ pub struct Client {
request_counter : AtomicU64 ,
request_counter : AtomicU64 ,
capabilities : Option < lsp ::ServerCapabilities > ,
capabilities : Option < lsp ::ServerCapabilities > ,
offset_encoding : OffsetEncoding ,
offset_encoding : OffsetEncoding ,
config : Option < Value > ,
}
}
impl Client {
impl Client {
pub fn start (
pub fn start (
cmd : & str ,
cmd : & str ,
args : & [ String ] ,
args : & [ String ] ,
config : Option < Value > ,
id : usize ,
id : usize ,
) -> Result < ( Self , UnboundedReceiver < ( usize , Call ) > ) > {
) -> Result < ( Self , UnboundedReceiver < ( usize , Call ) > ) > {
let process = Command ::new ( cmd )
let process = Command ::new ( cmd )
@ -57,6 +59,7 @@ impl Client {
request_counter : AtomicU64 ::new ( 0 ) ,
request_counter : AtomicU64 ::new ( 0 ) ,
capabilities : None ,
capabilities : None ,
offset_encoding : OffsetEncoding ::Utf8 ,
offset_encoding : OffsetEncoding ::Utf8 ,
config ,
} ;
} ;
// TODO: async client.initialize()
// TODO: async client.initialize()
@ -214,13 +217,17 @@ impl Client {
// TODO: delay any requests that are triggered prior to initialize
// TODO: delay any requests that are triggered prior to initialize
let root = find_root ( None ) . and_then ( | root | lsp ::Url ::from_file_path ( root ) . ok ( ) ) ;
let root = find_root ( None ) . and_then ( | root | lsp ::Url ::from_file_path ( root ) . ok ( ) ) ;
if self . config . is_some ( ) {
log ::info ! ( "Using custom LSP config: {}" , self . config . as_ref ( ) . unwrap ( ) ) ;
}
#[ allow(deprecated) ]
#[ allow(deprecated) ]
let params = lsp ::InitializeParams {
let params = lsp ::InitializeParams {
process_id : Some ( std ::process ::id ( ) ) ,
process_id : Some ( std ::process ::id ( ) ) ,
// root_path is obsolete, use root_uri
// root_path is obsolete, use root_uri
root_path : None ,
root_path : None ,
root_uri : root ,
root_uri : root ,
initialization_options : None ,
initialization_options : self . config . clone ( ) ,
capabilities : lsp ::ClientCapabilities {
capabilities : lsp ::ClientCapabilities {
text_document : Some ( lsp ::TextDocumentClientCapabilities {
text_document : Some ( lsp ::TextDocumentClientCapabilities {
completion : Some ( lsp ::CompletionClientCapabilities {
completion : Some ( lsp ::CompletionClientCapabilities {