Skip to main content

luaur_analysis/records/
frontend_options.rs

1use alloc::sync::Arc;
2use luaur_ast::records::location::Location;
3use luaur_config::records::lint_options::LintOptions;
4
5use crate::records::frontend_cancellation_token::FrontendCancellationToken;
6use crate::records::module::Module;
7use crate::records::source_module::SourceModule;
8
9/// Port of `Luau::FrontendOptions` from `Analysis/include/Luau/Frontend.h`.
10#[derive(Debug, Clone)]
11pub struct FrontendOptions {
12    pub retain_full_type_graphs: bool,
13    pub for_autocomplete: bool,
14    pub run_lint_checks: bool,
15    pub randomize_constraint_resolution_seed: Option<u32>,
16    pub enabled_lint_warnings: Option<LintOptions>,
17    pub cancellation_token: Option<Arc<FrontendCancellationToken>>,
18    pub module_time_limit_sec: Option<f64>,
19    pub apply_internal_limit_scaling: bool,
20    pub custom_module_check: Option<fn(&SourceModule, &Module)>,
21    pub collect_type_allocation_stats: bool,
22}
23
24impl Default for FrontendOptions {
25    fn default() -> Self {
26        Self {
27            retain_full_type_graphs: false,
28            for_autocomplete: false,
29            run_lint_checks: false,
30            randomize_constraint_resolution_seed: None,
31            enabled_lint_warnings: None,
32            cancellation_token: None,
33            module_time_limit_sec: None,
34            apply_internal_limit_scaling: false,
35            custom_module_check: None,
36            collect_type_allocation_stats: false,
37        }
38    }
39}