diff options
author | Norbert Preining <norbert@preining.info> | 2023-02-26 03:02:12 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-02-26 03:02:12 +0000 |
commit | e7ae872926eddb0de09ecfe1c578e0680033955a (patch) | |
tree | 01717465b5b26d3b2ccaea9889c720a840e0a16c /support/texlab/src | |
parent | 81a9d839224eef4c2bd9bf68410b4049c61cdb14 (diff) |
CTAN sync 202302260302
Diffstat (limited to 'support/texlab/src')
119 files changed, 132 insertions, 6503 deletions
diff --git a/support/texlab/src/db/analysis.rs b/support/texlab/src/db/analysis.rs index 79e81c963c..13b5bb1cb3 100644 --- a/support/texlab/src/db/analysis.rs +++ b/support/texlab/src/db/analysis.rs @@ -45,7 +45,7 @@ impl TexLink { let import = latex::Import::cast(node)?; let mut base_dir = import.directory()?.key()?.to_string(); - if !base_dir.ends_with("/") { + if !base_dir.ends_with('/') { base_dir.push('/'); } diff --git a/support/texlab/src/db/diagnostics.rs b/support/texlab/src/db/diagnostics.rs index 81ed24fd2e..8abb856768 100644 --- a/support/texlab/src/db/diagnostics.rs +++ b/support/texlab/src/db/diagnostics.rs @@ -5,7 +5,7 @@ pub mod tex; use lsp_types::{DiagnosticSeverity, NumberOrString, Range}; use rustc_hash::FxHashMap; -use crate::{db::workspace::Workspace, Db}; +use crate::{db::workspace::Workspace, util, Db}; use super::document::{Document, Language}; @@ -139,24 +139,13 @@ pub fn collect_filtered( } if let Some(diagnostics) = all_diagnostics.get(document) { - for diagnostic in diagnostics.iter() { - if !options.allowed_patterns.is_empty() - && !options - .allowed_patterns - .iter() - .any(|pattern| pattern.0.is_match(&diagnostic.message)) - { - continue; - } - - if options - .ignored_patterns - .iter() - .any(|pattern| pattern.0.is_match(&diagnostic.message)) - { - continue; - } - + for diagnostic in diagnostics.iter().filter(|diag| { + util::regex_filter::filter( + &diag.message, + &options.allowed_patterns, + &options.ignored_patterns, + ) + }) { let source = match diagnostic.code { DiagnosticCode::Tex(_) | DiagnosticCode::Bib(_) => "texlab", DiagnosticCode::Log(_) => "latex-build", diff --git a/support/texlab/src/db/discovery.rs b/support/texlab/src/db/discovery.rs index 5986fcd888..12338f745e 100644 --- a/support/texlab/src/db/discovery.rs +++ b/support/texlab/src/db/discovery.rs @@ -110,12 +110,12 @@ pub fn source_dependency( .as_deref() .map_or(false, |dir| path.starts_with(dir)) }) - .flat_map(|path| Url::from_file_path(path)) + .flat_map(Url::from_file_path) .map(|uri| Location::new(db, uri)); for location in file_names .iter() - .filter_map(|file_name| base_dir.join(db, &file_name)) + .filter_map(|file_name| base_dir.join(db, file_name)) .chain(distro_files) { match workspace.lookup(db, location) { diff --git a/support/texlab/src/db/document.rs b/support/texlab/src/db/document.rs index 1fc7d6880c..81ed22e916 100644 --- a/support/texlab/src/db/document.rs +++ b/support/texlab/src/db/document.rs @@ -36,10 +36,10 @@ impl Location { } } - pub fn stem<'db>(self, db: &'db dyn Db) -> Option<&'db str> { - let name = self.uri(db).path_segments()?.last()?; - let stem = name.rsplit_once('.').map_or(name, |(stem, _)| stem); - Some(stem) + pub fn stem(self, db: &dyn Db) -> Option<String> { + let path = self.uri(db).to_file_path().ok()?; + let stem = path.file_stem()?.to_str()?; + Some(String::from(stem)) } pub fn join(self, db: &dyn Db, path: &str) -> Option<Location> { @@ -126,7 +126,7 @@ pub struct Document { impl Document { pub fn edit(self, db: &mut dyn Db, range: TextRange, replace_with: &str) { let mut text = self.contents(db).set_text(db).to(String::new()); - text.replace_range(std::ops::Range::<usize>::from(range), &replace_with); + text.replace_range(std::ops::Range::<usize>::from(range), replace_with); self.contents(db).set_text(db).to(text); self.set_cursor(db).to(range.start()); } diff --git a/support/texlab/src/db/workspace.rs b/support/texlab/src/db/workspace.rs index 8b4d755b09..123d415fd9 100644 --- a/support/texlab/src/db/workspace.rs +++ b/support/texlab/src/db/workspace.rs @@ -190,7 +190,7 @@ impl Workspace { .unwrap_or(".") .to_string(); - if !path.ends_with("/") { + if !path.ends_with('/') { path.push('/'); } diff --git a/support/texlab/src/distro/kpsewhich.rs b/support/texlab/src/distro/kpsewhich.rs index 0a6d1d35ad..24f4a3531a 100644 --- a/support/texlab/src/distro/kpsewhich.rs +++ b/support/texlab/src/distro/kpsewhich.rs @@ -3,9 +3,9 @@ use std::{env, ffi::OsStr, path::PathBuf, process::Command}; use anyhow::Result; pub fn root_directories() -> Result<Vec<PathBuf>> { - let texmf = run(&["-var-value", "TEXMF"])?; + let texmf = run(["-var-value", "TEXMF"])?; let expand_arg = format!("--expand-braces={}", texmf); - let expanded = run(&[&expand_arg])?; + let expanded = run([&expand_arg])?; let directories = env::split_paths(&expanded.replace('!', "")) .filter(|path| path.exists()) .collect(); diff --git a/support/texlab/src/distro/miktex.rs b/support/texlab/src/distro/miktex.rs index fc778752db..1dfe1b9522 100644 --- a/support/texlab/src/distro/miktex.rs +++ b/support/texlab/src/distro/miktex.rs @@ -45,7 +45,7 @@ fn parse_database(bytes: &[u8]) -> io::Result<Vec<PathBuf>> { let mut files = Vec::new(); for i in 0..table_size { - let offset = table_address + i * FNDB_ENTRY_SIZE as u32; + let offset = table_address + i * FNDB_ENTRY_SIZE; reader.set_position(u64::from(offset)); let file_name_offset = read_u32(&mut reader)? as usize; let directory_offset = read_u32(&mut reader)? as usize; diff --git a/support/texlab/src/features/completion/builder.rs b/support/texlab/src/features/completion/builder.rs index f8ea4c5d15..686d39b62b 100644 --- a/support/texlab/src/features/completion/builder.rs +++ b/support/texlab/src/features/completion/builder.rs @@ -60,8 +60,7 @@ impl<'db> CompletionBuilder<'db> { .take_while(|word| word.text_range() != token.text_range()) .chain(std::iter::once(token.clone())) .filter(|word| word.text_range().start() < context.offset) - .join(" ") - .into(), + .join(" "), None => token.text().into(), } } @@ -180,14 +179,7 @@ impl<'db> CompletionBuilder<'db> { "{} {}", key, WHITESPACE_REGEX - .replace_all( - &code - .replace('{', " ") - .replace('}', " ") - .replace(',', " ") - .replace('=', " "), - " " - ) + .replace_all(&code.replace(['{', '}', ',', '='], " "), " ") .trim(), ); diff --git a/support/texlab/src/features/completion/include.rs b/support/texlab/src/features/completion/include.rs index bde7544570..5d7654a208 100644 --- a/support/texlab/src/features/completion/include.rs +++ b/support/texlab/src/features/completion/include.rs @@ -119,7 +119,7 @@ fn current_dir( path.push(graphics_path); } - path.push(&path_text); + path.push(path_text); if !path_text.ends_with('/') { path.pop(); } diff --git a/support/texlab/src/features/folding.rs b/support/texlab/src/features/folding.rs index 153b839f57..91c9571b61 100644 --- a/support/texlab/src/features/folding.rs +++ b/support/texlab/src/features/folding.rs @@ -57,6 +57,7 @@ fn create_range(range: Range) -> FoldingRange { start_character: Some(range.start.character), end_line: range.end.line, end_character: Some(range.end.character), + collapsed_text: None, kind: Some(FoldingRangeKind::Region), } } diff --git a/support/texlab/src/features/forward_search.rs b/support/texlab/src/features/forward_search.rs index 47be702659..8e5a2cc59c 100644 --- a/support/texlab/src/features/forward_search.rs +++ b/support/texlab/src/features/forward_search.rs @@ -15,6 +15,9 @@ pub enum Error { #[error("TeX document '{0}' not found")] TexNotFound(Url), + #[error("TeX document '{0}' is invalid")] + InvalidTexFile(Url), + #[error("PDF document '{0}' not found")] PdfNotFound(PathBuf), @@ -59,8 +62,16 @@ impl Command { .as_deref() .ok_or_else(|| Error::NoLocalFile(uri.clone()))?; - let pdf_name = format!("{}.pdf", parent.location(db).stem(db).unwrap()); - let pdf_path = output_dir.join(pdf_name); + let pdf_path = match parent.location(db).stem(db) { + Some(stem) => { + let pdf_name = format!("{}.pdf", stem); + output_dir.join(pdf_name) + } + None => { + return Err(Error::InvalidTexFile(uri.clone())); + } + }; + if !pdf_path.exists() { return Err(Error::PdfNotFound(pdf_path)); } diff --git a/support/texlab/src/features/symbol.rs b/support/texlab/src/features/symbol.rs index c16193efcb..58004b50ef 100644 --- a/support/texlab/src/features/symbol.rs +++ b/support/texlab/src/features/symbol.rs @@ -9,7 +9,7 @@ use lsp_types::{DocumentSymbolResponse, SymbolInformation, Url, WorkspaceSymbolP use crate::{db::Workspace, util::capabilities::ClientCapabilitiesExt, Db}; -use self::project_order::ProjectOrdering; +use self::{project_order::ProjectOrdering, types::InternalSymbol}; pub fn find_document_symbols(db: &dyn Db, uri: &Url) -> Option<DocumentSymbolResponse> { let workspace = Workspace::get(db); @@ -18,6 +18,11 @@ pub fn find_document_symbols(db: &dyn Db, uri: &Url) -> Option<DocumentSymbolRes let mut buf = Vec::new(); latex::find_symbols(db, document, &mut buf); bibtex::find_symbols(db, document, &mut buf); + + let options = &Workspace::get(db).options(db).symbols; + + InternalSymbol::filter(&mut buf, &options); + if workspace .client_capabilities(db) .has_hierarchical_document_symbol_support() diff --git a/support/texlab/src/features/symbol/types.rs b/support/texlab/src/features/symbol/types.rs index be0ffeceda..fb3bca217b 100644 --- a/support/texlab/src/features/symbol/types.rs +++ b/support/texlab/src/features/symbol/types.rs @@ -2,8 +2,8 @@ use lsp_types::{DocumentSymbol, Location, Range, SymbolInformation, SymbolKind, use crate::{ db::Word, - util::{lang_data::BibtexEntryTypeCategory, lsp_enums::Structure}, - Db, + util::{self, lang_data::BibtexEntryTypeCategory, lsp_enums::Structure}, + Db, SymbolOptions, }; #[derive(Debug, PartialEq, Eq, Clone, Copy)] @@ -80,6 +80,26 @@ impl InternalSymbol { buffer.push(self); } + pub fn filter(container: &mut Vec<InternalSymbol>, options: &SymbolOptions) { + let mut i = 0; + while i < container.len() { + let symbol = &mut container[i]; + + if util::regex_filter::filter( + &symbol.name, + &options.allowed_patterns, + &options.ignored_patterns, + ) { + Self::filter(&mut symbol.children, options); + i += 1; + } else { + drop(symbol); + let mut symbol = container.remove(i); + container.append(&mut symbol.children); + } + } + } + pub fn into_document_symbol(self, db: &dyn Db) -> DocumentSymbol { let children = self .children diff --git a/support/texlab/src/lib.rs b/support/texlab/src/lib.rs index 45b96fb265..46ee3ddd1c 100644 --- a/support/texlab/src/lib.rs +++ b/support/texlab/src/lib.rs @@ -9,9 +9,9 @@ mod options; pub mod parser; mod server; pub mod syntax; -pub(crate) mod util; +pub mod util; -pub use self::{options::*, server::Server}; +pub use self::{client::LspClient, options::*, server::Server}; #[salsa::jar(db = Db)] pub struct Jar( @@ -116,6 +116,3 @@ pub(crate) fn normalize_uri(uri: &mut lsp_types::Url) { uri.set_fragment(None); } - -#[cfg(test)] -mod tests; diff --git a/support/texlab/src/options.rs b/support/texlab/src/options.rs index 6cbba51823..0e87d11fab 100644 --- a/support/texlab/src/options.rs +++ b/support/texlab/src/options.rs @@ -16,6 +16,7 @@ pub struct Options { pub diagnostics_delay: DiagnosticsDelay, pub build: BuildOptions, pub chktex: ChktexOptions, + pub symbols: SymbolOptions, pub latexindent: LatexindentOptions, pub forward_search: ForwardSearchOptions, } @@ -120,12 +121,20 @@ pub struct ForwardSearchOptions { #[serde(rename_all = "camelCase")] #[serde(default)] pub struct DiagnosticsOptions { - pub allowed_patterns: Vec<DiagnosticsPattern>, - pub ignored_patterns: Vec<DiagnosticsPattern>, + pub allowed_patterns: Vec<RegexPattern>, + pub ignored_patterns: Vec<RegexPattern>, +} + +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +#[serde(default)] +pub struct SymbolOptions { + pub allowed_patterns: Vec<RegexPattern>, + pub ignored_patterns: Vec<RegexPattern>, } #[derive(Debug, Clone, Serialize, Deserialize)] -pub struct DiagnosticsPattern(#[serde(with = "serde_regex")] pub Regex); +pub struct RegexPattern(#[serde(with = "serde_regex")] pub Regex); #[derive(Debug, PartialEq, Eq, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] diff --git a/support/texlab/src/parser/build_log.rs b/support/texlab/src/parser/build_log.rs index 1e5eca26f8..635f9adfb4 100644 --- a/support/texlab/src/parser/build_log.rs +++ b/support/texlab/src/parser/build_log.rs @@ -105,11 +105,11 @@ fn prepare_log(log: &str) -> String { } else if line.chars().count() == MAX_LINE_LENGTH { let mut new_line = String::new(); new_line.push_str(line); - while let Some(old_line) = old_lines.next() { - new_line.push_str(old_line); - if old_line.chars().count() != MAX_LINE_LENGTH { - break; - } + for old_line in old_lines.by_ref() { + new_line.push_str(old_line); + if old_line.chars().count() != MAX_LINE_LENGTH { + break; + } } new_lines.push(new_line); } else { diff --git a/support/texlab/src/server.rs b/support/texlab/src/server.rs index fe6f75e74a..567d912435 100644 --- a/support/texlab/src/server.rs +++ b/support/texlab/src/server.rs @@ -173,7 +173,6 @@ impl Server { name: "TexLab".to_owned(), version: Some(env!("CARGO_PKG_VERSION").to_owned()), }), - offset_encoding: None, }; self.connection .initialize_finish(id, serde_json::to_value(result)?)?; @@ -758,6 +757,18 @@ impl Server { Ok(()) } + fn code_actions(&mut self, id: RequestId, _params: CodeActionParams) -> Result<()> { + self.client + .send_response(lsp_server::Response::new_ok(id, Vec::<CodeAction>::new()))?; + Ok(()) + } + + fn code_action_resolve(&mut self, id: RequestId, action: CodeAction) -> Result<()> { + self.client + .send_response(lsp_server::Response::new_ok(id, action))?; + Ok(()) + } + fn handle_file_event(&mut self, event: notify::Event) { let mut changed = false; @@ -823,7 +834,7 @@ impl Server { .on::<DocumentSymbolRequest, _>(|id, params| { self.document_symbols(id, params) })? - .on::<WorkspaceSymbol, _>(|id, params| self.workspace_symbols(id, params))? + .on::<WorkspaceSymbolRequest, _>(|id, params| self.workspace_symbols(id, params))? .on::<Completion, _>(|id, params| { self.completion(id, params)?; Ok(()) @@ -855,6 +866,12 @@ impl Server { .on::<InlayHintResolveRequest,_>(|id, params| { self.inlay_hint_resolve(id, params) })? + .on::<CodeActionRequest, _>(|id, params| { + self.code_actions(id, params) + })? + .on::<CodeActionResolveRequest, _>(|id, params| { + self.code_action_resolve(id, params) + })? .default() { self.connection.sender.send(response.into())?; @@ -983,6 +1000,7 @@ impl From<forward_search::Error> for ForwardSearchStatus { fn from(err: forward_search::Error) -> Self { match err { forward_search::Error::TexNotFound(_) => ForwardSearchStatus::FAILURE, + forward_search::Error::InvalidTexFile(_) => ForwardSearchStatus::ERROR, forward_search::Error::PdfNotFound(_) => ForwardSearchStatus::ERROR, forward_search::Error::NoLocalFile(_) => ForwardSearchStatus::FAILURE, forward_search::Error::Unconfigured => ForwardSearchStatus::UNCONFIGURED, diff --git a/support/texlab/src/tests/client.rs b/support/texlab/src/tests/client.rs deleted file mode 100644 index ff6b23469b..0000000000 --- a/support/texlab/src/tests/client.rs +++ /dev/null @@ -1,159 +0,0 @@ -use std::sync::Once; - -use anyhow::{bail, Result}; -use crossbeam_channel::{Receiver, Sender}; -use lsp_server::{Connection, Message, Notification, Request, Response}; -use lsp_types::{ - notification::{Exit, Initialized}, - request::{Initialize, Shutdown}, - ClientCapabilities, ClientInfo, DidOpenTextDocumentParams, InitializeParams, InitializeResult, - InitializedParams, Url, WorkspaceFolder, -}; -use tempfile::{tempdir, TempDir}; - -use crate::Server; - -static INIT_LOGGER: Once = Once::new(); - -pub struct IncomingHandler { - _handle: jod_thread::JoinHandle<Result<()>>, - pub requests: Receiver<Request>, - pub notifications: Receiver<Notification>, - pub responses: Receiver<Response>, -} - -impl IncomingHandler { - pub fn spawn(receiver: Receiver<Message>) -> Self { - let (req_sender, req_receiver) = crossbeam_channel::unbounded(); - let (not_sender, not_receiver) = crossbeam_channel::unbounded(); - let (res_sender, res_receiver) = crossbeam_channel::unbounded(); - - let _handle = jod_thread::spawn(move || { - for message in &receiver { - match message { - Message::Request(req) => req_sender.send(req)?, - Message::Response(res) => res_sender.send(res)?, - Message::Notification(not) => not_sender.send(not)?, - }; - } - - Ok(()) - }); - - Self { - _handle, - requests: req_receiver, - notifications: not_receiver, - responses: res_receiver, - } - } -} - -pub struct ClientResult { - pub directory: TempDir, - pub incoming: IncomingHandler, -} - -pub struct Client { - outgoing: Sender<Message>, - incoming: IncomingHandler, - directory: TempDir, - request_id: i32, - _handle: jod_thread::JoinHandle, -} - -impl Client { - pub fn spawn() -> Self { - INIT_LOGGER.call_once(|| env_logger::init()); - - let directory = tempdir().unwrap(); - let (client, server) = Connection::memory(); - let incoming = IncomingHandler::spawn(client.receiver); - let outgoing = client.sender; - let server = Server::new(server); - let _handle = jod_thread::spawn(move || { - server.run().expect("server failed to run"); - }); - - Self { - outgoing, - incoming, - directory, - request_id: 0, - _handle, - } - } - - pub fn initialize( - &mut self, - client_capabilities: ClientCapabilities, - client_info: Option<ClientInfo>, - ) -> InitializeResult { - let result = self - .request::<Initialize>(InitializeParams { - initialization_options: Some(serde_json::json!({ "skipDistro": true })), - capabilities: client_capabilities, - workspace_folders: Some(vec![WorkspaceFolder { - name: "Test".into(), - uri: Url::from_directory_path(self.directory.path()).unwrap(), - }]), - client_info, - ..InitializeParams::default() - }) - .unwrap(); - - self.notify::<Initialized>(InitializedParams {}); - result - } - - pub fn request<R: lsp_types::request::Request>( - &mut self, - params: R::Params, - ) -> Result<R::Result> { - self.request_id += 1; - - self.outgoing - .send(Request::new(self.request_id.into(), R::METHOD.into(), params).into()) - .unwrap(); - - let response = self.incoming.responses.recv().unwrap(); - assert_eq!(response.id, self.request_id.into()); - - let result = match response.result { - Some(result) => result, - None => bail!("request failed: {:?}", response.error), - }; - - Ok(serde_json::from_value(result)?) - } - - pub fn notify<N: lsp_types::notification::Notification>(&mut self, params: N::Params) { - self.outgoing - .send(Notification::new(N::METHOD.into(), serde_json::to_value(params).unwrap()).into()) - .unwrap(); - } - - pub fn open(&mut self, name: &str, language_id: &str, text: String) { - self.notify::<lsp_types::notification::DidOpenTextDocument>(DidOpenTextDocumentParams { - text_document: lsp_types::TextDocumentItem { - uri: self.uri(name), - language_id: language_id.to_string(), - version: 0, - text, - }, - }); - } - - pub fn shutdown(mut self) -> ClientResult { - self.request::<Shutdown>(()).unwrap(); - self.notify::<Exit>(()); - ClientResult { - directory: self.directory, - incoming: self.incoming, - } - } - - pub fn uri(&self, name: &str) -> Url { - Url::from_file_path(self.directory.path().join(name)).unwrap() - } -} diff --git a/support/texlab/src/tests/fixture.rs b/support/texlab/src/tests/fixture.rs deleted file mode 100644 index fb2a6e6d69..0000000000 --- a/support/texlab/src/tests/fixture.rs +++ /dev/null @@ -1,126 +0,0 @@ -use std::collections::BTreeMap; - -use lsp_types::{Position, Range, TextDocumentIdentifier, TextDocumentPositionParams}; -use rustc_hash::FxHashMap; - -use super::client::Client; - -#[derive(Debug, PartialEq, Eq, Clone, Hash)] -enum Line<'a> { - File(&'a str, &'a str), - Plain(&'a str), - Range(u32, u32, std::ops::Range<usize>), - Cursor(usize), - Empty, -} - -fn parse_line(line: &str) -> Line { - if let Some(name) = line.strip_prefix("%ROOT ") { - Line::File(name, "texlabroot") - } else if let Some(name) = line.strip_prefix("%TEX ") { - Line::File(name, "latex") - } else if let Some(name) = line.strip_prefix("%BIB ") { - Line::File(name, "bibtex") - } else if let Some(name) = line.strip_prefix("%LOG ") { - Line::File(name, "log") - } else if let Some(text) = line.strip_prefix("%SRC ") { - Line::Plain(text) - } else if let Some(text) = line.strip_prefix("%CUR ") { - let position = text.find('^').unwrap(); - Line::Cursor(position) - } else if line.is_empty() { - Line::Empty - } else { - let key1 = line[1..2].parse().unwrap(); - let key2 = line[3..4].parse().unwrap(); - let line = &line[5..]; - let range = line - .find('^') - .map_or(0..0, |start| start..(line.rfind('^').unwrap() + 1)); - Line::Range(key1, key2, range) - } -} - -#[derive(Debug, Default)] -pub struct FileRange<'a> { - pub name: &'a str, - pub range: Range, -} - -#[derive(Debug, Default)] -pub struct File<'a> { - pub name: &'a str, - pub lang: &'a str, - pub text: String, -} - -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] -pub struct FileCursor<'a> { - pub name: &'a str, - pub position: Position, -} - -impl<'a> FileCursor<'a> { - pub fn into_params(self, server: &Client) -> TextDocumentPositionParams { - let text_document = TextDocumentIdentifier::new(server.uri(self.name)); - TextDocumentPositionParams { - text_document, - position: self.position, - } - } -} - -#[derive(Debug, Default)] -pub struct Fixture<'a> { - pub files: Vec<File<'a>>, - pub cursor: Option<FileCursor<'a>>, - pub ranges: BTreeMap<u32, FxHashMap<u32, FileRange<'a>>>, -} - -pub fn parse(input: &str) -> Fixture { - let mut fixture = Fixture::default(); - let mut file = File::default(); - let mut file_line_index = 0; - for line in input.lines().map(parse_line) { - match line { - Line::File(name, lang) => { - if !file.name.is_empty() { - fixture.files.push(file); - file = File::default(); - } - - file.name = name; - file.lang = lang; - file_line_index = 0; - } - Line::Plain(line) => { - file.text.push_str(line); - file.text.push('\n'); - file_line_index += 1; - } - Line::Range(key1, key2, range) => { - let line = file_line_index - 1; - let start = Position::new(line, range.start.try_into().unwrap()); - let end = Position::new(line, range.end.try_into().unwrap()); - let range = Range::new(start, end); - fixture.ranges.entry(key1).or_default().insert( - key2, - FileRange { - name: file.name, - range, - }, - ); - } - Line::Cursor(position) => { - fixture.cursor = Some(FileCursor { - name: file.name, - position: Position::new(file_line_index - 1, position.try_into().unwrap()), - }); - } - Line::Empty => {} - }; - } - - fixture.files.push(file); - fixture -} diff --git a/support/texlab/src/tests/issues.rs b/support/texlab/src/tests/issues.rs deleted file mode 100644 index 8f578f5ada..0000000000 --- a/support/texlab/src/tests/issues.rs +++ /dev/null @@ -1,12 +0,0 @@ -use insta::assert_debug_snapshot; - -use crate::Options; - -#[test] -fn issue_707() { - assert_debug_snapshot!( - serde_json::from_value::<Option<Options>>(serde_json::json!({})) - .unwrap() - .unwrap_or_default() - ); -} diff --git a/support/texlab/src/tests/snapshots/texlab__tests__issues__issue_707.snap b/support/texlab/src/tests/snapshots/texlab__tests__issues__issue_707.snap deleted file mode 100644 index 38e15f8103..0000000000 --- a/support/texlab/src/tests/snapshots/texlab__tests__issues__issue_707.snap +++ /dev/null @@ -1,45 +0,0 @@ ---- -source: src/tests/issues.rs -expression: "serde_json::from_value::<Option<Options>>(serde_json::json!({})).unwrap().unwrap_or_default()" ---- -Options { - root_directory: None, - aux_directory: None, - bibtex_formatter: Texlab, - latex_formatter: Latexindent, - formatter_line_length: None, - diagnostics: DiagnosticsOptions { - allowed_patterns: [], - ignored_patterns: [], - }, - diagnostics_delay: DiagnosticsDelay( - 300ms, - ), - build: BuildOptions { - executable: BuildExecutable( - "latexmk", - ), - args: BuildArgs( - [ - "-pdf", - "-interaction=nonstopmode", - "-synctex=1", - "%f", - ], - ), - on_save: false, - forward_search_after: false, - }, - chktex: ChktexOptions { - on_open_and_save: false, - on_edit: false, - }, - latexindent: LatexindentOptions { - local: None, - modify_line_breaks: false, - }, - forward_search: ForwardSearchOptions { - executable: None, - args: None, - }, -} diff --git a/support/texlab/src/tests/text_document.rs b/support/texlab/src/tests/text_document.rs deleted file mode 100644 index aac0553ec4..0000000000 --- a/support/texlab/src/tests/text_document.rs +++ /dev/null @@ -1,12 +0,0 @@ -mod completion; -mod definition; -mod did_change_configuration; -mod document_highlight; -mod document_link; -mod document_symbol; -mod folding_range; -mod formatting; -mod hover; -mod inlay_hint; -mod references; -mod rename; diff --git a/support/texlab/src/tests/text_document/completion.rs b/support/texlab/src/tests/text_document/completion.rs deleted file mode 100644 index 7524eb2017..0000000000 --- a/support/texlab/src/tests/text_document/completion.rs +++ /dev/null @@ -1,834 +0,0 @@ -use insta::assert_json_snapshot; -use lsp_types::{ - request::{Completion, ResolveCompletionItem}, - CompletionItem, CompletionList, CompletionParams, CompletionResponse, CompletionTextEdit, - Range, -}; - -use crate::tests::{client::Client, fixture}; - -fn complete(fixture: &str) -> Vec<CompletionItem> { - let mut client = Client::spawn(); - client.initialize( - serde_json::from_value(serde_json::json!({ - "textDocument": { - "completion": { - "completionItem": { - "documentationFormat": ["plaintext", "markdown"] - } - } - } - })) - .unwrap(), - None, - ); - - let fixture = fixture::parse(fixture); - for file in fixture.files { - client.open(file.name, file.lang, file.text); - } - - let range = fixture - .ranges - .values() - .next() - .and_then(|map| map.values().next()) - .map_or_else( - || { - let position = fixture.cursor.unwrap().position; - Range::new(position, position) - }, - |file_range| file_range.range, - ); - - let actual_list = client - .request::<Completion>(CompletionParams { - text_document_position: fixture.cursor.unwrap().into_params(&client), - partial_result_params: Default::default(), - work_done_progress_params: Default::default(), - context: None, - }) - .unwrap() - .map_or(CompletionList::default(), |actual| match actual { - CompletionResponse::List(list) => list, - CompletionResponse::Array(_) => unreachable!(), - }); - - for item in &actual_list.items { - if let Some(CompletionTextEdit::Edit(edit)) = item.text_edit.as_ref() { - assert_eq!(edit.range, range); - } - } - - let actual_items = actual_list - .items - .into_iter() - .take(5) - .map(|item| client.request::<ResolveCompletionItem>(item).unwrap()) - .collect(); - - client.shutdown(); - actual_items -} - -macro_rules! assert_items { - ($items:expr) => { - assert_json_snapshot!($items, { - "[].data" => "[data]", - "[].sortText" => "[sortText]", - "[].documentation" => "[documentation]", - "[].textEdit.range" => "[range]", - "[]" => insta::sorted_redaction() - }); - }; -} - -#[test] -fn acronym_ref_simple() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \newacronym[longplural={Frames per Second}]{fpsLabel}{FPS}{Frame per Second} -%SRC \acrshort{f} -%CUR ^ -%1.1 ^"# - )); -} - -#[test] -fn acronym_ref_empty() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \newacronym[longplural={Frames per Second}]{fpsLabel}{FPS}{Frame per Second} -%SRC \acrshort{} -%CUR ^"# - )); -} - -#[test] -fn acronym_ref_after_group() { - let actual_items = complete( - r#" -%TEX main.tex -%SRC \newacronym[longplural={Frames per Second}]{fpsLabel}{FPS}{Frame per Second} -%SRC \acrshort{} -%CUR ^ -%1.1 ^"#, - ); - - assert_eq!(actual_items, Vec::new()); -} - -#[test] -fn acronym_ref_open_brace() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \newacronym[longplural={Frames per Second}]{fpsLabel}{FPS}{Frame per Second} -%SRC \acrshort{f -%CUR ^ -%1.1 ^"# - )); -} - -#[test] -fn acronym_package_ref() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \acrodef{fpsLabel}[FPS]{Frames per Second} -%SRC \ac{f -%CUR ^ -%1.1 ^"# - )); -} - -#[test] -fn glossary_ref_simple() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \newacronym[longplural={Frames per Second}]{fpsLabel}{FPS}{Frame per Second} -%SRC \gls{f} -%CUR ^ -%1.1 ^"# - )); -} - -#[test] -fn glossary_ref_open_brace() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \newacronym[longplural={Frames per Second}]{fpsLabel}{FPS}{Frame per Second} -%SRC \gls{f -%CUR ^ -%1.1 ^"# - )); -} - -#[test] -fn argument_empty() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \usepackage{amsfonts} -%SRC \mathbb{} -%CUR ^"# - )); -} - -#[test] -fn argument_word() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \usepackage{amsfonts} -%SRC \mathbb{A} -%CUR ^ -%1.1 ^"# - )); -} - -#[test] -fn argument_open_brace() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \usepackage{amsfonts} -%SRC \mathbb{ -%CUR ^ -%SRC Test"# - )); -} - -#[test] -fn argument_open_brace_unrelated() { - let actual_items = complete( - r#" -%TEX main.tex -%SRC \usepackage{amsfonts} -%SRC \mathbb{}{ -%CUR ^ -%SRC Test"#, - ); - - assert_eq!(actual_items, Vec::new()); -} - -#[test] -fn begin_environment_without_snippet_support() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \beg -%CUR ^ -%1.1 ^^^"# - )); -} - -#[test] -fn citation() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \documentclass{article} -%SRC \bibliography{main} -%SRC \begin{document} -%SRC \cite{ -%CUR ^ -%SRC \end{document} - -%BIB main.bib -%SRC @article{foo:2019, -%SRC author = {Foo Bar}, -%SRC title = {Baz Qux}, -%SRC year = {2019}, -%SRC } -%SRC -%SRC @article{bar:2005,}"# - )); -} - -#[test] -fn citation_open_brace() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \addbibresource{main.bib} -%SRC \cite{ -%CUR ^ - -%BIB main.bib -%SRC @article{foo,}"# - )); -} - -#[test] -fn citation_open_brace_multiple() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \addbibresource{main.bib} -%SRC \cite{foo,a -%CUR ^ -%1.1 ^ - -%BIB main.bib -%SRC @article{foo,}"# - )); -} - -#[test] -fn citation_acronym() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \addbibresource{main.bib} -%SRC \DeclareAcronym{foo}{cite={}} -%CUR ^ - -%BIB main.bib -%SRC @article{foo,}"# - )); -} - -#[test] -fn citation_after_brace() { - let actual_items = complete( - r#" -%TEX main.tex -%SRC \documentclass{article} -%SRC \bibliography{main} -%SRC \begin{document} -%SRC \cite{} -%CUR ^ -%SRC \end{document} - -%BIB main.bib -%SRC @article{foo,}"#, - ); - - assert_eq!(actual_items, Vec::new()); -} - -#[test] -fn color_model_definition_simple() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \definecolor{foo}{} -%CUR ^"# - )); -} - -#[test] -fn color_model_definition_open_brace() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \definecolor{foo}{ -%CUR ^"# - )); -} - -#[test] -fn color_model_definition_set_simple() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \definecolorset{} -%CUR ^"# - )); -} - -#[test] -fn color_model_definition_set_open_brace() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \definecolorset{ -%CUR ^"# - )); -} - -#[test] -fn color_simple() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \color{} -%CUR ^"# - )); -} - -#[test] -fn color_word() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \color{re} -%CUR ^ -%1.1 ^^"# - )); -} - -#[test] -fn color_open_brace() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \color{ -%CUR ^"# - )); -} - -#[test] -fn component_command_simple() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \ -%CUR ^"# - )); -} - -#[test] -fn component_command_simple_before() { - let actual_items = complete( - r#" -%TEX main.tex -%SRC \ -%CUR ^"#, - ); - - assert_eq!(actual_items, Vec::new()); -} - -#[test] -fn component_command_simple_package() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \usepackage{lipsum} -%SRC \lips -%CUR ^ -%1.1 ^^^^"# - )); -} - -#[test] -fn component_command_bibtex() { - assert_items!(complete( - r#" -%BIB main.bib -%SRC @article{b, -%SRC c = {\LaT } -%CUR ^ -%1.1 ^^^ -%SRC }"# - )); -} - -#[test] -fn component_environment_simple() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \begin{doc -%CUR ^ -%1.1 ^^^"# - )); -} - -#[test] -fn component_environment_simple_end() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \begin{document} -%SRC \end{ -%CUR ^"# - )); -} - -#[test] -fn component_environment_class() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \documentclass{article} -%SRC \begin{thein} -%CUR ^ -%1.1 ^^^^^"# - )); -} - -#[test] -fn component_environment_command_definition() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \newcommand{\foo}{\begin{doc} -%CUR ^ -%1.1 ^^^"# - )); -} - -#[test] -fn entry_type_at_empty() { - assert_items!(complete( - r#" -%BIB main.bib -%SRC @ -%CUR ^"# - )); -} - -#[test] -fn entry_type_before_preamble() { - assert_items!(complete( - r#" -%BIB main.bib -%SRC @preamble -%CUR ^ -%1.1 ^^^^^^^^"# - )); -} - -#[test] -fn entry_type_before_string() { - assert_items!(complete( - r#" -%BIB main.bib -%SRC @string -%CUR ^ -%1.1 ^^^^^^"# - )); -} - -#[test] -fn entry_type_before_article() { - assert_items!(complete( - r#" -%BIB main.bib -%SRC @article -%CUR ^ -%1.1 ^^^^^^^"# - )); -} - -#[test] -fn entry_type_after_preamble() { - assert_items!(complete( - r#" -%BIB main.bib -%SRC @preamble{ -%CUR ^ -%1.1 ^^^^^^^^"# - )); -} - -#[test] -fn entry_type_after_string() { - assert_items!(complete( - r#" -%BIB main.bib -%SRC @string{ -%CUR ^ -%1.1 ^^^^^^"# - )); -} - -#[test] -fn entry_type_complete_entry() { - assert_items!(complete( - r#" -%BIB main.bib -%SRC @article{foo, author = {foo}} -%CUR ^ -%1.1 ^^^^^^^"# - )); -} - -#[test] -fn field_empty_entry_open() { - assert_items!(complete( - r#" -%BIB main.bib -%SRC @article{foo, -%CUR ^"# - )); -} - -#[test] -fn field_empty_entry_closed() { - assert_items!(complete( - r#" -%BIB main.bib -%SRC @article{foo,} -%CUR ^"# - )); -} - -#[test] -fn field_entry_field_name() { - assert_items!(complete( - r#" -%BIB main.bib -%SRC @article{foo, a -%CUR ^ -%1.1 ^"# - )); -} - -#[test] -fn field_entry_two_fields_name_open() { - assert_items!(complete( - r#" -%BIB main.bib -%SRC @article{foo, author = bar, edit -%CUR ^ -%1.1 ^^^^"# - )); -} - -#[test] -fn field_entry_two_fields_name_closed() { - assert_items!(complete( - r#" -%BIB main.bib -%SRC @article{foo, author = bar, edit} -%CUR ^ -%1.1 ^^^^"# - )); -} - -#[test] -fn import_package_open_brace() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \usepackage{lips -%CUR ^ -%1.1 ^^^^"# - )); -} - -#[test] -fn import_package_closed_brace() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \usepackage{lips} -%CUR ^ -%1.1 ^^^^"# - )); -} - -#[test] -fn import_class_open_brace() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \documentclass{art \foo -%CUR ^ -%1.1 ^^^"# - )); -} - -#[test] -fn import_class_closed_brace() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \documentclass{art} -%CUR ^ -%1.1 ^^^"# - )); -} - -#[test] -fn label() { - assert_items!(complete( - r#" -%TEX foo.tex -%SRC \documentclass{article} -%SRC -%SRC \usepackage{amsmath} -%SRC \usepackage{caption} -%SRC \usepackage{amsthm} -%SRC \newtheorem{lemma}{Lemma} -%SRC -%SRC \begin{document} -%SRC -%SRC \section{Foo}% -%SRC \label{sec:foo} -%SRC -%SRC \begin{equation}% -%SRC \label{eq:foo} -%SRC 1 + 1 = 2 -%SRC \end{equation} -%SRC -%SRC \begin{equation}% -%SRC \label{eq:bar} -%SRC 1 + 1 = 2 -%SRC \end{equation} -%SRC -%SRC \begin{figure}% -%SRC \LaTeX{} -%SRC \caption{Baz}% -%SRC \label{fig:baz} -%SRC \end{figure} -%SRC -%SRC \begin{lemma}% -%SRC \label{thm:foo} -%SRC 1 + 1 = 2 -%SRC \end{lemma} -%SRC -%SRC \include{bar} -%SRC -%SRC \end{document} - -%TEX bar.tex -%SRC \section{Bar}% -%SRC \label{sec:bar} -%SRC -%SRC Lorem ipsum dolor sit amet. -%SRC \ref{} -%CUR ^ - -%TEX foo.aux -%SRC \relax -%SRC \@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Baz\relax }}{1}\protected@file@percent } -%SRC \providecommand*\caption@xref[2]{\@setref\relax\@undefined{#1}} -%SRC \newlabel{fig:baz}{{1}{1}} -%SRC \@writefile{toc}{\contentsline {section}{\numberline {1}Foo}{1}\protected@file@percent } -%SRC \newlabel{sec:foo}{{1}{1}} -%SRC \newlabel{eq:foo}{{1}{1}} -%SRC \newlabel{eq:bar}{{2}{1}} -%SRC \newlabel{thm:foo}{{1}{1}} -%SRC \@input{bar.aux}"# - )); -} - -#[test] -fn theorem_begin() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \newtheorem{lemma}{Lemma} -%SRC \begin{lem -%CUR ^ -%1.1 ^^^"# - )); -} - -#[test] -fn theorem_end() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \newtheorem{lemma}{Lemma} -%SRC \begin{} -%SRC \end{lem -%CUR ^ -%1.1 ^^^"# - )); -} - -#[test] -fn tikz_library_open_brace() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \usepgflibrary{ -%CUR ^"# - )); -} - -#[test] -fn tikz_library_closed_brace() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \usepgflibrary{} -%CUR ^"# - )); -} - -#[test] -fn test_user_command() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \foobar -%SRC \fooba -%CUR ^ -%1.1 ^^^^^ -%SRC \begin{foo} -%SRC \end{foo} -%SRC \begin{fo} -"# - )); -} - -#[test] -fn test_user_environment() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \foobar -%SRC \fooba -%SRC \begin{foo} -%SRC \end{foo} -%SRC \begin{fo} -%CUR ^ -%1.1 ^^ -"# - )); -} - -#[test] -fn test_project_resolution_import() { - assert_items!(complete( - r#" -%TEX main.tex -%SRC \documentclass{article} -%SRC \import{sub}{sub/sub.tex} -%SRC \lipsu -%CUR ^ -%1.1 ^^^^^ - -%TEX sub/sub.tex -%SRC \input{child.tex} - -%TEX sub/child.tex -%SRC \usepackage{lipsum} - -"# - )); -} - -#[test] -fn test_project_resolution_texlabroot() { - assert_items!(complete( - r#" -%TEX src/main.tex -%SRC \documentclass{article} -%SRC \include{src/foo} -%SRC \lipsu -%CUR ^ -%1.1 ^^^^^ - -%TEX src/foo.tex -%SRC \include{src/bar} - -%TEX src/bar.tex -%SRC \usepackage{lipsum} - -%ROOT .texlabroot -"# - )); -} diff --git a/support/texlab/src/tests/text_document/definition.rs b/support/texlab/src/tests/text_document/definition.rs deleted file mode 100644 index b1b915c6c9..0000000000 --- a/support/texlab/src/tests/text_document/definition.rs +++ /dev/null @@ -1,140 +0,0 @@ -use assert_unordered::assert_eq_unordered; -use lsp_types::{ - request::GotoDefinition, ClientCapabilities, GotoDefinitionParams, GotoDefinitionResponse, - LocationLink, -}; - -use crate::tests::{client::Client, fixture}; - -fn check(fixture: &str) { - let mut client = Client::spawn(); - client.initialize(ClientCapabilities::default(), None); - - let fixture = fixture::parse(fixture); - for file in fixture.files { - client.open(file.name, file.lang, file.text); - } - - let mut expected_links = Vec::new(); - for ranges in fixture.ranges.values() { - expected_links.push(LocationLink { - origin_selection_range: Some(ranges[&1].range), - target_uri: client.uri(ranges[&2].name), - target_range: ranges[&2].range, - target_selection_range: ranges[&3].range, - }); - } - - let actual_links = client - .request::<GotoDefinition>(GotoDefinitionParams { - text_document_position_params: fixture.cursor.unwrap().into_params(&client), - partial_result_params: Default::default(), - work_done_progress_params: Default::default(), - }) - .unwrap() - .map_or(Vec::new(), |actual| match actual { - GotoDefinitionResponse::Link(links) => links, - GotoDefinitionResponse::Array(_) | GotoDefinitionResponse::Scalar(_) => unreachable!(), - }); - - client.shutdown(); - assert_eq_unordered!(actual_links, expected_links); -} - -#[test] -fn command_definition() { - check( - r#" -%TEX main.tex -%SRC \DeclareMathOperator{\foo}{foo} -%1.3 ^^^^ -%1.2 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -%SRC \foo -%CUR ^ -%1.1 ^^^^ -"#, - ) -} - -#[test] -fn document() { - check( - r#" -%TEX foo.tex -%SRC \addbibresource{baz.bib} -%CUR ^ -%1.1 ^^^^^^^ - -%TEX bar.bib -%SRC @article{foo, bar = {baz}} - -%TEX baz.bib -%SRC @article{foo, bar = {baz}} -%1.3 -%1.2 -"#, - ) -} - -#[test] -fn entry() { - check( - r#" -%TEX foo.tex -%SRC \addbibresource{baz.bib} -%SRC \cite{foo} -%CUR ^ -%1.1 ^^^ - -%BIB bar.bib -%SRC @article{foo, bar = {baz}} - -%BIB baz.bib -%SRC @article{foo, bar = {baz}} -%1.3 ^^^ -%1.2 ^^^^^^^^^^^^^^^^^^^^^^^^^^ -"#, - ) -} - -#[test] -fn string_simple() { - check( - r#" -%BIB main.bib -%SRC @string{foo = {bar}} -%1.3 ^^^ -%1.2 ^^^^^^^^^^^^^^^^^^^^ -%SRC @article{bar, author = foo} -%CUR ^ -%1.1 ^^^ -"#, - ) -} - -#[test] -fn string_join() { - check( - r#" -%BIB main.bib -%SRC @string{foo = {bar}} -%1.3 ^^^ -%1.2 ^^^^^^^^^^^^^^^^^^^^ -%SRC @article{bar, author = foo # "bar"} -%CUR ^ -%1.1 ^^^ -"#, - ) -} - -#[test] -fn string_field() { - check( - r#" -%BIB main.bib -%SRC @string{foo = {bar}} -%SRC @article{bar, author = foo # "bar"} -%CUR ^ -"#, - ) -} diff --git a/support/texlab/src/tests/text_document/did_change_configuration.rs b/support/texlab/src/tests/text_document/did_change_configuration.rs deleted file mode 100644 index 15aae0ee4b..0000000000 --- a/support/texlab/src/tests/text_document/did_change_configuration.rs +++ /dev/null @@ -1,37 +0,0 @@ -use insta::assert_snapshot; -use lsp_types::{ - notification::{DidChangeConfiguration, Notification, ShowMessage}, - ClientCapabilities, DidChangeConfigurationParams, ShowMessageParams, -}; - -use crate::tests::client::Client; - -#[test] -fn invalid_configuration() { - let mut client = Client::spawn(); - client.initialize(ClientCapabilities::default(), None); - - client.notify::<DidChangeConfiguration>(DidChangeConfigurationParams { - settings: serde_json::json!({ - "diagnostics": { - "allowedPatterns": ["\\"] - } - }), - }); - - let result = client.shutdown(); - let message = result - .incoming - .notifications - .into_iter() - .filter_map(|notification| { - notification - .extract::<ShowMessageParams>(ShowMessage::METHOD) - .ok() - }) - .find(|params| params.message.contains("configuration")) - .unwrap() - .message; - - assert_snapshot!(message); -} diff --git a/support/texlab/src/tests/text_document/document_highlight.rs b/support/texlab/src/tests/text_document/document_highlight.rs deleted file mode 100644 index 01945ce342..0000000000 --- a/support/texlab/src/tests/text_document/document_highlight.rs +++ /dev/null @@ -1,60 +0,0 @@ -use assert_unordered::assert_eq_unordered; -use lsp_types::{ - request::DocumentHighlightRequest, ClientCapabilities, DocumentHighlight, - DocumentHighlightKind, DocumentHighlightParams, -}; - -use crate::tests::{client::Client, fixture}; - -fn check(fixture: &str) { - let mut client = Client::spawn(); - client.initialize(ClientCapabilities::default(), None); - - let fixture = fixture::parse(fixture); - for file in fixture.files { - client.open(file.name, file.lang, file.text); - } - - let mut expected_highlights = Vec::new(); - for ranges in fixture.ranges.values() { - let (i, file_range) = ranges.iter().next().unwrap(); - let kind = match i { - 1 => DocumentHighlightKind::TEXT, - 2 => DocumentHighlightKind::READ, - 3 => DocumentHighlightKind::WRITE, - _ => unreachable!(), - }; - - expected_highlights.push(DocumentHighlight { - range: file_range.range, - kind: Some(kind), - }); - } - - let actual_highlights = client - .request::<DocumentHighlightRequest>(DocumentHighlightParams { - text_document_position_params: fixture.cursor.unwrap().into_params(&client), - partial_result_params: Default::default(), - work_done_progress_params: Default::default(), - }) - .unwrap() - .unwrap_or_default(); - - client.shutdown(); - assert_eq_unordered!(actual_highlights, expected_highlights); -} - -#[test] -fn test_label() { - check( - r#" -%TEX main.tex -%SRC \label{foo} -%CUR ^ -%1.3 ^^^ -%SRC \ref{foo} -%2.2 ^^^ -%SRC \label{bar} -"#, - ) -} diff --git a/support/texlab/src/tests/text_document/document_link.rs b/support/texlab/src/tests/text_document/document_link.rs deleted file mode 100644 index 8b4a30ceeb..0000000000 --- a/support/texlab/src/tests/text_document/document_link.rs +++ /dev/null @@ -1,71 +0,0 @@ -use assert_unordered::assert_eq_unordered; -use lsp_types::{ - request::DocumentLinkRequest, ClientCapabilities, DocumentLink, DocumentLinkParams, - TextDocumentIdentifier, -}; - -use crate::tests::{client::Client, fixture}; - -fn check(fixture: &str) { - let mut client = Client::spawn(); - client.initialize(ClientCapabilities::default(), None); - - let fixture = fixture::parse(fixture); - for file in fixture.files { - client.open(file.name, file.lang, file.text); - } - - let mut expected_links = Vec::new(); - for ranges in fixture.ranges.values() { - expected_links.push(DocumentLink { - range: ranges[&1].range, - target: Some(client.uri(ranges[&2].name)), - tooltip: None, - data: None, - }); - } - - let actual_links = client - .request::<DocumentLinkRequest>(DocumentLinkParams { - text_document: TextDocumentIdentifier::new(client.uri(fixture.cursor.unwrap().name)), - work_done_progress_params: Default::default(), - partial_result_params: Default::default(), - }) - .unwrap() - .unwrap_or_default(); - - client.shutdown(); - assert_eq_unordered!(actual_links, expected_links); -} - -#[test] -fn document_include() { - check( - r#" -%TEX foo.tex -%SRC \input{bar.tex} -%1.1 ^^^^^^^ -%CUR ^ - -%TEX bar.tex -%SRC -%1.2 -"#, - ) -} - -#[test] -fn document_import() { - check( - r#" -%TEX foo.tex -%SRC \import{.}{bar/baz} -%1.1 ^^^^^^^ -%CUR ^ - -%TEX bar/baz.tex -%SRC -%1.2 -"#, - ) -} diff --git a/support/texlab/src/tests/text_document/document_symbol.rs b/support/texlab/src/tests/text_document/document_symbol.rs deleted file mode 100644 index 2eab81631e..0000000000 --- a/support/texlab/src/tests/text_document/document_symbol.rs +++ /dev/null @@ -1,408 +0,0 @@ -use insta::{assert_json_snapshot, internals::Redaction}; -use lsp_types::{ - request::DocumentSymbolRequest, DocumentSymbolParams, DocumentSymbolResponse, - TextDocumentIdentifier, Url, -}; - -use crate::tests::{client::Client, fixture}; - -struct SymbolResult { - response: Option<DocumentSymbolResponse>, - uri_redaction: Redaction, -} - -fn find_symbols(fixture: &str, client_capabilities: serde_json::Value) -> SymbolResult { - let mut client = Client::spawn(); - client.initialize(serde_json::from_value(client_capabilities).unwrap(), None); - - let fixture = fixture::parse(fixture); - let file = fixture.files.into_iter().next().unwrap(); - client.open(file.name, file.lang, file.text); - - let response = client - .request::<DocumentSymbolRequest>(DocumentSymbolParams { - text_document: TextDocumentIdentifier::new(client.uri(file.name)), - work_done_progress_params: Default::default(), - partial_result_params: Default::default(), - }) - .unwrap(); - - let result = client.shutdown(); - - let uri = Url::from_directory_path(result.directory.path()).unwrap(); - let uri_redaction = insta::dynamic_redaction(move |content, _path| { - content.as_str().unwrap().replace(uri.as_str(), "[tmp]/") - }); - - SymbolResult { - response, - uri_redaction, - } -} - -macro_rules! assert_symbols { - ($result:expr) => { - let result = $result; - assert_json_snapshot!(result.response, { - "[].location.uri" => result.uri_redaction - }); - }; -} - -#[test] -fn enumerate_nested() { - assert_symbols!(find_symbols( - r#" -%TEX main.tex -%SRC \documentclass{article} -%SRC -%SRC \begin{document} -%SRC -%SRC \begin{enumerate} -%SRC \item\label{it:foo} Foo -%SRC \item\label{it:bar} Bar -%SRC \item[Baz] Baz -%SRC \item[Qux]\label{it:qux} Qux -%SRC \end{enumerate} -%SRC -%SRC \end{document} - -%TEX main.aux -%SRC \relax -%SRC \newlabel{it:foo}{{1}{1}} -%SRC \newlabel{it:qux}{{2}{1}} -"#, - serde_json::json!({ - "textDocument": { - "documentSymbol": { - "hierarchicalDocumentSymbolSupport": true, - }, - }, - }), - )); -} - -#[test] -fn enumerate_flat() { - assert_symbols!(find_symbols( - r#" -%TEX main.tex -%SRC \documentclass{article} -%SRC -%SRC \begin{document} -%SRC -%SRC \begin{enumerate} -%SRC \item\label{it:foo} Foo -%SRC \item\label{it:bar} Bar -%SRC \item[Baz] Baz -%SRC \item[Qux]\label{it:qux} Qux -%SRC \end{enumerate} -%SRC -%SRC \end{document} - -%TEX main.aux -%SRC \relax -%SRC \newlabel{it:foo}{{1}{1}} -%SRC \newlabel{it:qux}{{2}{1}} -"#, - serde_json::json!({}), - )); -} - -#[test] -fn equation_nested() { - assert_symbols!(find_symbols( - r#" -%TEX main.tex -%SRC \documentclass{article} -%SRC -%SRC \begin{document} -%SRC -%SRC \begin{equation}\label{eq:foo} -%SRC Foo -%SRC \end{equation} -%SRC -%SRC \begin{equation}\label{eq:bar} -%SRC Bar -%SRC \end{equation} -%SRC -%SRC \begin{equation} -%SRC Baz -%SRC \end{equation} -%SRC -%SRC \end{document} - -%TEX main.aux -%SRC \relax -%SRC \newlabel{eq:foo}{{1}{1}} -"#, - serde_json::json!({ - "textDocument": { - "documentSymbol": { - "hierarchicalDocumentSymbolSupport": true, - }, - }, - }), - )); -} - -#[test] -fn equation_flat() { - assert_symbols!(find_symbols( - r#" -%TEX main.tex -%SRC \documentclass{article} -%SRC -%SRC \begin{document} -%SRC -%SRC \begin{equation}\label{eq:foo} -%SRC Foo -%SRC \end{equation} -%SRC -%SRC \begin{equation}\label{eq:bar} -%SRC Bar -%SRC \end{equation} -%SRC -%SRC \begin{equation} -%SRC Baz -%SRC \end{equation} -%SRC -%SRC \end{document} - -%TEX main.aux -%SRC \relax -%SRC \newlabel{eq:foo}{{1}{1}} -"#, - serde_json::json!({}), - )); -} - -#[test] -fn float_nested() { - assert_symbols!(find_symbols( - r#" -%TEX main.tex -%SRC \documentclass{article} -%SRC -%SRC \begin{document} -%SRC -%SRC \begin{figure} -%SRC Foo -%SRC \caption{Foo}\label{fig:foo} -%SRC \end{figure} -%SRC -%SRC \begin{figure} -%SRC Bar -%SRC \caption{Bar}\label{fig:bar} -%SRC \end{figure} -%SRC -%SRC \begin{figure} -%SRC Baz -%SRC \caption{Baz} -%SRC \end{figure} -%SRC -%SRC \begin{figure} -%SRC Qux -%SRC \end{figure} -%SRC -%SRC \end{document} - -%TEX main.aux -%SRC \relax -%SRC \@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Foo}}{1}\protected@file@percent } -%SRC \newlabel{fig:foo}{{1}{1}} -%SRC \@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces Bar}}{1}\protected@file@percent } -%SRC \@writefile{lof}{\contentsline {figure}{\numberline {3}{\ignorespaces Baz}}{1}\protected@file@percent } -"#, - serde_json::json!({ - "textDocument": { - "documentSymbol": { - "hierarchicalDocumentSymbolSupport": true, - }, - }, - }), - )); -} - -#[test] -fn float_flat() { - assert_symbols!(find_symbols( - r#" -%TEX main.tex -%SRC \documentclass{article} -%SRC -%SRC \begin{document} -%SRC -%SRC \begin{figure} -%SRC Foo -%SRC \caption{Foo}\label{fig:foo} -%SRC \end{figure} -%SRC -%SRC \begin{figure} -%SRC Bar -%SRC \caption{Bar}\label{fig:bar} -%SRC \end{figure} -%SRC -%SRC \begin{figure} -%SRC Baz -%SRC \caption{Baz} -%SRC \end{figure} -%SRC -%SRC \begin{figure} -%SRC Qux -%SRC \end{figure} -%SRC -%SRC \end{document} - -%TEX main.aux -%SRC \relax -%SRC \@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Foo}}{1}\protected@file@percent } -%SRC \newlabel{fig:foo}{{1}{1}} -%SRC \@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces Bar}}{1}\protected@file@percent } -%SRC \@writefile{lof}{\contentsline {figure}{\numberline {3}{\ignorespaces Baz}}{1}\protected@file@percent } -"#, - serde_json::json!({}), - )); -} - -#[test] -fn section_nested() { - assert_symbols!(find_symbols( - r#" -%TEX main.tex -%SRC \documentclass{article} -%SRC -%SRC \begin{document} -%SRC -%SRC \section{Foo} -%SRC -%SRC \section{Bar}\label{sec:bar} -%SRC -%SRC \subsection{Baz}\label{sec:baz} -%SRC -%SRC \end{document} - -%TEX main.aux -%SRC \relax -%SRC \@writefile{toc}{\contentsline {section}{\numberline {1}Foo}{1}\protected@file@percent } -%SRC \@writefile{toc}{\contentsline {section}{\numberline {2}Bar}{1}\protected@file@percent } -%SRC \newlabel{sec:bar}{{2}{1}} -"#, - serde_json::json!({ - "textDocument": { - "documentSymbol": { - "hierarchicalDocumentSymbolSupport": true, - }, - }, - }), - )); -} - -#[test] -fn section_flat() { - assert_symbols!(find_symbols( - r#" -%TEX main.tex -%SRC \documentclass{article} -%SRC -%SRC \begin{document} -%SRC -%SRC \section{Foo} -%SRC -%SRC \section{Bar}\label{sec:bar} -%SRC -%SRC \subsection{Baz}\label{sec:baz} -%SRC -%SRC \end{document} - -%TEX main.aux -%SRC \relax -%SRC \@writefile{toc}{\contentsline {section}{\numberline {1}Foo}{1}\protected@file@percent } -%SRC \@writefile{toc}{\contentsline {section}{\numberline {2}Bar}{1}\protected@file@percent } -%SRC \newlabel{sec:bar}{{2}{1}} -"#, - serde_json::json!({}), - )); -} - -#[test] -fn theorem_nested() { - assert_symbols!(find_symbols( - r#" -%TEX main.tex -%SRC \documentclass{article} -%SRC \usepackage{amsthm} -%SRC \newtheorem{lemma}{Lemma} -%SRC -%SRC \begin{document} -%SRC -%SRC \begin{lemma}[Foo]\label{thm:foo} -%SRC Foo -%SRC \end{lemma} -%SRC -%SRC \begin{lemma}\label{thm:bar} -%SRC Bar -%SRC \end{lemma} -%SRC -%SRC \begin{lemma}\label{thm:baz} -%SRC Baz -%SRC \end{lemma} -%SRC -%SRC \begin{lemma}[Qux] -%SRC Qux -%SRC \end{lemma} -%SRC -%SRC \end{document} - -%TEX main.aux -%SRC \relax -%SRC \newlabel{thm:foo}{{1}{1}} -%SRC \newlabel{thm:bar}{{2}{1}} -"#, - serde_json::json!({ - "textDocument": { - "documentSymbol": { - "hierarchicalDocumentSymbolSupport": true, - }, - }, - }), - )); -} - -#[test] -fn theorem_flat() { - assert_symbols!(find_symbols( - r#" -%TEX main.tex -%SRC \documentclass{article} -%SRC \usepackage{amsthm} -%SRC \newtheorem{lemma}{Lemma} -%SRC -%SRC \begin{document} -%SRC -%SRC \begin{lemma}[Foo]\label{thm:foo} -%SRC Foo -%SRC \end{lemma} -%SRC -%SRC \begin{lemma}\label{thm:bar} -%SRC Bar -%SRC \end{lemma} -%SRC -%SRC \begin{lemma}\label{thm:baz} -%SRC Baz -%SRC \end{lemma} -%SRC -%SRC \begin{lemma}[Qux] -%SRC Qux -%SRC \end{lemma} -%SRC -%SRC \end{document} - -%TEX main.aux -%SRC \relax -%SRC \newlabel{thm:foo}{{1}{1}} -%SRC \newlabel{thm:bar}{{2}{1}} -"#, - serde_json::json!({}), - )); -} diff --git a/support/texlab/src/tests/text_document/folding_range.rs b/support/texlab/src/tests/text_document/folding_range.rs deleted file mode 100644 index 4b589222b1..0000000000 --- a/support/texlab/src/tests/text_document/folding_range.rs +++ /dev/null @@ -1,96 +0,0 @@ -use assert_unordered::assert_eq_unordered; -use lsp_types::{ - request::FoldingRangeRequest, ClientCapabilities, FoldingRange, FoldingRangeKind, - FoldingRangeParams, TextDocumentIdentifier, -}; - -use crate::tests::{client::Client, fixture}; - -fn check(fixture: &str, expected_ranges: Vec<(u32, u32, u32, u32)>) { - let mut client = Client::spawn(); - client.initialize(ClientCapabilities::default(), None); - - let fixture = fixture::parse(fixture); - for file in fixture.files { - client.open(file.name, file.lang, file.text); - } - - let actual_foldings = client - .request::<FoldingRangeRequest>(FoldingRangeParams { - text_document: TextDocumentIdentifier::new(client.uri(fixture.cursor.unwrap().name)), - work_done_progress_params: Default::default(), - partial_result_params: Default::default(), - }) - .unwrap() - .unwrap_or_default(); - - client.shutdown(); - - let expected_foldings = expected_ranges - .into_iter() - .map( - |(start_line, start_character, end_line, end_character)| FoldingRange { - start_line, - start_character: Some(start_character), - end_line, - end_character: Some(end_character), - kind: Some(FoldingRangeKind::Region), - }, - ) - .collect(); - - assert_eq_unordered!(actual_foldings, expected_foldings); -} - -#[test] -fn latex() { - check( - r#" -%TEX main.tex -%SRC \begin{document} -%SRC \section{Foo} -%SRC foo -%SRC \subsection{Bar} -%SRC bar -%SRC \section{Baz} -%SRC baz -%SRC \section{Qux} -%SRC \end{document} -%CUR ^ -"#, - vec![ - (0, 0, 8, 14), - (1, 4, 4, 7), - (3, 4, 4, 7), - (5, 4, 6, 7), - (7, 4, 7, 17), - ], - ) -} - -#[test] -fn bibtex() { - check( - r#" -%BIB main.bib -%SRC some junk -%SRC here -%SRC -%SRC @article{foo, -%SRC author = {bar}, -%SRC title = {baz} -%SRC } -%SRC -%SRC @string{foo = "bar"} -%SRC -%SRC @comment{foo, -%SRC author = {bar}, -%SRC title = {baz} -%SRC } -%SRC -%SRC @preamble{"foo"} -%CUR ^ -"#, - vec![(3, 0, 6, 1), (8, 0, 8, 20), (15, 0, 15, 16)], - ) -} diff --git a/support/texlab/src/tests/text_document/formatting.rs b/support/texlab/src/tests/text_document/formatting.rs deleted file mode 100644 index eb6804ca66..0000000000 --- a/support/texlab/src/tests/text_document/formatting.rs +++ /dev/null @@ -1,132 +0,0 @@ -use insta::assert_snapshot; -use lsp_types::{ - request::Formatting, ClientCapabilities, DocumentFormattingParams, FormattingOptions, - TextDocumentIdentifier, -}; - -use crate::{ - tests::{client::Client, fixture}, - util::{line_index::LineIndex, line_index_ext::LineIndexExt}, -}; - -fn format(fixture: &str) -> String { - let mut client = Client::spawn(); - client.initialize(ClientCapabilities::default(), None); - - let fixture = fixture::parse(fixture); - let file = fixture.files.into_iter().next().unwrap(); - let old_text = file.text.clone(); - client.open(file.name, file.lang, file.text); - - let actual_edits = client - .request::<Formatting>(DocumentFormattingParams { - text_document: TextDocumentIdentifier::new(client.uri(file.name)), - work_done_progress_params: Default::default(), - options: FormattingOptions { - insert_spaces: true, - tab_size: 4, - ..Default::default() - }, - }) - .unwrap() - .unwrap_or_default(); - - client.shutdown(); - - let line_index = LineIndex::new(&old_text); - let mut actual_text = old_text; - for edit in actual_edits.into_iter().rev() { - let range = line_index.offset_lsp_range(edit.range); - actual_text.replace_range::<std::ops::Range<usize>>(range.into(), &edit.new_text); - } - - actual_text -} - -#[test] -fn bibtex_internal_wrap_long_lines() { - assert_snapshot!(format( - r#" -%BIB main.bib -%SRC @article{foo, bar = {Lorem ipsum dolor sit amet, consectetur adipiscing elit. -%SRC Lorem ipsum dolor sit amet, -%SRC consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.},}"#, - )); -} - -#[test] -fn bibtex_internal_multiple_entries() { - assert_snapshot!(format( - r#" -%BIB main.bib -%SRC @article{foo, bar = {Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, -%SRC consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.},} -%SRC -%SRC @article{foo, bar = {Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, -%SRC consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.},}""#, - )); -} - -#[test] -fn bibtex_internal_trailing_comma() { - assert_snapshot!(format( - r#" -%BIB main.bib -%SRC @article{foo, bar = baz}"#, - )); -} - -#[test] -fn bibtex_internal_insert_braces() { - assert_snapshot!(format( - r#" -%BIB main.bib -%SRC @article{foo, bar = baz,"#, - )); -} - -#[test] -fn bibtex_internal_command() { - assert_snapshot!(format( - r#" -%BIB main.bib -%SRC @article{foo, bar = "\baz",}"#, - )); -} - -#[test] -fn bibtex_internal_join_strings() { - assert_snapshot!(format( - r#" -%BIB main.bib -%SRC @article{foo, bar = "baz" # "qux"}"#, - )); -} - -#[test] -fn bibtex_internal_parens() { - assert_snapshot!(format( - r#" -%BIB main.bib -%SRC @article(foo,)"#, - )); -} - -#[test] -fn bibtex_internal_string() { - assert_snapshot!(format( - r#" -%BIB main.bib -%SRC @string{foo="bar"}"#, - )); -} - -#[test] -fn bibtex_internal_preamble() { - assert_snapshot!(format( - r#" -%BIB main.bib -%SRC @preamble{ -%SRC "foo bar baz" }"#, - )); -} diff --git a/support/texlab/src/tests/text_document/hover.rs b/support/texlab/src/tests/text_document/hover.rs deleted file mode 100644 index 302be82ca3..0000000000 --- a/support/texlab/src/tests/text_document/hover.rs +++ /dev/null @@ -1,303 +0,0 @@ -use lsp_types::{ - request::HoverRequest, ClientCapabilities, Hover, HoverContents, HoverParams, MarkupContent, - MarkupKind, -}; - -use crate::{ - tests::{client::Client, fixture}, - util::{components::COMPONENT_DATABASE, lang_data::LANGUAGE_DATA}, -}; - -fn check(fixture: &str, contents: Option<HoverContents>) { - let mut client = Client::spawn(); - client.initialize(ClientCapabilities::default(), None); - - let fixture = fixture::parse(fixture); - for file in fixture.files { - client.open(file.name, file.lang, file.text); - } - - let range = fixture - .ranges - .values() - .next() - .and_then(|map| map.values().next()) - .map(|file_range| file_range.range); - - let actual_hover = client - .request::<HoverRequest>(HoverParams { - text_document_position_params: fixture.cursor.unwrap().into_params(&client), - work_done_progress_params: Default::default(), - }) - .unwrap(); - - client.shutdown(); - - let expected_hover = contents.map(|contents| Hover { range, contents }); - assert_eq!(actual_hover, expected_hover); -} - -#[test] -fn empty_latex_document() { - check( - r#" -%TEX main.tex -%SRC -%CUR ^ -"#, - None, - ) -} - -#[test] -fn empty_bibtex_document() { - check( - r#" -%BIB main.bib -%SRC -%CUR ^ -"#, - None, - ) -} - -#[test] -fn citation_inside_cite() { - check( - r#" -%BIB main.bib -%SRC @article{foo, author = {Foo Bar}, title = {Baz Qux}, year = 1337} - -%TEX main.tex -%SRC \addbibresource{main.bib} -%SRC \cite{foo} -%CUR ^ -%1.1 ^^^ -"#, - Some(HoverContents::Markup(MarkupContent { - kind: MarkupKind::Markdown, - value: "F. Bar: \"Baz Qux\". (1337).".to_string(), - })), - ) -} - -#[test] -fn citation_inside_entry() { - check( - r#" -%BIB main.bib -%SRC @article{foo, author = {Foo Bar}, title = {Baz Qux}, year = 1337} -%CUR ^ -%1.1 ^^^ - -%TEX main.tex -%SRC \addbibresource{main.bib} -%SRC \cite{foo} -"#, - Some(HoverContents::Markup(MarkupContent { - kind: MarkupKind::Markdown, - value: "F. Bar: \"Baz Qux\". (1337).".to_string(), - })), - ) -} - -#[test] -fn component_known_package() { - check( - r#" -%TEX main.tex -%SRC \usepackage{amsmath} -%CUR ^ -%1.1 ^^^^^^^ -"#, - COMPONENT_DATABASE - .documentation("amsmath") - .map(HoverContents::Markup), - ) -} - -#[test] -fn component_unknown_class() { - check( - r#" -%TEX main.tex -%SRC \documentclass{abcdefghijklmnop} -%CUR ^ -"#, - None, - ) -} - -#[test] -fn entry_type_known_type() { - check( - r#" -%BIB main.bib -%SRC @article{foo,} -%CUR ^ -%1.1 ^^^^^^^^ -"#, - Some(HoverContents::Markup(MarkupContent { - kind: MarkupKind::Markdown, - value: LANGUAGE_DATA - .entry_type_documentation("article") - .unwrap() - .to_string(), - })), - ) -} - -#[test] -fn entry_type_unknown_field() { - check( - r#" -%BIB main.bib -%SRC @foo{bar,} -%CUR ^ -"#, - None, - ) -} - -#[test] -fn entry_type_key() { - check( - r#" -%BIB main.bib -%SRC @foo{bar,} -%CUR ^ -"#, - None, - ) -} - -#[test] -fn field_known() { - check( - r#" -%BIB main.bib -%SRC @article{foo, author = bar} -%CUR ^ -%1.1 ^^^^^^ -"#, - Some(HoverContents::Markup(MarkupContent { - kind: MarkupKind::Markdown, - value: LANGUAGE_DATA - .field_documentation("author") - .unwrap() - .to_string(), - })), - ) -} - -#[test] -fn field_unknown() { - check( - r#" -%BIB main.bib -%SRC @article{foo, bar = baz} -%CUR ^ -"#, - None, - ) -} - -#[test] -fn section() { - check( - r#" -%TEX main.tex -%SRC \section{Foo} -%SRC \label{sec:foo} -%CUR ^ -%1.1 ^^^^^^^ -"#, - Some(HoverContents::Markup(MarkupContent { - kind: MarkupKind::PlainText, - value: "Section (Foo)".to_string(), - })), - ) -} - -#[test] -fn string_inside_reference() { - check( - r#" -%BIB main.bib -%SRC @string{foo = "Foo"} -%SRC @string{bar = "Bar"} -%SRC @article{baz, author = bar} -%CUR ^ -%1.1 ^^^ -"#, - Some(HoverContents::Markup(MarkupContent { - kind: MarkupKind::PlainText, - value: "Bar".to_string(), - })), - ) -} - -#[test] -fn string_inside_field() { - check( - r#" -%BIB main.bib -%SRC @string{foo = "Foo"} -%SRC @string{bar = "Bar"} -%SRC @article{baz, author = bar} -%CUR ^ -"#, - None, - ) -} - -#[test] -fn label_theorem_child_file() { - check( - r#" -%TEX main.tex -%SRC \documentclass{article} -%SRC \newtheorem{lemma}{Lemma} -%SRC \include{child} -%SRC \ref{thm:foo} -%CUR ^ -%1.1 ^^^^^^^ - -%TEX child.tex -%SRC \begin{lemma}\label{thm:foo} -%SRC 1 + 1 = 2 -%SRC \end{lemma} -"#, - Some(HoverContents::Markup(MarkupContent { - kind: MarkupKind::PlainText, - value: "Lemma".to_string(), - })), - ) -} - -#[test] -fn label_theorem_child_file_mumber() { - check( - r#" -%TEX main.tex -%SRC \documentclass{article} -%SRC \newtheorem{lemma}{Lemma} -%SRC \include{child} -%SRC \ref{thm:foo} -%CUR ^ -%1.1 ^^^^^^^ - -%TEX child.tex -%SRC \begin{lemma}[Foo]\label{thm:foo} -%SRC 1 + 1 = 2 -%SRC \end{lemma} - -%TEX child.aux -%SRC \newlabel{thm:foo}{{1}{1}{Foo}{lemma.1}{}} -"#, - Some(HoverContents::Markup(MarkupContent { - kind: MarkupKind::PlainText, - value: "Lemma 1 (Foo)".to_string(), - })), - ) -} diff --git a/support/texlab/src/tests/text_document/inlay_hint.rs b/support/texlab/src/tests/text_document/inlay_hint.rs deleted file mode 100644 index acf5c3e132..0000000000 --- a/support/texlab/src/tests/text_document/inlay_hint.rs +++ /dev/null @@ -1,65 +0,0 @@ -use insta::assert_json_snapshot; -use lsp_types::{ - request::InlayHintRequest, ClientCapabilities, InlayHint, InlayHintParams, Position, Range, - TextDocumentIdentifier, -}; - -use crate::tests::{client::Client, fixture}; - -fn check(fixture: &str) -> Vec<InlayHint> { - let mut client = Client::spawn(); - client.initialize(ClientCapabilities::default(), None); - - let fixture = fixture::parse(fixture); - let uri = client.uri(fixture.files[0].name); - - for file in fixture.files { - client.open(file.name, file.lang, file.text); - } - - let actual_hints = client - .request::<InlayHintRequest>(InlayHintParams { - text_document: TextDocumentIdentifier::new(uri), - range: Range::new(Position::new(0, 0), Position::new(12, 0)), - work_done_progress_params: Default::default(), - }) - .unwrap() - .unwrap_or_default(); - - client.shutdown(); - actual_hints -} - -#[test] -fn label_definition() { - assert_json_snapshot!(check( - r#" -%TEX main.tex -%SRC \documentclass{article} -%SRC \usepackage{caption} -%SRC \begin{document} -%SRC \section{Foo}\label{sec:foo} -%SRC \section{Bar}\label{sec:bar} -%SRC \subsection{Baz}\label{sec:baz} -%SRC \begin{figure} -%SRC Test -%SRC \label{fig:qux} -%SRC \caption{Qux} -%SRC \end{figure} -%SRC \end{document} - -%TEX main.aux -%SRC \relax -%SRC \providecommand*\caption@xref[2]{\@setref\relax\@undefined{#1}} -%SRC \newlabel{fig:qux}{{\caption@xref {fig:qux}{ on input line 15}}{1}} -%SRC \@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Qux\relax }}{1}{}\protected@file@percent } -%SRC \@writefile{toc}{\contentsline {section}{\numberline {1}Foo}{1}{}\protected@file@percent } -%SRC \newlabel{sec:foo}{{1}{1}} -%SRC \@writefile{toc}{\contentsline {section}{\numberline {2}Bar}{1}{}\protected@file@percent } -%SRC \newlabel{sec:bar}{{2}{1}} -%SRC \@writefile{toc}{\contentsline {subsection}{\numberline {2.1}Baz}{1}{}\protected@file@percent } -%SRC \newlabel{sec:baz}{{2.1}{1}} -%SRC \gdef \@abspage@last{1} -"#, - )); -} diff --git a/support/texlab/src/tests/text_document/references.rs b/support/texlab/src/tests/text_document/references.rs deleted file mode 100644 index a0ebed1fb4..0000000000 --- a/support/texlab/src/tests/text_document/references.rs +++ /dev/null @@ -1,271 +0,0 @@ -use assert_unordered::assert_eq_unordered; -use lsp_types::{ - request::References, ClientCapabilities, Location, ReferenceContext, ReferenceParams, -}; - -use crate::tests::{client::Client, fixture}; - -fn check(fixture: &str, context: ReferenceContext) { - let mut client = Client::spawn(); - client.initialize(ClientCapabilities::default(), None); - - let fixture = fixture::parse(fixture); - for file in fixture.files { - client.open(file.name, file.lang, file.text); - } - - let mut expected_locations = Vec::new(); - for ranges in fixture.ranges.values() { - expected_locations.push(Location::new(client.uri(ranges[&1].name), ranges[&1].range)); - } - - let actual_locations = client - .request::<References>(ReferenceParams { - text_document_position: fixture.cursor.unwrap().into_params(&client), - context, - partial_result_params: Default::default(), - work_done_progress_params: Default::default(), - }) - .unwrap() - .unwrap_or_default(); - - client.shutdown(); - - assert_eq_unordered!(actual_locations, expected_locations); -} - -#[test] -fn entry_definition() { - check( - r#" -%BIB foo.bib -%SRC @article{foo,} -%CUR ^ - -%TEX bar.tex -%SRC \cite{foo} -%1.1 ^^^ -%SRC \addbibresource{foo.bib} -"#, - ReferenceContext { - include_declaration: false, - }, - ) -} - -#[test] -fn entry_definition_include_decl() { - check( - r#" -%BIB foo.bib -%SRC @article{foo,} -%CUR ^ -%2.1 ^^^ - -%TEX bar.tex -%SRC \cite{foo} -%1.1 ^^^ -%SRC \addbibresource{foo.bib} -"#, - ReferenceContext { - include_declaration: true, - }, - ) -} - -#[test] -fn entry_reference() { - check( - r#" -%BIB foo.bib -%SRC @article{foo,} - -%TEX bar.tex -%SRC \cite{foo} -%CUR ^ -%1.1 ^^^ -%SRC \addbibresource{foo.bib} -"#, - ReferenceContext { - include_declaration: false, - }, - ) -} - -#[test] -fn entry_reference_include_decl() { - check( - r#" -%BIB foo.bib -%SRC @article{foo,} -%2.1 ^^^ - -%TEX bar.tex -%SRC \cite{foo} -%CUR ^ -%1.1 ^^^ -%SRC \addbibresource{foo.bib} -"#, - ReferenceContext { - include_declaration: true, - }, - ) -} - -#[test] -fn label_definition() { - check( - r#" -%TEX foo.tex -%SRC \label{foo} -%CUR ^ - -%TEX bar.tex -%SRC \ref{foo} -%1.1 ^^^ -%SRC \input{foo.tex} -"#, - ReferenceContext { - include_declaration: false, - }, - ) -} - -#[test] -fn label_definition_include_decl() { - check( - r#" -%TEX foo.tex -%SRC \label{foo} -%CUR ^ -%2.1 ^^^ - -%TEX bar.tex -%SRC \ref{foo} -%1.1 ^^^ -%SRC \input{foo.tex} -"#, - ReferenceContext { - include_declaration: true, - }, - ) -} - -#[test] -fn label_reference() { - check( - r#" -%TEX foo.tex -%SRC \label{foo} -%SRC \input{bar.tex} - -%TEX bar.tex -%SRC \ref{foo} -%CUR ^ -%1.1 ^^^ - -%TEX baz.tex -%SRC \ref{foo} -%2.1 ^^^ -%SRC \input{bar.tex} -"#, - ReferenceContext { - include_declaration: false, - }, - ) -} - -#[test] -fn label_reference_include_decl() { - check( - r#" -%TEX foo.tex -%SRC \label{foo} -%3.1 ^^^ -%SRC \input{bar.tex} - -%TEX bar.tex -%SRC \ref{foo} -%CUR ^ -%1.1 ^^^ - -%TEX baz.tex -%SRC \ref{foo} -%2.1 ^^^ -%SRC \input{bar.tex} -"#, - ReferenceContext { - include_declaration: true, - }, - ) -} - -#[test] -fn string_reference() { - check( - r#" -%BIB main.bib -%SRC @string{foo = {Foo}} -%SRC @string{bar = {Bar}} -%SRC @article{baz, author = foo} -%CUR ^ -%1.1 ^^^ -"#, - ReferenceContext { - include_declaration: false, - }, - ) -} - -#[test] -fn string_reference_include_decl() { - check( - r#" -%BIB main.bib -%SRC @string{foo = {Foo}} -%2.1 ^^^ -%SRC @string{bar = {Bar}} -%SRC @article{baz, author = foo} -%CUR ^ -%1.1 ^^^ -"#, - ReferenceContext { - include_declaration: true, - }, - ) -} - -#[test] -fn string_definition() { - check( - r#" -%BIB main.bib -%SRC @string{foo = {Foo}} -%CUR ^ -%SRC @string{bar = {Bar}} -%SRC @article{baz, author = foo} -%1.1 ^^^ -"#, - ReferenceContext { - include_declaration: false, - }, - ) -} - -#[test] -fn string_definition_include_decl() { - check( - r#" -%BIB main.bib -%SRC @string{foo = {Foo}} -%CUR ^ -%2.1 ^^^ -%SRC @string{bar = {Bar}} -%SRC @article{baz, author = foo} -%1.1 ^^^ -"#, - ReferenceContext { - include_declaration: true, - }, - ) -} diff --git a/support/texlab/src/tests/text_document/rename.rs b/support/texlab/src/tests/text_document/rename.rs deleted file mode 100644 index 2bbdfb1513..0000000000 --- a/support/texlab/src/tests/text_document/rename.rs +++ /dev/null @@ -1,110 +0,0 @@ -use std::collections::HashMap; - -use lsp_types::{request::Rename, ClientCapabilities, RenameParams, TextEdit, Url, WorkspaceEdit}; - -use crate::tests::{client::Client, fixture}; - -fn check(fixture: &str, new_name: &str) { - let mut client = Client::spawn(); - client.initialize(ClientCapabilities::default(), None); - - let fixture = fixture::parse(fixture); - for file in fixture.files { - client.open(file.name, file.lang, file.text); - } - - let mut expected_changes: HashMap<Url, Vec<TextEdit>> = HashMap::new(); - for ranges in fixture.ranges.values() { - expected_changes - .entry(client.uri(ranges[&1].name)) - .or_default() - .push(TextEdit::new(ranges[&1].range, new_name.to_string())); - } - - let actual_edit = client - .request::<Rename>(RenameParams { - text_document_position: fixture.cursor.unwrap().into_params(&client), - new_name: new_name.to_string(), - work_done_progress_params: Default::default(), - }) - .unwrap() - .unwrap_or_default(); - - client.shutdown(); - - assert_eq!(actual_edit, WorkspaceEdit::new(expected_changes)); -} - -#[test] -fn command() { - check( - r#" -%TEX foo.tex -%SRC \baz -%CUR ^ -%1.1 ^^^ -%SRC \include{bar.tex} - -%TEX bar.tex -%SRC \baz -%2.1 ^^^ -"#, - "qux", - ) -} - -#[test] -fn entry() { - check( - r#" -%BIB main.bib -%SRC @article{foo, bar = baz} -%CUR ^ -%1.1 ^^^ - -%TEX main.tex -%SRC \addbibresource{main.bib} -%SRC \cite{foo} -%2.1 ^^^ -"#, - "qux", - ) -} - -#[test] -fn citation() { - check( - r#" -%BIB main.bib -%SRC @article{foo, bar = baz} -%1.1 ^^^ - -%TEX main.tex -%SRC \addbibresource{main.bib} -%SRC \cite{foo} -%CUR ^ -%2.1 ^^^ -"#, - "qux", - ) -} - -#[test] -fn label() { - check( - r#" -%TEX foo.tex -%SRC \label{foo}\include{bar} -%CUR ^ -%1.1 ^^^ - -%TEX bar.tex -%SRC \ref{foo} -%2.1 ^^^ - -%TEX baz.tex -%SRC \ref{foo} -"#, - "bar", - ) -} diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__acronym_package_ref.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__acronym_package_ref.snap deleted file mode 100644 index 88ba06e91c..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__acronym_package_ref.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\acrodef{fpsLabel}[FPS]{Frames per Second}\n%SRC \\ac{f\n%CUR ^\n%1.1 ^\"#)?" ---- -[ - { - "kind": 1, - "label": "fpsLabel", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "fpsLabel" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__acronym_ref_empty.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__acronym_ref_empty.snap deleted file mode 100644 index 65259d44a7..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__acronym_ref_empty.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\newacronym[longplural={Frames per Second}]{fpsLabel}{FPS}{Frame per Second}\n%SRC \\acrshort{}\n%CUR ^\"#)?" ---- -[ - { - "kind": 1, - "label": "fpsLabel", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "fpsLabel" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__acronym_ref_open_brace.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__acronym_ref_open_brace.snap deleted file mode 100644 index f326640993..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__acronym_ref_open_brace.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\newacronym[longplural={Frames per Second}]{fpsLabel}{FPS}{Frame per Second}\n%SRC \\acrshort{f\n%CUR ^\n%1.1 ^\"#)?" ---- -[ - { - "kind": 1, - "label": "fpsLabel", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "fpsLabel" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__acronym_ref_simple.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__acronym_ref_simple.snap deleted file mode 100644 index db7adf0259..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__acronym_ref_simple.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\newacronym[longplural={Frames per Second}]{fpsLabel}{FPS}{Frame per Second}\n%SRC \\acrshort{f}\n%CUR ^\n%1.1 ^\"#)?" ---- -[ - { - "kind": 1, - "label": "fpsLabel", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "fpsLabel" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__argument_empty.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__argument_empty.snap deleted file mode 100644 index 75a73c5e32..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__argument_empty.snap +++ /dev/null @@ -1,61 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\usepackage{amsfonts}\n%SRC \\mathbb{}\n%CUR ^\"#)?" ---- -[ - { - "documentation": "[documentation]", - "kind": 1, - "label": "A", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "A" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "B", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "B" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "C", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "C" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "D", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "D" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "E", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "E" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__argument_open_brace.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__argument_open_brace.snap deleted file mode 100644 index dd33c0eac3..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__argument_open_brace.snap +++ /dev/null @@ -1,61 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\usepackage{amsfonts}\n%SRC \\mathbb{\n%CUR ^\n%SRC Test\"#)?" ---- -[ - { - "documentation": "[documentation]", - "kind": 1, - "label": "A", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "A" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "B", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "B" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "C", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "C" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "D", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "D" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "E", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "E" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__argument_word.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__argument_word.snap deleted file mode 100644 index cf88ba4b2b..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__argument_word.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\usepackage{amsfonts}\n%SRC \\mathbb{A}\n%CUR ^\n%1.1 ^\"#)?" ---- -[ - { - "documentation": "[documentation]", - "kind": 1, - "label": "A", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "A" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__begin_environment_without_snippet_support.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__begin_environment_without_snippet_support.snap deleted file mode 100644 index 167e764aef..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__begin_environment_without_snippet_support.snap +++ /dev/null @@ -1,62 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\beg\n%CUR ^\n%1.1 ^^^\"#)?" ---- -[ - { - "detail": "built-in", - "kind": 1, - "label": "begin", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "begin" - } - }, - { - "detail": "built-in", - "kind": 1, - "label": "begingroup", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "begingroup" - } - }, - { - "detail": "built-in", - "kind": 1, - "label": "AtBeginDocument", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "AtBeginDocument" - } - }, - { - "detail": "built-in", - "kind": 1, - "label": "AtBeginDvi", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "AtBeginDvi" - } - }, - { - "detail": "â‹€, built-in", - "documentation": "[documentation]", - "kind": 1, - "label": "bigwedge", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "bigwedge" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__citation.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__citation.snap deleted file mode 100644 index 70453476d5..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__citation.snap +++ /dev/null @@ -1,31 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\documentclass{article}\n%SRC \\bibliography{main}\n%SRC \\begin{document}\n%SRC \\cite{\n%CUR ^\n%SRC \\end{document}\n\n%BIB main.bib\n%SRC @article{foo:2019,\n%SRC author = {Foo Bar},\n%SRC title = {Baz Qux},\n%SRC year = {2019},\n%SRC }\n%SRC \n%SRC @article{bar:2005,}\"#)?" ---- -[ - { - "data": "[data]", - "filterText": "bar:2005 @article bar:2005", - "kind": 1, - "label": "bar:2005", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "bar:2005" - } - }, - { - "data": "[data]", - "documentation": "[documentation]", - "filterText": "foo:2019 @article foo:2019 author Foo Bar title Baz Qux year 2019", - "kind": 1, - "label": "foo:2019", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "foo:2019" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__citation_acronym.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__citation_acronym.snap deleted file mode 100644 index 5cf8260317..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__citation_acronym.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\addbibresource{main.bib}\n%SRC \\DeclareAcronym{foo}{cite={}}\n%CUR ^\n\n%BIB main.bib\n%SRC @article{foo,}\"#)?" ---- -[ - { - "data": "[data]", - "filterText": "foo @article foo", - "kind": 1, - "label": "foo", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "foo" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__citation_open_brace.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__citation_open_brace.snap deleted file mode 100644 index 3143481442..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__citation_open_brace.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\addbibresource{main.bib}\n%SRC \\cite{\n%CUR ^\n\n%BIB main.bib\n%SRC @article{foo,}\"#)?" ---- -[ - { - "data": "[data]", - "filterText": "foo @article foo", - "kind": 1, - "label": "foo", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "foo" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__citation_open_brace_multiple.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__citation_open_brace_multiple.snap deleted file mode 100644 index 21faa28ecc..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__citation_open_brace_multiple.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\addbibresource{main.bib}\n%SRC \\cite{foo,a\n%CUR ^\n%1.1 ^\n\n%BIB main.bib\n%SRC @article{foo,}\"#)?" ---- -[ - { - "data": "[data]", - "filterText": "foo @article foo", - "kind": 1, - "label": "foo", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "foo" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__color_model_definition_open_brace.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__color_model_definition_open_brace.snap deleted file mode 100644 index 825d607885..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__color_model_definition_open_brace.snap +++ /dev/null @@ -1,56 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\definecolor{foo}{\n%CUR ^\"#)?" ---- -[ - { - "kind": 1, - "label": "HTML", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "HTML" - } - }, - { - "kind": 1, - "label": "RGB", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "RGB" - } - }, - { - "kind": 1, - "label": "cmyk", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "cmyk" - } - }, - { - "kind": 1, - "label": "gray", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "gray" - } - }, - { - "kind": 1, - "label": "rgb", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "rgb" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__color_model_definition_set_open_brace.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__color_model_definition_set_open_brace.snap deleted file mode 100644 index 27dac7d130..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__color_model_definition_set_open_brace.snap +++ /dev/null @@ -1,56 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\definecolorset{\n%CUR ^\"#)?" ---- -[ - { - "kind": 1, - "label": "HTML", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "HTML" - } - }, - { - "kind": 1, - "label": "RGB", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "RGB" - } - }, - { - "kind": 1, - "label": "cmyk", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "cmyk" - } - }, - { - "kind": 1, - "label": "gray", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "gray" - } - }, - { - "kind": 1, - "label": "rgb", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "rgb" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__color_model_definition_set_simple.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__color_model_definition_set_simple.snap deleted file mode 100644 index c2a2640786..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__color_model_definition_set_simple.snap +++ /dev/null @@ -1,56 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\definecolorset{}\n%CUR ^\"#)?" ---- -[ - { - "kind": 1, - "label": "HTML", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "HTML" - } - }, - { - "kind": 1, - "label": "RGB", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "RGB" - } - }, - { - "kind": 1, - "label": "cmyk", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "cmyk" - } - }, - { - "kind": 1, - "label": "gray", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "gray" - } - }, - { - "kind": 1, - "label": "rgb", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "rgb" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__color_model_definition_simple.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__color_model_definition_simple.snap deleted file mode 100644 index da3431986d..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__color_model_definition_simple.snap +++ /dev/null @@ -1,56 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\definecolor{foo}{}\n%CUR ^\"#)?" ---- -[ - { - "kind": 1, - "label": "HTML", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "HTML" - } - }, - { - "kind": 1, - "label": "RGB", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "RGB" - } - }, - { - "kind": 1, - "label": "cmyk", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "cmyk" - } - }, - { - "kind": 1, - "label": "gray", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "gray" - } - }, - { - "kind": 1, - "label": "rgb", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "rgb" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__color_open_brace.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__color_open_brace.snap deleted file mode 100644 index f2ae7d8db0..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__color_open_brace.snap +++ /dev/null @@ -1,56 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\color{\n%CUR ^\"#)?" ---- -[ - { - "kind": 1, - "label": "Apricot", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "Apricot" - } - }, - { - "kind": 1, - "label": "Aquamarine", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "Aquamarine" - } - }, - { - "kind": 1, - "label": "Bittersweet", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "Bittersweet" - } - }, - { - "kind": 1, - "label": "Black", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "Black" - } - }, - { - "kind": 1, - "label": "Blue", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "Blue" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__color_simple.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__color_simple.snap deleted file mode 100644 index fc3db2911b..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__color_simple.snap +++ /dev/null @@ -1,56 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\color{}\n%CUR ^\"#)?" ---- -[ - { - "kind": 1, - "label": "Apricot", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "Apricot" - } - }, - { - "kind": 1, - "label": "Aquamarine", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "Aquamarine" - } - }, - { - "kind": 1, - "label": "Bittersweet", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "Bittersweet" - } - }, - { - "kind": 1, - "label": "Black", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "Black" - } - }, - { - "kind": 1, - "label": "Blue", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "Blue" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__color_word.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__color_word.snap deleted file mode 100644 index cd671de9b9..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__color_word.snap +++ /dev/null @@ -1,56 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\color{re}\n%CUR ^\n%1.1 ^^\"#)?" ---- -[ - { - "kind": 1, - "label": "red", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "red" - } - }, - { - "kind": 1, - "label": "Red", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "Red" - } - }, - { - "kind": 1, - "label": "RedOrange", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "RedOrange" - } - }, - { - "kind": 1, - "label": "RedViolet", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "RedViolet" - } - }, - { - "kind": 1, - "label": "BrickRed", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "BrickRed" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__component_command_bibtex.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__component_command_bibtex.snap deleted file mode 100644 index 76dd1d07f8..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__component_command_bibtex.snap +++ /dev/null @@ -1,61 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%BIB main.bib\n%SRC @article{b, \n%SRC c = {\\LaT }\n%CUR ^\n%1.1 ^^^\n%SRC }\"#)?" ---- -[ - { - "detail": "built-in", - "kind": 1, - "label": "LaTeX", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "LaTeX" - } - }, - { - "detail": "built-in", - "kind": 1, - "label": "LaTeXe", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "LaTeXe" - } - }, - { - "detail": "built-in", - "kind": 1, - "label": "latexreleaseversion", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "latexreleaseversion" - } - }, - { - "detail": "built-in", - "kind": 1, - "label": "LastDeclaredEncoding", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "LastDeclaredEncoding" - } - }, - { - "detail": "built-in", - "kind": 1, - "label": "last", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "last" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__component_command_simple.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__component_command_simple.snap deleted file mode 100644 index c974de42b7..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__component_command_simple.snap +++ /dev/null @@ -1,63 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\\n%CUR ^\"#)?" ---- -[ - { - "detail": "built-in", - "kind": 1, - "label": "!", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "!" - } - }, - { - "detail": "built-in", - "documentation": "[documentation]", - "kind": 1, - "label": "\"", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "\"" - } - }, - { - "detail": "built-in", - "kind": 1, - "label": "#", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "#" - } - }, - { - "detail": "$, built-in", - "documentation": "[documentation]", - "kind": 1, - "label": "$", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "$" - } - }, - { - "detail": "built-in", - "kind": 1, - "label": "%", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "%" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__component_command_simple_package.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__component_command_simple_package.snap deleted file mode 100644 index ada70e293a..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__component_command_simple_package.snap +++ /dev/null @@ -1,61 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\usepackage{lipsum}\n%SRC \\lips\n%CUR ^\n%1.1 ^^^^\"#)?" ---- -[ - { - "detail": "lipsum.sty", - "kind": 1, - "label": "lipsum", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "lipsum" - } - }, - { - "detail": "lipsum.sty", - "kind": 1, - "label": "lipsumexp", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "lipsumexp" - } - }, - { - "detail": "lipsum.sty", - "kind": 1, - "label": "LipsumPar", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "LipsumPar" - } - }, - { - "detail": "lipsum.sty", - "kind": 1, - "label": "LipsumProtect", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "LipsumProtect" - } - }, - { - "detail": "lipsum.sty", - "kind": 1, - "label": "LipsumRestoreAll", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "LipsumRestoreAll" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__component_environment_class.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__component_environment_class.snap deleted file mode 100644 index bb409a442b..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__component_environment_class.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\documentclass{article}\n%SRC \\begin{thein}\n%CUR ^\n%1.1 ^^^^^\"#)?" ---- -[ - { - "detail": "article.cls", - "kind": 1, - "label": "theindex", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "theindex" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__component_environment_command_definition.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__component_environment_command_definition.snap deleted file mode 100644 index d319eeb734..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__component_environment_command_definition.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\newcommand{\\foo}{\\begin{doc}\n%CUR ^\n%1.1 ^^^\"#)?" ---- -[ - { - "detail": "built-in", - "kind": 1, - "label": "document", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "document" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__component_environment_simple.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__component_environment_simple.snap deleted file mode 100644 index f6b8710db3..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__component_environment_simple.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\begin{doc\n%CUR ^\n%1.1 ^^^\"#)?" ---- -[ - { - "detail": "built-in", - "kind": 1, - "label": "document", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "document" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__component_environment_simple_end.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__component_environment_simple_end.snap deleted file mode 100644 index e3ffa551d3..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__component_environment_simple_end.snap +++ /dev/null @@ -1,61 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\begin{document}\n%SRC \\end{\n%CUR ^\"#)?" ---- -[ - { - "detail": "built-in", - "kind": 1, - "label": "document", - "preselect": true, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "document" - } - }, - { - "detail": "built-in", - "kind": 1, - "label": "abstract", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "abstract" - } - }, - { - "detail": "built-in", - "kind": 1, - "label": "array", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "array" - } - }, - { - "detail": "built-in", - "kind": 1, - "label": "center", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "center" - } - }, - { - "detail": "built-in", - "kind": 1, - "label": "csname", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "csname" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__entry_type_after_preamble.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__entry_type_after_preamble.snap deleted file mode 100644 index 5f29c307a7..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__entry_type_after_preamble.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%BIB main.bib\n%SRC @preamble{\n%CUR ^\n%1.1 ^^^^^^^^\"#)?" ---- -[ - { - "kind": 1, - "label": "preamble", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "preamble" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__entry_type_after_string.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__entry_type_after_string.snap deleted file mode 100644 index 5b18f17cfe..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__entry_type_after_string.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%BIB main.bib\n%SRC @string{\n%CUR ^\n%1.1 ^^^^^^\"#)?" ---- -[ - { - "kind": 1, - "label": "string", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "string" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__entry_type_at_empty.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__entry_type_at_empty.snap deleted file mode 100644 index 7928676b92..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__entry_type_at_empty.snap +++ /dev/null @@ -1,61 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%BIB main.bib\n%SRC @\n%CUR ^\"#)?" ---- -[ - { - "documentation": "[documentation]", - "kind": 1, - "label": "article", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "article" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "artwork", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "artwork" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "audio", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "audio" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "bibnote", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "bibnote" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "book", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "book" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__entry_type_before_article.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__entry_type_before_article.snap deleted file mode 100644 index 1522a7594a..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__entry_type_before_article.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%BIB main.bib\n%SRC @article\n%CUR ^\n%1.1 ^^^^^^^\"#)?" ---- -[ - { - "documentation": "[documentation]", - "kind": 1, - "label": "article", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "article" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__entry_type_before_preamble.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__entry_type_before_preamble.snap deleted file mode 100644 index 50e7a2162d..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__entry_type_before_preamble.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%BIB main.bib\n%SRC @preamble\n%CUR ^\n%1.1 ^^^^^^^^\"#)?" ---- -[ - { - "kind": 1, - "label": "preamble", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "preamble" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__entry_type_before_string.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__entry_type_before_string.snap deleted file mode 100644 index 0c00ddd5fc..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__entry_type_before_string.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%BIB main.bib\n%SRC @string\n%CUR ^\n%1.1 ^^^^^^\"#)?" ---- -[ - { - "kind": 1, - "label": "string", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "string" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__entry_type_complete_entry.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__entry_type_complete_entry.snap deleted file mode 100644 index 6afb028f95..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__entry_type_complete_entry.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%BIB main.bib\n%SRC @article{foo, author = {foo}}\n%CUR ^\n%1.1 ^^^^^^^\"#)?" ---- -[ - { - "documentation": "[documentation]", - "kind": 1, - "label": "article", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "article" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__field_empty_entry_closed.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__field_empty_entry_closed.snap deleted file mode 100644 index 86a6e06c89..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__field_empty_entry_closed.snap +++ /dev/null @@ -1,61 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%BIB main.bib\n%SRC @article{foo,}\n%CUR ^\"#)?" ---- -[ - { - "documentation": "[documentation]", - "kind": 1, - "label": "abstract", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "abstract" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "addendum", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "addendum" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "address", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "address" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "afterword", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "afterword" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "annotation", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "annotation" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__field_empty_entry_open.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__field_empty_entry_open.snap deleted file mode 100644 index 75a242d25d..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__field_empty_entry_open.snap +++ /dev/null @@ -1,61 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%BIB main.bib\n%SRC @article{foo,\n%CUR ^\"#)?" ---- -[ - { - "documentation": "[documentation]", - "kind": 1, - "label": "abstract", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "abstract" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "addendum", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "addendum" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "address", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "address" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "afterword", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "afterword" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "annotation", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "annotation" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__field_entry_field_name.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__field_entry_field_name.snap deleted file mode 100644 index 3178da8d07..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__field_entry_field_name.snap +++ /dev/null @@ -1,61 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%BIB main.bib\n%SRC @article{foo, a\n%CUR ^\n%1.1 ^\"#)?" ---- -[ - { - "documentation": "[documentation]", - "kind": 1, - "label": "abstract", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "abstract" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "addendum", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "addendum" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "address", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "address" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "afterword", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "afterword" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "annotation", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "annotation" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__field_entry_two_fields_name_closed.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__field_entry_two_fields_name_closed.snap deleted file mode 100644 index 80595edf98..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__field_entry_two_fields_name_closed.snap +++ /dev/null @@ -1,61 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%BIB main.bib\n%SRC @article{foo, author = bar, edit}\n%CUR ^\n%1.1 ^^^^\"#)?" ---- -[ - { - "documentation": "[documentation]", - "kind": 1, - "label": "edition", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "edition" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "editor", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "editor" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "editora", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "editora" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "editoratype", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "editoratype" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "editorb", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "editorb" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__field_entry_two_fields_name_open.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__field_entry_two_fields_name_open.snap deleted file mode 100644 index 8de75313e8..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__field_entry_two_fields_name_open.snap +++ /dev/null @@ -1,61 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%BIB main.bib\n%SRC @article{foo, author = bar, edit\n%CUR ^\n%1.1 ^^^^\"#)?" ---- -[ - { - "documentation": "[documentation]", - "kind": 1, - "label": "edition", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "edition" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "editor", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "editor" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "editora", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "editora" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "editoratype", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "editoratype" - } - }, - { - "documentation": "[documentation]", - "kind": 1, - "label": "editorb", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "editorb" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__glossary_ref_open_brace.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__glossary_ref_open_brace.snap deleted file mode 100644 index 36a77e92e5..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__glossary_ref_open_brace.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\newacronym[longplural={Frames per Second}]{fpsLabel}{FPS}{Frame per Second}\n%SRC \\gls{f\n%CUR ^\n%1.1 ^\"#)?" ---- -[ - { - "kind": 1, - "label": "fpsLabel", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "fpsLabel" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__glossary_ref_simple.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__glossary_ref_simple.snap deleted file mode 100644 index 7a4d9a584b..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__glossary_ref_simple.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\newacronym[longplural={Frames per Second}]{fpsLabel}{FPS}{Frame per Second}\n%SRC \\gls{f}\n%CUR ^\n%1.1 ^\"#)?" ---- -[ - { - "kind": 1, - "label": "fpsLabel", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "fpsLabel" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__import_class_closed_brace.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__import_class_closed_brace.snap deleted file mode 100644 index f346f67f41..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__import_class_closed_brace.snap +++ /dev/null @@ -1,66 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\documentclass{art}\n%CUR ^\n%1.1 ^^^\"#)?" ---- -[ - { - "data": "[data]", - "documentation": "[documentation]", - "kind": 1, - "label": "article", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "article" - } - }, - { - "data": "[data]", - "documentation": "[documentation]", - "kind": 1, - "label": "articleingud", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "articleingud" - } - }, - { - "data": "[data]", - "documentation": "[documentation]", - "kind": 1, - "label": "articoletteracdp", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "articoletteracdp" - } - }, - { - "data": "[data]", - "documentation": "[documentation]", - "kind": 1, - "label": "artikel1", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "artikel1" - } - }, - { - "data": "[data]", - "documentation": "[documentation]", - "kind": 1, - "label": "artikel2", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "artikel2" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__import_class_open_brace.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__import_class_open_brace.snap deleted file mode 100644 index 0d236ae496..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__import_class_open_brace.snap +++ /dev/null @@ -1,66 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\documentclass{art \\foo\n%CUR ^\n%1.1 ^^^\"#)?" ---- -[ - { - "data": "[data]", - "documentation": "[documentation]", - "kind": 1, - "label": "article", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "article" - } - }, - { - "data": "[data]", - "documentation": "[documentation]", - "kind": 1, - "label": "articleingud", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "articleingud" - } - }, - { - "data": "[data]", - "documentation": "[documentation]", - "kind": 1, - "label": "articoletteracdp", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "articoletteracdp" - } - }, - { - "data": "[data]", - "documentation": "[documentation]", - "kind": 1, - "label": "artikel1", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "artikel1" - } - }, - { - "data": "[data]", - "documentation": "[documentation]", - "kind": 1, - "label": "artikel2", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "artikel2" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__import_package_closed_brace.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__import_package_closed_brace.snap deleted file mode 100644 index 2952c5d401..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__import_package_closed_brace.snap +++ /dev/null @@ -1,66 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\usepackage{lips}\n%CUR ^\n%1.1 ^^^^\"#)?" ---- -[ - { - "data": "[data]", - "documentation": "[documentation]", - "kind": 1, - "label": "lips", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "lips" - } - }, - { - "data": "[data]", - "documentation": "[documentation]", - "kind": 1, - "label": "lipsum", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "lipsum" - } - }, - { - "data": "[data]", - "documentation": "[documentation]", - "kind": 1, - "label": "lisp-simple-alloc", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "lisp-simple-alloc" - } - }, - { - "data": "[data]", - "documentation": "[documentation]", - "kind": 1, - "label": "lisp-string", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "lisp-string" - } - }, - { - "data": "[data]", - "documentation": "[documentation]", - "kind": 1, - "label": "lwarp-lips", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "lwarp-lips" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__import_package_open_brace.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__import_package_open_brace.snap deleted file mode 100644 index 349830d5f2..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__import_package_open_brace.snap +++ /dev/null @@ -1,66 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\usepackage{lips\n%CUR ^\n%1.1 ^^^^\"#)?" ---- -[ - { - "data": "[data]", - "documentation": "[documentation]", - "kind": 1, - "label": "lips", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "lips" - } - }, - { - "data": "[data]", - "documentation": "[documentation]", - "kind": 1, - "label": "lipsum", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "lipsum" - } - }, - { - "data": "[data]", - "documentation": "[documentation]", - "kind": 1, - "label": "lisp-simple-alloc", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "lisp-simple-alloc" - } - }, - { - "data": "[data]", - "documentation": "[documentation]", - "kind": 1, - "label": "lisp-string", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "lisp-string" - } - }, - { - "data": "[data]", - "documentation": "[documentation]", - "kind": 1, - "label": "lwarp-lips", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "lwarp-lips" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__label.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__label.snap deleted file mode 100644 index a4b26aa41d..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__label.snap +++ /dev/null @@ -1,67 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX foo.tex\n%SRC \\documentclass{article}\n%SRC \n%SRC \\usepackage{amsmath}\n%SRC \\usepackage{caption}\n%SRC \\usepackage{amsthm}\n%SRC \\newtheorem{lemma}{Lemma}\n%SRC \n%SRC \\begin{document}\n%SRC \n%SRC \\section{Foo}%\n%SRC \\label{sec:foo}\n%SRC \n%SRC \\begin{equation}%\n%SRC \\label{eq:foo}\n%SRC 1 + 1 = 2\n%SRC \\end{equation}\n%SRC \n%SRC \\begin{equation}%\n%SRC \\label{eq:bar}\n%SRC 1 + 1 = 2\n%SRC \\end{equation}\n%SRC \n%SRC \\begin{figure}%\n%SRC \\LaTeX{}\n%SRC \\caption{Baz}%\n%SRC \\label{fig:baz}\n%SRC \\end{figure}\n%SRC \n%SRC \\begin{lemma}%\n%SRC \\label{thm:foo}\n%SRC 1 + 1 = 2\n%SRC \\end{lemma}\n%SRC \n%SRC \\include{bar}\n%SRC \n%SRC \\end{document}\n\n%TEX bar.tex\n%SRC \\section{Bar}%\n%SRC \\label{sec:bar}\n%SRC \n%SRC Lorem ipsum dolor sit amet.\n%SRC \\ref{}\n%CUR ^\n\n%TEX foo.aux\n%SRC \\relax\n%SRC \\@writefile{lof}{\\contentsline {figure}{\\numberline {1}{\\ignorespaces Baz\\relax }}{1}\\protected@file@percent }\n%SRC \\providecommand*\\caption@xref[2]{\\@setref\\relax\\@undefined{#1}}\n%SRC \\newlabel{fig:baz}{{1}{1}}\n%SRC \\@writefile{toc}{\\contentsline {section}{\\numberline {1}Foo}{1}\\protected@file@percent }\n%SRC \\newlabel{sec:foo}{{1}{1}}\n%SRC \\newlabel{eq:foo}{{1}{1}}\n%SRC \\newlabel{eq:bar}{{2}{1}}\n%SRC \\newlabel{thm:foo}{{1}{1}}\n%SRC \\@input{bar.aux}\"#)?" ---- -[ - { - "detail": "Equation (2)", - "filterText": "eq:bar Equation (2)", - "kind": 1, - "label": "eq:bar", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "eq:bar" - } - }, - { - "detail": "Equation (1)", - "filterText": "eq:foo Equation (1)", - "kind": 1, - "label": "eq:foo", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "eq:foo" - } - }, - { - "detail": "Figure 1", - "documentation": "[documentation]", - "filterText": "fig:baz Figure 1: Baz", - "kind": 1, - "label": "fig:baz", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "fig:baz" - } - }, - { - "detail": "Section (Bar)", - "filterText": "sec:bar Section (Bar)", - "kind": 1, - "label": "sec:bar", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "sec:bar" - } - }, - { - "detail": "Section 1 (Foo)", - "filterText": "sec:foo Section 1 (Foo)", - "kind": 1, - "label": "sec:foo", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "sec:foo" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__project_resolution_import.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__project_resolution_import.snap deleted file mode 100644 index 5ee9c3c207..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__project_resolution_import.snap +++ /dev/null @@ -1,61 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\documentclass{article}\n%SRC \\import{sub}{sub/sub.tex}\n%SRC \\lipsu\n%CUR ^\n%1.1 ^^^^^\n\n%TEX sub/sub.tex\n%SRC \\input{child.tex}\n\n%TEX sub/child.tex\n%SRC \\usepackage{lipsum}\n\n\"#)" ---- -[ - { - "detail": "lipsum.sty", - "kind": 1, - "label": "lipsum", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "lipsum" - } - }, - { - "detail": "lipsum.sty", - "kind": 1, - "label": "lipsumexp", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "lipsumexp" - } - }, - { - "detail": "lipsum.sty", - "kind": 1, - "label": "LipsumPar", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "LipsumPar" - } - }, - { - "detail": "lipsum.sty", - "kind": 1, - "label": "LipsumProtect", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "LipsumProtect" - } - }, - { - "detail": "lipsum.sty", - "kind": 1, - "label": "LipsumRestoreAll", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "LipsumRestoreAll" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__project_resolution_texlabroot.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__project_resolution_texlabroot.snap deleted file mode 100644 index ecf093e33c..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__project_resolution_texlabroot.snap +++ /dev/null @@ -1,61 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX src/main.tex\n%SRC \\documentclass{article}\n%SRC \\include{src/foo}\n%SRC \\lipsu\n%CUR ^\n%1.1 ^^^^^\n\n%TEX src/foo.tex\n%SRC \\include{src/bar}\n\n%TEX src/bar.tex\n%SRC \\usepackage{lipsum}\n\n%ROOT .texlabroot\n\"#)" ---- -[ - { - "detail": "lipsum.sty", - "kind": 1, - "label": "lipsum", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "lipsum" - } - }, - { - "detail": "lipsum.sty", - "kind": 1, - "label": "lipsumexp", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "lipsumexp" - } - }, - { - "detail": "lipsum.sty", - "kind": 1, - "label": "LipsumPar", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "LipsumPar" - } - }, - { - "detail": "lipsum.sty", - "kind": 1, - "label": "LipsumProtect", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "LipsumProtect" - } - }, - { - "detail": "lipsum.sty", - "kind": 1, - "label": "LipsumRestoreAll", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "LipsumRestoreAll" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__theorem_begin.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__theorem_begin.snap deleted file mode 100644 index a4de708b1b..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__theorem_begin.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\newtheorem{lemma}{Lemma}\n%SRC \\begin{lem \n%CUR ^\n%1.1 ^^^\"#)?" ---- -[ - { - "detail": "user-defined", - "kind": 1, - "label": "lemma", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "lemma" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__theorem_end.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__theorem_end.snap deleted file mode 100644 index 0c2c20083e..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__theorem_end.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\newtheorem{lemma}{Lemma}\n%SRC \\begin{}\n%SRC \\end{lem\n%CUR ^\n%1.1 ^^^\"#)?" ---- -[ - { - "detail": "user-defined", - "kind": 1, - "label": "lemma", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "lemma" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__tikz_library_closed_brace.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__tikz_library_closed_brace.snap deleted file mode 100644 index f2a00d22bb..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__tikz_library_closed_brace.snap +++ /dev/null @@ -1,56 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\usepgflibrary{}\n%CUR ^\"#)?" ---- -[ - { - "kind": 1, - "label": "arrows", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "arrows" - } - }, - { - "kind": 1, - "label": "arrows.meta", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "arrows.meta" - } - }, - { - "kind": 1, - "label": "arrows.spaced", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "arrows.spaced" - } - }, - { - "kind": 1, - "label": "curvilinear", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "curvilinear" - } - }, - { - "kind": 1, - "label": "datavisualization.barcharts", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "datavisualization.barcharts" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__tikz_library_open_brace.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__tikz_library_open_brace.snap deleted file mode 100644 index 62bb3729b7..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__tikz_library_open_brace.snap +++ /dev/null @@ -1,56 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\usepgflibrary{\n%CUR ^\"#)?" ---- -[ - { - "kind": 1, - "label": "arrows", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "arrows" - } - }, - { - "kind": 1, - "label": "arrows.meta", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "arrows.meta" - } - }, - { - "kind": 1, - "label": "arrows.spaced", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "arrows.spaced" - } - }, - { - "kind": 1, - "label": "curvilinear", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "curvilinear" - } - }, - { - "kind": 1, - "label": "datavisualization.barcharts", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "datavisualization.barcharts" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__user_command.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__user_command.snap deleted file mode 100644 index fe0a397706..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__user_command.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\foobar\n%SRC \\fooba\n%CUR ^\n%1.1 ^^^^^\n%SRC \\begin{foo}\n%SRC \\end{foo}\n%SRC \\begin{fo}\n\"#)?" ---- -[ - { - "detail": "user-defined", - "kind": 1, - "label": "foobar", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "foobar" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__user_environment.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__user_environment.snap deleted file mode 100644 index 7230e9a951..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__completion__user_environment.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: src/tests/text_document/completion.rs -expression: "complete(r#\"\n%TEX main.tex\n%SRC \\foobar\n%SRC \\fooba\n%SRC \\begin{foo}\n%SRC \\end{foo}\n%SRC \\begin{fo}\n%CUR ^\n%1.1 ^^\n\"#)?" ---- -[ - { - "detail": "user-defined", - "kind": 1, - "label": "foo", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "foo" - } - }, - { - "detail": "built-in", - "kind": 1, - "label": "filecontents", - "preselect": false, - "sortText": "[sortText]", - "textEdit": { - "range": "[range]", - "newText": "filecontents" - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__did_change_configuration__invalid_configuration.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__did_change_configuration__invalid_configuration.snap deleted file mode 100644 index 1400d80167..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__did_change_configuration__invalid_configuration.snap +++ /dev/null @@ -1,9 +0,0 @@ ---- -source: src/tests/text_document/did_change_configuration.rs -expression: message ---- -The texlab configuration is invalid; using the default settings instead. -Details: regex parse error: - \ - ^ -error: incomplete escape sequence, reached end of pattern prematurely diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__enumerate_flat.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__enumerate_flat.snap deleted file mode 100644 index 4c5a17fb98..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__enumerate_flat.snap +++ /dev/null @@ -1,96 +0,0 @@ ---- -source: src/tests/text_document/document_symbol.rs -expression: result.response ---- -[ - { - "name": "Enumerate", - "kind": 10, - "deprecated": false, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 4, - "character": 0 - }, - "end": { - "line": 9, - "character": 15 - } - } - } - }, - { - "name": "Item", - "kind": 22, - "deprecated": false, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 5, - "character": 4 - }, - "end": { - "line": 5, - "character": 27 - } - } - } - }, - { - "name": "Item", - "kind": 22, - "deprecated": false, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 6, - "character": 4 - }, - "end": { - "line": 6, - "character": 27 - } - } - } - }, - { - "name": "Baz", - "kind": 22, - "deprecated": false, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 7, - "character": 4 - }, - "end": { - "line": 7, - "character": 18 - } - } - } - }, - { - "name": "Qux", - "kind": 22, - "deprecated": false, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 8, - "character": 4 - }, - "end": { - "line": 8, - "character": 32 - } - } - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__enumerate_nested.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__enumerate_nested.snap deleted file mode 100644 index 630311f32e..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__enumerate_nested.snap +++ /dev/null @@ -1,140 +0,0 @@ ---- -source: src/tests/text_document/document_symbol.rs -expression: result.response ---- -[ - { - "name": "Enumerate", - "kind": 10, - "deprecated": false, - "range": { - "start": { - "line": 4, - "character": 0 - }, - "end": { - "line": 9, - "character": 15 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 0 - }, - "end": { - "line": 9, - "character": 15 - } - }, - "children": [ - { - "name": "Item", - "detail": "it:foo", - "kind": 22, - "deprecated": false, - "range": { - "start": { - "line": 5, - "character": 4 - }, - "end": { - "line": 5, - "character": 27 - } - }, - "selectionRange": { - "start": { - "line": 5, - "character": 9 - }, - "end": { - "line": 5, - "character": 23 - } - }, - "children": [] - }, - { - "name": "Item", - "detail": "it:bar", - "kind": 22, - "deprecated": false, - "range": { - "start": { - "line": 6, - "character": 4 - }, - "end": { - "line": 6, - "character": 27 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 9 - }, - "end": { - "line": 6, - "character": 23 - } - }, - "children": [] - }, - { - "name": "Baz", - "kind": 22, - "deprecated": false, - "range": { - "start": { - "line": 7, - "character": 4 - }, - "end": { - "line": 7, - "character": 18 - } - }, - "selectionRange": { - "start": { - "line": 7, - "character": 4 - }, - "end": { - "line": 7, - "character": 18 - } - }, - "children": [] - }, - { - "name": "Qux", - "detail": "it:qux", - "kind": 22, - "deprecated": false, - "range": { - "start": { - "line": 8, - "character": 4 - }, - "end": { - "line": 8, - "character": 32 - } - }, - "selectionRange": { - "start": { - "line": 8, - "character": 14 - }, - "end": { - "line": 8, - "character": 28 - } - }, - "children": [] - } - ] - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__equation_flat.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__equation_flat.snap deleted file mode 100644 index 24ab44c772..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__equation_flat.snap +++ /dev/null @@ -1,60 +0,0 @@ ---- -source: src/tests/text_document/document_symbol.rs -expression: result.response ---- -[ - { - "name": "Equation", - "kind": 14, - "deprecated": false, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 4, - "character": 0 - }, - "end": { - "line": 6, - "character": 14 - } - } - } - }, - { - "name": "Equation", - "kind": 14, - "deprecated": false, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 8, - "character": 0 - }, - "end": { - "line": 10, - "character": 14 - } - } - } - }, - { - "name": "Equation", - "kind": 14, - "deprecated": false, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 12, - "character": 0 - }, - "end": { - "line": 14, - "character": 14 - } - } - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__equation_nested.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__equation_nested.snap deleted file mode 100644 index 2efe7a4796..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__equation_nested.snap +++ /dev/null @@ -1,86 +0,0 @@ ---- -source: src/tests/text_document/document_symbol.rs -expression: result.response ---- -[ - { - "name": "Equation", - "detail": "eq:foo", - "kind": 14, - "deprecated": false, - "range": { - "start": { - "line": 4, - "character": 0 - }, - "end": { - "line": 6, - "character": 14 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 16 - }, - "end": { - "line": 4, - "character": 30 - } - }, - "children": [] - }, - { - "name": "Equation", - "detail": "eq:bar", - "kind": 14, - "deprecated": false, - "range": { - "start": { - "line": 8, - "character": 0 - }, - "end": { - "line": 10, - "character": 14 - } - }, - "selectionRange": { - "start": { - "line": 8, - "character": 16 - }, - "end": { - "line": 8, - "character": 30 - } - }, - "children": [] - }, - { - "name": "Equation", - "kind": 14, - "deprecated": false, - "range": { - "start": { - "line": 12, - "character": 0 - }, - "end": { - "line": 14, - "character": 14 - } - }, - "selectionRange": { - "start": { - "line": 12, - "character": 0 - }, - "end": { - "line": 14, - "character": 14 - } - }, - "children": [] - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__float_flat.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__float_flat.snap deleted file mode 100644 index 3d2537d85b..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__float_flat.snap +++ /dev/null @@ -1,60 +0,0 @@ ---- -source: src/tests/text_document/document_symbol.rs -expression: result.response ---- -[ - { - "name": "Figure: Foo", - "kind": 6, - "deprecated": false, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 4, - "character": 0 - }, - "end": { - "line": 7, - "character": 12 - } - } - } - }, - { - "name": "Figure: Bar", - "kind": 6, - "deprecated": false, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 9, - "character": 0 - }, - "end": { - "line": 12, - "character": 12 - } - } - } - }, - { - "name": "Figure: Baz", - "kind": 6, - "deprecated": false, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 14, - "character": 0 - }, - "end": { - "line": 17, - "character": 12 - } - } - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__float_nested.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__float_nested.snap deleted file mode 100644 index 18c5f3ca93..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__float_nested.snap +++ /dev/null @@ -1,86 +0,0 @@ ---- -source: src/tests/text_document/document_symbol.rs -expression: result.response ---- -[ - { - "name": "Figure: Foo", - "detail": "fig:foo", - "kind": 6, - "deprecated": false, - "range": { - "start": { - "line": 4, - "character": 0 - }, - "end": { - "line": 7, - "character": 12 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 17 - }, - "end": { - "line": 6, - "character": 32 - } - }, - "children": [] - }, - { - "name": "Figure: Bar", - "detail": "fig:bar", - "kind": 6, - "deprecated": false, - "range": { - "start": { - "line": 9, - "character": 0 - }, - "end": { - "line": 12, - "character": 12 - } - }, - "selectionRange": { - "start": { - "line": 11, - "character": 17 - }, - "end": { - "line": 11, - "character": 32 - } - }, - "children": [] - }, - { - "name": "Figure: Baz", - "kind": 6, - "deprecated": false, - "range": { - "start": { - "line": 14, - "character": 0 - }, - "end": { - "line": 17, - "character": 12 - } - }, - "selectionRange": { - "start": { - "line": 14, - "character": 0 - }, - "end": { - "line": 17, - "character": 12 - } - }, - "children": [] - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__section_flat.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__section_flat.snap deleted file mode 100644 index 87ff442db1..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__section_flat.snap +++ /dev/null @@ -1,60 +0,0 @@ ---- -source: src/tests/text_document/document_symbol.rs -expression: result.response ---- -[ - { - "name": "Foo", - "kind": 2, - "deprecated": false, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 4, - "character": 0 - }, - "end": { - "line": 4, - "character": 13 - } - } - } - }, - { - "name": "Bar", - "kind": 2, - "deprecated": false, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 6, - "character": 0 - }, - "end": { - "line": 8, - "character": 31 - } - } - } - }, - { - "name": "Baz", - "kind": 2, - "deprecated": false, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 8, - "character": 0 - }, - "end": { - "line": 8, - "character": 31 - } - } - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__section_nested.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__section_nested.snap deleted file mode 100644 index bf4fea547e..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__section_nested.snap +++ /dev/null @@ -1,87 +0,0 @@ ---- -source: src/tests/text_document/document_symbol.rs -expression: result.response ---- -[ - { - "name": "Foo", - "kind": 2, - "deprecated": false, - "range": { - "start": { - "line": 4, - "character": 0 - }, - "end": { - "line": 4, - "character": 13 - } - }, - "selectionRange": { - "start": { - "line": 4, - "character": 0 - }, - "end": { - "line": 4, - "character": 13 - } - }, - "children": [] - }, - { - "name": "Bar", - "detail": "sec:bar", - "kind": 2, - "deprecated": false, - "range": { - "start": { - "line": 6, - "character": 0 - }, - "end": { - "line": 8, - "character": 31 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 13 - }, - "end": { - "line": 6, - "character": 28 - } - }, - "children": [ - { - "name": "Baz", - "detail": "sec:baz", - "kind": 2, - "deprecated": false, - "range": { - "start": { - "line": 8, - "character": 0 - }, - "end": { - "line": 8, - "character": 31 - } - }, - "selectionRange": { - "start": { - "line": 8, - "character": 16 - }, - "end": { - "line": 8, - "character": 31 - } - }, - "children": [] - } - ] - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__theorem_flat.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__theorem_flat.snap deleted file mode 100644 index d033c3ca62..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__theorem_flat.snap +++ /dev/null @@ -1,78 +0,0 @@ ---- -source: src/tests/text_document/document_symbol.rs -expression: result.response ---- -[ - { - "name": "Lemma (Foo)", - "kind": 13, - "deprecated": false, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 6, - "character": 0 - }, - "end": { - "line": 8, - "character": 11 - } - } - } - }, - { - "name": "Lemma", - "kind": 13, - "deprecated": false, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 10, - "character": 0 - }, - "end": { - "line": 12, - "character": 11 - } - } - } - }, - { - "name": "Lemma", - "kind": 13, - "deprecated": false, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 14, - "character": 0 - }, - "end": { - "line": 16, - "character": 11 - } - } - } - }, - { - "name": "Lemma (Qux)", - "kind": 13, - "deprecated": false, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 18, - "character": 0 - }, - "end": { - "line": 20, - "character": 11 - } - } - } - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__theorem_nested.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__theorem_nested.snap deleted file mode 100644 index 22844dd700..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__document_symbol__theorem_nested.snap +++ /dev/null @@ -1,113 +0,0 @@ ---- -source: src/tests/text_document/document_symbol.rs -expression: result.response ---- -[ - { - "name": "Lemma (Foo)", - "detail": "thm:foo", - "kind": 13, - "deprecated": false, - "range": { - "start": { - "line": 6, - "character": 0 - }, - "end": { - "line": 8, - "character": 11 - } - }, - "selectionRange": { - "start": { - "line": 6, - "character": 18 - }, - "end": { - "line": 6, - "character": 33 - } - }, - "children": [] - }, - { - "name": "Lemma", - "detail": "thm:bar", - "kind": 13, - "deprecated": false, - "range": { - "start": { - "line": 10, - "character": 0 - }, - "end": { - "line": 12, - "character": 11 - } - }, - "selectionRange": { - "start": { - "line": 10, - "character": 13 - }, - "end": { - "line": 10, - "character": 28 - } - }, - "children": [] - }, - { - "name": "Lemma", - "detail": "thm:baz", - "kind": 13, - "deprecated": false, - "range": { - "start": { - "line": 14, - "character": 0 - }, - "end": { - "line": 16, - "character": 11 - } - }, - "selectionRange": { - "start": { - "line": 14, - "character": 13 - }, - "end": { - "line": 14, - "character": 28 - } - }, - "children": [] - }, - { - "name": "Lemma (Qux)", - "kind": 13, - "deprecated": false, - "range": { - "start": { - "line": 18, - "character": 0 - }, - "end": { - "line": 20, - "character": 11 - } - }, - "selectionRange": { - "start": { - "line": 18, - "character": 0 - }, - "end": { - "line": 20, - "character": 11 - } - }, - "children": [] - } -] diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_command.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_command.snap deleted file mode 100644 index c7d1491245..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_command.snap +++ /dev/null @@ -1,8 +0,0 @@ ---- -source: src/tests/text_document/formatting.rs -expression: "format(r#\"\n%BIB main.bib\n%SRC @article{foo, bar = \"\\baz\",}\"#)?" ---- -@article{foo, - bar = "\baz", -} - diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_insert_braces.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_insert_braces.snap deleted file mode 100644 index d05b077188..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_insert_braces.snap +++ /dev/null @@ -1,7 +0,0 @@ ---- -source: src/tests/text_document/formatting.rs -expression: "format(r#\"\n%BIB main.bib\n%SRC @article{foo, bar = baz,\"#)?" ---- -@article{foo, - bar = baz, -} diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_join_strings.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_join_strings.snap deleted file mode 100644 index 8fb3765129..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_join_strings.snap +++ /dev/null @@ -1,8 +0,0 @@ ---- -source: src/tests/text_document/formatting.rs -expression: "format(r#\"\n%BIB main.bib\n%SRC @article{foo, bar = \"baz\" # \"qux\"}\"#)?" ---- -@article{foo, - bar = "baz" # "qux", -} - diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_multiple_entries.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_multiple_entries.snap deleted file mode 100644 index 2496f9b5e5..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_multiple_entries.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: src/tests/text_document/formatting.rs -expression: "format(r#\"\n%BIB main.bib\n%SRC @article{foo, bar = {Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, \n%SRC consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.},}\n%SRC \n%SRC @article{foo, bar = {Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, \n%SRC consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.},}\"\"#)?" ---- -@article{foo, - bar = {Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum - dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit - amet, consectetur adipiscing elit.}, -} - -@article{foo, - bar = {Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum - dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit - amet, consectetur adipiscing elit.}, -}" - diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_parens.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_parens.snap deleted file mode 100644 index 883b97b375..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_parens.snap +++ /dev/null @@ -1,7 +0,0 @@ ---- -source: src/tests/text_document/formatting.rs -expression: "format(r#\"\n%BIB main.bib\n%SRC @article(foo,)\"#)?" ---- -@article{foo, -} - diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_preamble.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_preamble.snap deleted file mode 100644 index fdac219c35..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_preamble.snap +++ /dev/null @@ -1,6 +0,0 @@ ---- -source: src/tests/text_document/formatting.rs -expression: "format(r#\"\n%BIB main.bib\n%SRC @preamble{\n%SRC \"foo bar baz\" }\"#)?" ---- -@preamble{"foo bar baz"} - diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_string.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_string.snap deleted file mode 100644 index 8f9589773e..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_string.snap +++ /dev/null @@ -1,6 +0,0 @@ ---- -source: src/tests/text_document/formatting.rs -expression: "format(r#\"\n%BIB main.bib\n%SRC @string{foo=\"bar\"}\"#)?" ---- -@string{foo = "bar"} - diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_trailing_comma.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_trailing_comma.snap deleted file mode 100644 index 1051e00cf3..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_trailing_comma.snap +++ /dev/null @@ -1,8 +0,0 @@ ---- -source: src/tests/text_document/formatting.rs -expression: "format(r#\"\n%BIB main.bib\n%SRC @article{foo, bar = baz}\"#)?" ---- -@article{foo, - bar = baz, -} - diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_wrap_long_lines.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_wrap_long_lines.snap deleted file mode 100644 index e7e1f39386..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__formatting__bibtex_internal_wrap_long_lines.snap +++ /dev/null @@ -1,10 +0,0 @@ ---- -source: src/tests/text_document/formatting.rs -expression: "format(r#\"\n%BIB main.bib\n%SRC @article{foo, bar = {Lorem ipsum dolor sit amet, consectetur adipiscing elit.\n%SRC Lorem ipsum dolor sit amet,\n%SRC consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.},}\"#)?" ---- -@article{foo, - bar = {Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum - dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit - amet, consectetur adipiscing elit.}, -} - diff --git a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__inlay_hint__label_definition.snap b/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__inlay_hint__label_definition.snap deleted file mode 100644 index ff04d65efb..0000000000 --- a/support/texlab/src/tests/text_document/snapshots/texlab__tests__text_document__inlay_hint__label_definition.snap +++ /dev/null @@ -1,38 +0,0 @@ ---- -source: src/tests/text_document/inlay_hint.rs -expression: "check(r#\"\n%TEX main.tex\n%SRC \\documentclass{article}\n%SRC \\usepackage{caption}\n%SRC \\begin{document}\n%SRC \\section{Foo}\\label{sec:foo}\n%SRC \\section{Bar}\\label{sec:bar}\n%SRC \\subsection{Baz}\\label{sec:baz}\n%SRC \\begin{figure}\n%SRC Test\n%SRC \\label{fig:qux}\n%SRC \\caption{Qux}\n%SRC \\end{figure}\n%SRC \\end{document}\n\n%TEX main.aux\n%SRC \\relax \n%SRC \\providecommand*\\caption@xref[2]{\\@setref\\relax\\@undefined{#1}}\n%SRC \\newlabel{fig:qux}{{\\caption@xref {fig:qux}{ on input line 15}}{1}}\n%SRC \\@writefile{lof}{\\contentsline {figure}{\\numberline {1}{\\ignorespaces Qux\\relax }}{1}{}\\protected@file@percent }\n%SRC \\@writefile{toc}{\\contentsline {section}{\\numberline {1}Foo}{1}{}\\protected@file@percent }\n%SRC \\newlabel{sec:foo}{{1}{1}}\n%SRC \\@writefile{toc}{\\contentsline {section}{\\numberline {2}Bar}{1}{}\\protected@file@percent }\n%SRC \\newlabel{sec:bar}{{2}{1}}\n%SRC \\@writefile{toc}{\\contentsline {subsection}{\\numberline {2.1}Baz}{1}{}\\protected@file@percent }\n%SRC \\newlabel{sec:baz}{{2.1}{1}}\n%SRC \\gdef \\@abspage@last{1}\n\"#)?" ---- -[ - { - "position": { - "line": 3, - "character": 27 - }, - "label": "Section 1 (Foo)", - "paddingLeft": true - }, - { - "position": { - "line": 4, - "character": 27 - }, - "label": "Section 2 (Bar)", - "paddingLeft": true - }, - { - "position": { - "line": 5, - "character": 30 - }, - "label": "Subsection 2.1 (Baz)", - "paddingLeft": true - }, - { - "position": { - "line": 8, - "character": 18 - }, - "label": "Figure fig:qux: Qux", - "paddingLeft": true - } -] diff --git a/support/texlab/src/tests/workspace.rs b/support/texlab/src/tests/workspace.rs deleted file mode 100644 index 15e0679dea..0000000000 --- a/support/texlab/src/tests/workspace.rs +++ /dev/null @@ -1 +0,0 @@ -mod symbol; diff --git a/support/texlab/src/tests/workspace/snapshots/texlab__tests__workspace__symbol__filter_bibtex.snap b/support/texlab/src/tests/workspace/snapshots/texlab__tests__workspace__symbol__filter_bibtex.snap deleted file mode 100644 index 16963641bf..0000000000 --- a/support/texlab/src/tests/workspace/snapshots/texlab__tests__workspace__symbol__filter_bibtex.snap +++ /dev/null @@ -1,42 +0,0 @@ ---- -source: src/tests/workspace/symbol.rs -expression: result.actual_symbols ---- -[ - { - "deprecated": false, - "kind": 24, - "location": { - "uri": "[tmp]/main.bib", - "range": { - "start": { - "line": 0, - "character": 0 - }, - "end": { - "line": 0, - "character": 14 - } - } - }, - "name": "foo" - }, - { - "deprecated": false, - "kind": 15, - "location": { - "uri": "[tmp]/main.bib", - "range": { - "start": { - "line": 2, - "character": 0 - }, - "end": { - "line": 2, - "character": 20 - } - } - }, - "name": "bar" - } -] diff --git a/support/texlab/src/tests/workspace/snapshots/texlab__tests__workspace__symbol__filter_type_figure.snap b/support/texlab/src/tests/workspace/snapshots/texlab__tests__workspace__symbol__filter_type_figure.snap deleted file mode 100644 index 1b1d2371a4..0000000000 --- a/support/texlab/src/tests/workspace/snapshots/texlab__tests__workspace__symbol__filter_type_figure.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: src/tests/workspace/symbol.rs -expression: result.actual_symbols ---- -[ - { - "deprecated": false, - "kind": 6, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 15, - "character": 0 - }, - "end": { - "line": 19, - "character": 12 - } - } - }, - "name": "Figure 1: Bar" - } -] diff --git a/support/texlab/src/tests/workspace/snapshots/texlab__tests__workspace__symbol__filter_type_item.snap b/support/texlab/src/tests/workspace/snapshots/texlab__tests__workspace__symbol__filter_type_item.snap deleted file mode 100644 index ed45c13cf1..0000000000 --- a/support/texlab/src/tests/workspace/snapshots/texlab__tests__workspace__symbol__filter_type_item.snap +++ /dev/null @@ -1,60 +0,0 @@ ---- -source: src/tests/workspace/symbol.rs -expression: result.actual_symbols ---- -[ - { - "deprecated": false, - "kind": 22, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 24, - "character": 4 - }, - "end": { - "line": 24, - "character": 28 - } - } - }, - "name": "1" - }, - { - "deprecated": false, - "kind": 22, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 25, - "character": 4 - }, - "end": { - "line": 25, - "character": 28 - } - } - }, - "name": "2" - }, - { - "deprecated": false, - "kind": 22, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 26, - "character": 4 - }, - "end": { - "line": 26, - "character": 28 - } - } - }, - "name": "3" - } -] diff --git a/support/texlab/src/tests/workspace/snapshots/texlab__tests__workspace__symbol__filter_type_math.snap b/support/texlab/src/tests/workspace/snapshots/texlab__tests__workspace__symbol__filter_type_math.snap deleted file mode 100644 index d4cea99cc5..0000000000 --- a/support/texlab/src/tests/workspace/snapshots/texlab__tests__workspace__symbol__filter_type_math.snap +++ /dev/null @@ -1,42 +0,0 @@ ---- -source: src/tests/workspace/symbol.rs -expression: result.actual_symbols ---- -[ - { - "deprecated": false, - "kind": 14, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 9, - "character": 0 - }, - "end": { - "line": 11, - "character": 14 - } - } - }, - "name": "Equation (1)" - }, - { - "deprecated": false, - "kind": 13, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 33, - "character": 0 - }, - "end": { - "line": 35, - "character": 11 - } - } - }, - "name": "Lemma 1 (Qux)" - } -] diff --git a/support/texlab/src/tests/workspace/snapshots/texlab__tests__workspace__symbol__filter_type_section.snap b/support/texlab/src/tests/workspace/snapshots/texlab__tests__workspace__symbol__filter_type_section.snap deleted file mode 100644 index 3a3ef78ab2..0000000000 --- a/support/texlab/src/tests/workspace/snapshots/texlab__tests__workspace__symbol__filter_type_section.snap +++ /dev/null @@ -1,78 +0,0 @@ ---- -source: src/tests/workspace/symbol.rs -expression: result.actual_symbols ---- -[ - { - "deprecated": false, - "kind": 2, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 7, - "character": 0 - }, - "end": { - "line": 11, - "character": 14 - } - } - }, - "name": "1 Foo" - }, - { - "deprecated": false, - "kind": 2, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 13, - "character": 0 - }, - "end": { - "line": 19, - "character": 12 - } - } - }, - "name": "2 Bar" - }, - { - "deprecated": false, - "kind": 2, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 21, - "character": 0 - }, - "end": { - "line": 27, - "character": 15 - } - } - }, - "name": "3 Baz" - }, - { - "deprecated": false, - "kind": 2, - "location": { - "uri": "[tmp]/main.tex", - "range": { - "start": { - "line": 29, - "character": 0 - }, - "end": { - "line": 35, - "character": 11 - } - } - }, - "name": "4 Qux" - } -] diff --git a/support/texlab/src/tests/workspace/symbol.rs b/support/texlab/src/tests/workspace/symbol.rs deleted file mode 100644 index 626cce3c0b..0000000000 --- a/support/texlab/src/tests/workspace/symbol.rs +++ /dev/null @@ -1,142 +0,0 @@ -use insta::{assert_json_snapshot, internals::Redaction}; -use lsp_types::{ - request::WorkspaceSymbol, ClientCapabilities, SymbolInformation, Url, WorkspaceSymbolParams, -}; - -use crate::tests::{client::Client, fixture}; - -struct SymbolResult { - actual_symbols: Vec<SymbolInformation>, - uri_redaction: Redaction, -} - -fn find_symbols(fixture: &str, query: &str) -> SymbolResult { - let mut client = Client::spawn(); - client.initialize(ClientCapabilities::default(), None); - - let fixture = fixture::parse(fixture); - for file in fixture.files { - client.open(file.name, file.lang, file.text); - } - - let actual_symbols = client - .request::<WorkspaceSymbol>(WorkspaceSymbolParams { - query: query.to_string(), - work_done_progress_params: Default::default(), - partial_result_params: Default::default(), - }) - .unwrap() - .unwrap_or_default(); - - let result = client.shutdown(); - - let uri = Url::from_directory_path(result.directory.path()).unwrap(); - let uri_redaction = insta::dynamic_redaction(move |content, _path| { - content.as_str().unwrap().replace(uri.as_str(), "[tmp]/") - }); - - SymbolResult { - actual_symbols, - uri_redaction, - } -} - -macro_rules! assert_symbols { - ($result:expr) => { - let result = $result; - assert_json_snapshot!(result.actual_symbols, { - "[].location.uri" => result.uri_redaction, - "[]" => insta::sorted_redaction() - }); - }; -} - -const FIXTURE: &str = r#" -%TEX main.tex -%SRC \documentclass{article} -%SRC \usepackage{caption} -%SRC \usepackage{amsmath} -%SRC \usepackage{amsthm} -%SRC -%SRC \begin{document} -%SRC -%SRC \section{Foo}\label{sec:foo} -%SRC -%SRC \begin{equation}\label{eq:foo} -%SRC Foo -%SRC \end{equation} -%SRC -%SRC \section{Bar}\label{sec:bar} -%SRC -%SRC \begin{figure} -%SRC Bar -%SRC \caption{Bar} -%SRC \label{fig:bar} -%SRC \end{figure} -%SRC -%SRC \section{Baz}\label{sec:baz} -%SRC -%SRC \begin{enumerate} -%SRC \item\label{itm:foo} Foo -%SRC \item\label{itm:bar} Bar -%SRC \item\label{itm:baz} Baz -%SRC \end{enumerate} -%SRC -%SRC \section{Qux}\label{sec:qux} -%SRC -%SRC \newtheorem{lemma}{Lemma} -%SRC -%SRC \begin{lemma}[Qux]\label{thm:qux} -%SRC Qux -%SRC \end{lemma} -%SRC -%SRC \end{document} - -%TEX main.aux -%SRC \relax -%SRC \@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Bar\relax }}{1}\protected@file@percent } -%SRC \providecommand*\caption@xref[2]{\@setref\relax\@undefined{#1}} -%SRC \newlabel{fig:bar}{{1}{1}} -%SRC \@writefile{toc}{\contentsline {section}{\numberline {1}Foo}{1}\protected@file@percent } -%SRC \newlabel{sec:foo}{{1}{1}} -%SRC \newlabel{eq:foo}{{1}{1}} -%SRC \@writefile{toc}{\contentsline {section}{\numberline {2}Bar}{1}\protected@file@percent } -%SRC \newlabel{sec:bar}{{2}{1}} -%SRC \@writefile{toc}{\contentsline {section}{\numberline {3}Baz}{1}\protected@file@percent } -%SRC \newlabel{sec:baz}{{3}{1}} -%SRC \newlabel{itm:foo}{{1}{1}} -%SRC \newlabel{itm:bar}{{2}{1}} -%SRC \newlabel{itm:baz}{{3}{1}} -%SRC \@writefile{toc}{\contentsline {section}{\numberline {4}Qux}{1}\protected@file@percent } -%SRC \newlabel{sec:qux}{{4}{1}} -%SRC \newlabel{thm:qux}{{1}{1}} - -%BIB main.bib -%SRC @article{foo,} -%SRC -%SRC @string{bar = "bar"}"#; - -#[test] -fn filter_type_section() { - assert_symbols!(find_symbols(FIXTURE, "section")); -} - -#[test] -fn filter_type_figure() { - assert_symbols!(find_symbols(FIXTURE, "figure")); -} - -#[test] -fn filter_type_item() { - assert_symbols!(find_symbols(FIXTURE, "item")); -} - -#[test] -fn filter_type_math() { - assert_symbols!(find_symbols(FIXTURE, "math")); -} - -#[test] -fn filter_bibtex() { - assert_symbols!(find_symbols(FIXTURE, "bibtex")); -} diff --git a/support/texlab/src/util.rs b/support/texlab/src/util.rs index 1c4d55a19d..6f27305f1b 100644 --- a/support/texlab/src/util.rs +++ b/support/texlab/src/util.rs @@ -7,9 +7,10 @@ pub mod lang_data; pub mod line_index; pub mod line_index_ext; pub mod lsp_enums; +pub mod regex_filter; use std::path::PathBuf; use once_cell::sync::Lazy; -pub static HOME_DIR: Lazy<Option<PathBuf>> = Lazy::new(|| dirs::home_dir()); +pub static HOME_DIR: Lazy<Option<PathBuf>> = Lazy::new(dirs::home_dir); diff --git a/support/texlab/src/util/chktex.rs b/support/texlab/src/util/chktex.rs index 29a7ac5630..d87eff5f9c 100644 --- a/support/texlab/src/util/chktex.rs +++ b/support/texlab/src/util/chktex.rs @@ -49,7 +49,7 @@ impl Command { pub fn run(self) -> std::io::Result<Vec<Diagnostic>> { let mut child = std::process::Command::new("chktex") - .args(&["-I0", "-f%l:%c:%d:%k:%n:%m\n"]) + .args(["-I0", "-f%l:%c:%d:%k:%n:%m\n"]) .stdin(Stdio::piped()) .stdout(Stdio::piped()) .stderr(Stdio::null()) diff --git a/support/texlab/src/util/label.rs b/support/texlab/src/util/label.rs index f0fae34337..50e2ea21e7 100644 --- a/support/texlab/src/util/label.rs +++ b/support/texlab/src/util/label.rs @@ -209,7 +209,7 @@ fn render_label_enum_item( .label() .and_then(|label| label.content_text()) .map(|text| Word::new(db, text)) - .or_else(|| number), + .or(number), object: LabeledObject::EnumItem, }) } diff --git a/support/texlab/src/util/regex_filter.rs b/support/texlab/src/util/regex_filter.rs new file mode 100644 index 0000000000..f107ea16fe --- /dev/null +++ b/support/texlab/src/util/regex_filter.rs @@ -0,0 +1,24 @@ +use crate::RegexPattern; + +pub fn filter( + text: &str, + allowed_patterns: &[RegexPattern], + ignored_patterns: &[RegexPattern], +) -> bool { + if !allowed_patterns.is_empty() + && !allowed_patterns + .iter() + .any(|pattern| pattern.0.is_match(text)) + { + return false; + } + + if ignored_patterns + .iter() + .any(|pattern| pattern.0.is_match(text)) + { + return false; + } + + true +} |