mirror of
https://github.com/latex-lsp/texlab.git
synced 2025-08-04 02:39:21 +00:00
Move symbol module into separate crate
This commit is contained in:
parent
dcd021d077
commit
995b44ff67
16 changed files with 45 additions and 13 deletions
16
Cargo.lock
generated
16
Cargo.lock
generated
|
@ -2000,7 +2000,6 @@ dependencies = [
|
|||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"once_cell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"path-clean 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.44 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2011,6 +2010,7 @@ dependencies = [
|
|||
"texlab-distro 0.1.0",
|
||||
"texlab-hover 0.1.0",
|
||||
"texlab-protocol 0.1.0",
|
||||
"texlab-symbol 0.1.0",
|
||||
"texlab-syntax 0.1.0",
|
||||
"texlab-test 0.1.0",
|
||||
"texlab-workspace 0.1.0",
|
||||
|
@ -2114,6 +2114,20 @@ dependencies = [
|
|||
"tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "texlab-symbol"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"futures 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures-boxed 0.1.0",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"texlab-distro 0.1.0",
|
||||
"texlab-protocol 0.1.0",
|
||||
"texlab-syntax 0.1.0",
|
||||
"texlab-workspace 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "texlab-syntax"
|
||||
version = "0.1.0"
|
||||
|
|
|
@ -21,6 +21,7 @@ members = [
|
|||
"crates/texlab_distro",
|
||||
"crates/texlab_hover",
|
||||
"crates/texlab_protocol",
|
||||
"crates/texlab_symbol",
|
||||
"crates/texlab_syntax",
|
||||
"crates/texlab_test",
|
||||
"crates/texlab_workspace"]
|
||||
|
@ -34,7 +35,6 @@ jsonrpc-derive = { path = "crates/jsonrpc_derive" }
|
|||
log = "0.4.6"
|
||||
once_cell = "1.2.0"
|
||||
path-clean = "0.1.0"
|
||||
petgraph = "0.4.13"
|
||||
regex = "1.3.1"
|
||||
serde = { version = "1.0.103", features = ["derive", "rc"] }
|
||||
serde_json = "1.0.44"
|
||||
|
@ -45,6 +45,7 @@ texlab-completion = { path = "crates/texlab_completion" }
|
|||
texlab-distro = { path = "crates/texlab_distro" }
|
||||
texlab-hover = { path = "crates/texlab_hover" }
|
||||
texlab-protocol = { path = "crates/texlab_protocol" }
|
||||
texlab-symbol = { path = "crates/texlab_symbol" }
|
||||
texlab-syntax = { path = "crates/texlab_syntax" }
|
||||
texlab-workspace = { path = "crates/texlab_workspace" }
|
||||
tokio = { version = "0.2", features = ["fs", "process"] }
|
||||
|
|
17
crates/texlab_symbol/Cargo.toml
Normal file
17
crates/texlab_symbol/Cargo.toml
Normal file
|
@ -0,0 +1,17 @@
|
|||
[package]
|
||||
name = "texlab-symbol"
|
||||
version = "0.1.0"
|
||||
authors = [
|
||||
"Eric Förster <efoerster@users.noreply.github.com>",
|
||||
"Patrick Förster <pfoerster@users.noreply.github.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
futures = "0.3"
|
||||
futures-boxed = { path = "../futures_boxed" }
|
||||
log = "0.4.6"
|
||||
petgraph = "0.4.13"
|
||||
texlab-distro = { path = "../texlab_distro" }
|
||||
texlab-protocol = { path = "../texlab_protocol" }
|
||||
texlab-syntax = { path = "../texlab_syntax" }
|
||||
texlab-workspace = { path = "../texlab_workspace" }
|
|
@ -1,5 +1,5 @@
|
|||
use super::{label_name, selection_range};
|
||||
use crate::symbol::{LatexSymbol, LatexSymbolKind};
|
||||
use crate::{LatexSymbol, LatexSymbolKind};
|
||||
use texlab_protocol::Range;
|
||||
use texlab_protocol::RangeExt;
|
||||
use texlab_syntax::*;
|
|
@ -1,5 +1,5 @@
|
|||
use super::{label_name, selection_range};
|
||||
use crate::symbol::{LatexSymbol, LatexSymbolKind};
|
||||
use crate::{LatexSymbol, LatexSymbolKind};
|
||||
use texlab_protocol::Range;
|
||||
use texlab_syntax::*;
|
||||
use texlab_workspace::*;
|
|
@ -1,5 +1,5 @@
|
|||
use super::{label_name, selection_range};
|
||||
use crate::symbol::{LatexSymbol, LatexSymbolKind};
|
||||
use crate::{LatexSymbol, LatexSymbolKind};
|
||||
use texlab_syntax::*;
|
||||
use texlab_workspace::*;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
use super::{label_name, selection_range};
|
||||
use crate::symbol::{LatexSymbol, LatexSymbolKind};
|
||||
use crate::{LatexSymbol, LatexSymbolKind};
|
||||
use texlab_syntax::*;
|
||||
use texlab_workspace::*;
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
use crate::symbol::build_section_tree;
|
||||
use futures_boxed::boxed;
|
||||
use std::sync::Arc;
|
||||
use texlab_protocol::RangeExt;
|
||||
use texlab_protocol::{LocationLink, TextDocumentPositionParams};
|
||||
use texlab_protocol::{LocationLink, RangeExt, TextDocumentPositionParams};
|
||||
use texlab_symbol::build_section_tree;
|
||||
use texlab_syntax::*;
|
||||
use texlab_workspace::*;
|
||||
|
||||
|
|
|
@ -11,4 +11,3 @@ pub mod link;
|
|||
pub mod reference;
|
||||
pub mod rename;
|
||||
pub mod server;
|
||||
pub mod symbol;
|
||||
|
|
|
@ -36,6 +36,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
|||
.module("texlab-distro")
|
||||
.module("texlab-hover")
|
||||
.module("texlab-protocol")
|
||||
.module("texlab-symbol")
|
||||
.module("texlab-syntax")
|
||||
.module("texlab-workspace")
|
||||
.verbosity(matches.occurrences_of("verbosity") as usize)
|
||||
|
|
|
@ -8,7 +8,6 @@ use crate::highlight::HighlightProvider;
|
|||
use crate::link::LinkProvider;
|
||||
use crate::reference::ReferenceProvider;
|
||||
use crate::rename::{PrepareRenameProvider, RenameProvider};
|
||||
use crate::symbol::{self, SymbolProvider};
|
||||
use futures::lock::Mutex;
|
||||
use futures_boxed::boxed;
|
||||
use jsonrpc::server::{Middleware, Result};
|
||||
|
@ -25,6 +24,7 @@ use texlab_completion::{CompletionItemData, CompletionProvider};
|
|||
use texlab_distro::{Distribution, DistributionKind, Language};
|
||||
use texlab_hover::HoverProvider;
|
||||
use texlab_protocol::*;
|
||||
use texlab_symbol::SymbolProvider;
|
||||
use texlab_syntax::*;
|
||||
use texlab_workspace::*;
|
||||
use walkdir::WalkDir;
|
||||
|
@ -300,7 +300,8 @@ impl<C: LspClient + Send + Sync + 'static> LatexLspServer<C> {
|
|||
let client_capabilities = Arc::clone(&self.client_capabilities.get().unwrap());
|
||||
let workspace = self.workspace_manager.get();
|
||||
let symbols =
|
||||
symbol::workspace_symbols(distribution, client_capabilities, workspace, ¶ms).await;
|
||||
texlab_symbol::workspace_symbols(distribution, client_capabilities, workspace, ¶ms)
|
||||
.await;
|
||||
Ok(symbols)
|
||||
}
|
||||
|
||||
|
@ -311,7 +312,7 @@ impl<C: LspClient + Send + Sync + 'static> LatexLspServer<C> {
|
|||
) -> Result<DocumentSymbolResponse> {
|
||||
let request = self.make_feature_request(params.text_document.as_uri(), params)?;
|
||||
let symbols = self.symbol_provider.execute(&request).await;
|
||||
let response = symbol::document_symbols(
|
||||
let response = texlab_symbol::document_symbols(
|
||||
&self.client_capabilities.get().unwrap(),
|
||||
&request.view.workspace,
|
||||
&request.document().uri,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue