Fix warnings
This commit is contained in:
@@ -11,9 +11,7 @@ use collections::HashSet;
|
|||||||
use gpui::AppContext;
|
use gpui::AppContext;
|
||||||
use highlight_map::HighlightMap;
|
use highlight_map::HighlightMap;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use lsp::FakeLanguageServer;
|
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use postage::prelude::Stream;
|
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::{cell::RefCell, ops::Range, path::Path, str, sync::Arc};
|
use std::{cell::RefCell, ops::Range, path::Path, str, sync::Arc};
|
||||||
use theme::SyntaxTheme;
|
use theme::SyntaxTheme;
|
||||||
@@ -237,6 +235,8 @@ impl Language {
|
|||||||
if let Some(config) = &self.config.language_server {
|
if let Some(config) = &self.config.language_server {
|
||||||
#[cfg(any(test, feature = "test-support"))]
|
#[cfg(any(test, feature = "test-support"))]
|
||||||
if let Some(fake_config) = &config.fake_config {
|
if let Some(fake_config) = &config.fake_config {
|
||||||
|
use postage::prelude::Stream;
|
||||||
|
|
||||||
let (server, mut fake_server) = lsp::LanguageServer::fake_with_capabilities(
|
let (server, mut fake_server) = lsp::LanguageServer::fake_with_capabilities(
|
||||||
fake_config.capabilities.clone(),
|
fake_config.capabilities.clone(),
|
||||||
cx.background().clone(),
|
cx.background().clone(),
|
||||||
@@ -408,7 +408,7 @@ impl LanguageServerConfig {
|
|||||||
|
|
||||||
pub fn set_fake_initializer(
|
pub fn set_fake_initializer(
|
||||||
&mut self,
|
&mut self,
|
||||||
initializer: impl 'static + Send + Sync + Fn(&mut FakeLanguageServer),
|
initializer: impl 'static + Send + Sync + Fn(&mut lsp::FakeLanguageServer),
|
||||||
) {
|
) {
|
||||||
self.fake_config.as_mut().unwrap().initializer = Some(Box::new(initializer));
|
self.fake_config.as_mut().unwrap().initializer = Some(Box::new(initializer));
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-7
@@ -1,5 +1,5 @@
|
|||||||
use anyhow::{anyhow, Context, Result};
|
use anyhow::{anyhow, Context, Result};
|
||||||
use futures::{channel::mpsc, io::BufWriter, AsyncRead, AsyncWrite};
|
use futures::{io::BufWriter, AsyncRead, AsyncWrite};
|
||||||
use gpui::{executor, Task};
|
use gpui::{executor, Task};
|
||||||
use parking_lot::{Mutex, RwLock};
|
use parking_lot::{Mutex, RwLock};
|
||||||
use postage::{barrier, oneshot, prelude::Stream, sink::Sink, watch};
|
use postage::{barrier, oneshot, prelude::Stream, sink::Sink, watch};
|
||||||
@@ -485,8 +485,8 @@ impl Drop for Subscription {
|
|||||||
pub struct FakeLanguageServer {
|
pub struct FakeLanguageServer {
|
||||||
handlers:
|
handlers:
|
||||||
Arc<Mutex<HashMap<&'static str, Box<dyn Send + Sync + FnMut(usize, &[u8]) -> Vec<u8>>>>>,
|
Arc<Mutex<HashMap<&'static str, Box<dyn Send + Sync + FnMut(usize, &[u8]) -> Vec<u8>>>>>,
|
||||||
outgoing_tx: mpsc::UnboundedSender<Vec<u8>>,
|
outgoing_tx: futures::channel::mpsc::UnboundedSender<Vec<u8>>,
|
||||||
incoming_rx: mpsc::UnboundedReceiver<Vec<u8>>,
|
incoming_rx: futures::channel::mpsc::UnboundedReceiver<Vec<u8>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(test, feature = "test-support"))]
|
#[cfg(any(test, feature = "test-support"))]
|
||||||
@@ -527,8 +527,8 @@ impl FakeLanguageServer {
|
|||||||
) -> Self {
|
) -> Self {
|
||||||
use futures::StreamExt as _;
|
use futures::StreamExt as _;
|
||||||
|
|
||||||
let (incoming_tx, incoming_rx) = mpsc::unbounded();
|
let (incoming_tx, incoming_rx) = futures::channel::mpsc::unbounded();
|
||||||
let (outgoing_tx, mut outgoing_rx) = mpsc::unbounded();
|
let (outgoing_tx, mut outgoing_rx) = futures::channel::mpsc::unbounded();
|
||||||
let this = Self {
|
let this = Self {
|
||||||
outgoing_tx: outgoing_tx.clone(),
|
outgoing_tx: outgoing_tx.clone(),
|
||||||
incoming_rx,
|
incoming_rx,
|
||||||
@@ -612,12 +612,15 @@ impl FakeLanguageServer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handle_request<T, F>(&mut self, mut handler: F) -> mpsc::UnboundedReceiver<()>
|
pub fn handle_request<T, F>(
|
||||||
|
&mut self,
|
||||||
|
mut handler: F,
|
||||||
|
) -> futures::channel::mpsc::UnboundedReceiver<()>
|
||||||
where
|
where
|
||||||
T: 'static + request::Request,
|
T: 'static + request::Request,
|
||||||
F: 'static + Send + Sync + FnMut(T::Params) -> T::Result,
|
F: 'static + Send + Sync + FnMut(T::Params) -> T::Result,
|
||||||
{
|
{
|
||||||
let (responded_tx, responded_rx) = mpsc::unbounded();
|
let (responded_tx, responded_rx) = futures::channel::mpsc::unbounded();
|
||||||
self.handlers.lock().insert(
|
self.handlers.lock().insert(
|
||||||
T::METHOD,
|
T::METHOD,
|
||||||
Box::new(move |id, params| {
|
Box::new(move |id, params| {
|
||||||
|
|||||||
Reference in New Issue
Block a user