mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 07:14:46 +00:00
formatting
fix formatting fixed last formatting issue Signed-off-by: faldor20 <eli.jambu@yahoo.com>
This commit is contained in:
parent
987e0c6c4b
commit
84e8e61fa5
2 changed files with 9 additions and 18 deletions
|
@ -41,11 +41,7 @@ pub(crate) struct Registry {
|
||||||
|
|
||||||
impl Registry {
|
impl Registry {
|
||||||
pub async fn get_latest_version(&self, url: &Url) -> Option<i32> {
|
pub async fn get_latest_version(&self, url: &Url) -> Option<i32> {
|
||||||
self.documents
|
self.documents.lock().await.get(url).map(|x| x.info.version)
|
||||||
.lock()
|
|
||||||
.await
|
|
||||||
.get(url)
|
|
||||||
.map(|x| x.info.version)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_document(
|
fn update_document(
|
||||||
|
@ -54,8 +50,9 @@ impl Registry {
|
||||||
updating_url: &Url,
|
updating_url: &Url,
|
||||||
) {
|
) {
|
||||||
if &document.doc_info.url == updating_url {
|
if &document.doc_info.url == updating_url {
|
||||||
if let Some(a) = documents
|
if let Some(a) = documents.get_mut(updating_url) {
|
||||||
.get_mut(updating_url) { a.latest_document.set(document.clone()).unwrap() }
|
a.latest_document.set(document.clone()).unwrap()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let url = document.url().clone();
|
let url = document.url().clone();
|
||||||
|
@ -146,9 +143,8 @@ impl Registry {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn diagnostics(&self, url: &Url) -> Vec<Diagnostic> {
|
pub async fn diagnostics(&self, url: &Url) -> Vec<Diagnostic> {
|
||||||
let Some( document) = self.latest_document_by_url(url).await else {
|
let Some(document) = self.latest_document_by_url(url).await else {
|
||||||
return vec![];
|
return vec![];
|
||||||
|
|
||||||
};
|
};
|
||||||
document.diagnostics()
|
document.diagnostics()
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,9 +118,7 @@ impl RocServerState {
|
||||||
&self.registry
|
&self.registry
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn close(&self, _fi: Url) {
|
async fn close(&self, _fi: Url) {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn change(
|
pub async fn change(
|
||||||
&self,
|
&self,
|
||||||
|
@ -312,7 +310,7 @@ impl LanguageServer for RocServer {
|
||||||
async fn completion(&self, params: CompletionParams) -> Result<Option<CompletionResponse>> {
|
async fn completion(&self, params: CompletionParams) -> Result<Option<CompletionResponse>> {
|
||||||
let doc = params.text_document_position;
|
let doc = params.text_document_position;
|
||||||
trace!("got completion request");
|
trace!("got completion request");
|
||||||
|
|
||||||
panic_wrapper_async(|| async {
|
panic_wrapper_async(|| async {
|
||||||
self.state
|
self.state
|
||||||
.registry
|
.registry
|
||||||
|
@ -348,14 +346,11 @@ async fn main() {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::{
|
use std::sync::Once;
|
||||||
sync::{Once},
|
|
||||||
};
|
|
||||||
|
|
||||||
use indoc::indoc;
|
|
||||||
use expect_test::expect;
|
use expect_test::expect;
|
||||||
|
use indoc::indoc;
|
||||||
use log::info;
|
use log::info;
|
||||||
|
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue