Don't follow package links by default (#987)

This commit is contained in:
Patrick Förster 2024-01-04 20:36:35 +01:00 committed by GitHub
parent b4c5d2784f
commit 1a2ad9e7ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 2 deletions

View file

@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Fixed
- Avoid trying to parse most of the TeX distro when building the dependency graph. Add `texlab.experimental.followPackageLinks` setting to allow re-enabling the old behavior
([#986](https://github.com/latex-lsp/texlab/issues/986))
## [5.12.0] - 2023-12-03
### Added

View file

@ -76,6 +76,12 @@ impl<'a> Graph<'a> {
return;
};
let uri = source.uri.as_str();
let is_pkg = uri.ends_with(".sty") || uri.ends_with(".cls");
if is_pkg && !self.workspace.config().syntax.follow_package_links {
return;
}
for link in &data.semantics.links {
self.add_link(source, base_dir, link);
}

View file

@ -2,6 +2,7 @@ use rustc_hash::FxHashSet;
#[derive(Debug)]
pub struct SyntaxConfig {
pub follow_package_links: bool,
pub math_environments: FxHashSet<String>,
pub enum_environments: FxHashSet<String>,
pub verbatim_environments: FxHashSet<String>,
@ -31,6 +32,7 @@ impl Default for SyntaxConfig {
.collect();
Self {
follow_package_links: false,
math_environments,
enum_environments,
verbatim_environments,

View file

@ -34,8 +34,6 @@ pub enum SyntaxKind {
ROOT,
}
pub use SyntaxKind::*;
impl From<SyntaxKind> for rowan::SyntaxKind {
fn from(kind: SyntaxKind) -> Self {
Self(kind as u16)

View file

@ -124,6 +124,7 @@ pub struct RegexPattern(#[serde(with = "serde_regex")] pub Regex);
#[serde(rename_all = "camelCase")]
#[serde(default)]
pub struct ExperimentalOptions {
pub follow_package_links: bool,
pub math_environments: Vec<String>,
pub enum_environments: Vec<String>,
pub verbatim_environments: Vec<String>,