Skip to content

Commit

Permalink
Revert "Sort symbols by project order"
Browse files Browse the repository at this point in the history
This reverts commit b30046b.
  • Loading branch information
pfoerster committed Sep 23, 2019
1 parent b30046b commit 9b53874
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 119 deletions.
23 changes: 0 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ lsp-types = { version = "0.61.0", features = ["proposed"] }
nom = "5.0.1"
once_cell = "1.2.0"
path-clean = "0.1.0"
petgraph = "0.4.13"
regex = "1.3.1"
serde = { version = "1.0.101", features = ["derive", "rc"] }
serde_json = "1.0.40"
Expand Down
1 change: 0 additions & 1 deletion src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,6 @@ impl<C: LspClient + Send + Sync + 'static> LatexLspServer<C> {
let symbols = self.symbol_provider.execute(&request).await;
let response = SymbolResponse::new(
&self.client_capabilities.get().unwrap(),
&request.view.workspace,
&request.document().uri,
symbols.into_iter().map(Into::into).collect(),
);
Expand Down
17 changes: 5 additions & 12 deletions src/symbol/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
mod bibtex_entry;
mod bibtex_string;
mod latex_section;
mod project_order;

use self::bibtex_entry::BibtexEntrySymbolProvider;
use self::bibtex_string::BibtexStringSymbolProvider;
Expand All @@ -13,7 +12,6 @@ use lsp_types::*;
use serde::{Deserialize, Serialize};
use std::cmp::Reverse;
use std::sync::Arc;
use self::project_order::ProjectOrder;

pub use self::latex_section::{build_section_tree, LatexSectionNode, LatexSectionTree};

Expand Down Expand Up @@ -157,7 +155,6 @@ pub enum SymbolResponse {
impl SymbolResponse {
pub fn new(
client_capabilities: &ClientCapabilities,
workspace: &Workspace,
uri: &Uri,
symbols: Vec<LatexSymbol>,
) -> Self {
Expand All @@ -172,7 +169,7 @@ impl SymbolResponse {
.into_iter()
.map(|symbol| symbol.into_symbol_info(uri.clone()))
.collect();
sort_symbols(workspace, &mut buffer);
sort_symbols(&mut buffer);
Self::Flat(buffer)
}
}
Expand Down Expand Up @@ -233,23 +230,19 @@ pub async fn workspace_symbols(
filtered.push(symbol.info);
}
}
sort_symbols(&workspace, &mut filtered);
sort_symbols(&mut filtered);
filtered
}

fn sort_symbols(workspace: &Workspace, symbols: &mut Vec<SymbolInformation>) {
let order = ProjectOrder::new(workspace);
fn sort_symbols(symbols: &mut Vec<SymbolInformation>) {
symbols.sort_by(|left, right| {
let left_idx = order.rank(workspace, &Uri::from(left.location.uri.clone()));
let left_key = (
left_idx,
left.location.uri.to_string(),
left.location.range.start,
Reverse(left.location.range.end),
);

let right_idx = order.rank(workspace, &Uri::from(right.location.uri.clone()));
let right_key = (
right_idx,
right.location.uri.to_string(),
right.location.range.start,
Reverse(right.location.range.end),
);
Expand Down
82 changes: 0 additions & 82 deletions src/symbol/project_order.rs

This file was deleted.

0 comments on commit 9b53874

Please sign in to comment.