1
1
mirror of https://github.com/casey/just.git synced 2024-11-25 07:06:23 +03:00

Add source information as path of the information

Motivation: To add support for module integration in justl which is an
Emacs extension for driving justfiles within Emacs.

This would allow me to easily discover the file locations of different
just modules and allow the ability to individually open justl buffers
for them within the editor.
This commit is contained in:
Sibi Prabakaran 2024-11-16 17:42:17 +05:30
parent 084a2d2de3
commit 516fac504c
No known key found for this signature in database
GPG Key ID: D19E3E0EBB557613
4 changed files with 1036 additions and 894 deletions

View File

@ -182,6 +182,7 @@ impl<'run, 'src> Analyzer<'run, 'src> {
unstable_features.insert(UnstableFeature::ScriptInterpreterSetting); unstable_features.insert(UnstableFeature::ScriptInterpreterSetting);
} }
let source = root.canonicalize().unwrap();
let root = paths.get(root).unwrap(); let root = paths.get(root).unwrap();
Ok(Justfile { Ok(Justfile {
@ -205,7 +206,7 @@ impl<'run, 'src> Analyzer<'run, 'src> {
name, name,
recipes, recipes,
settings, settings,
source: root.into(), source,
unexports: self.unexports, unexports: self.unexports,
unstable_features, unstable_features,
warnings: self.warnings, warnings: self.warnings,

View File

@ -23,7 +23,6 @@ pub(crate) struct Justfile<'src> {
pub(crate) name: Option<Name<'src>>, pub(crate) name: Option<Name<'src>>,
pub(crate) recipes: Table<'src, Rc<Recipe<'src>>>, pub(crate) recipes: Table<'src, Rc<Recipe<'src>>>,
pub(crate) settings: Settings<'src>, pub(crate) settings: Settings<'src>,
#[serde(skip)]
pub(crate) source: PathBuf, pub(crate) source: PathBuf,
pub(crate) unexports: HashSet<String>, pub(crate) unexports: HashSet<String>,
#[serde(skip)] #[serde(skip)]

File diff suppressed because it is too large Load Diff

View File

@ -167,6 +167,11 @@ impl Test {
self self
} }
pub(crate) fn stdout_with_tempdir(mut self, stdout_fn: impl Fn(&TempDir) -> String) -> Self {
self.stdout = stdout_fn(&self.tempdir);
self
}
pub(crate) fn stdout_regex(mut self, stdout_regex: impl AsRef<str>) -> Self { pub(crate) fn stdout_regex(mut self, stdout_regex: impl AsRef<str>) -> Self {
self.stdout_regex = Some(Regex::new(&format!("^{}$", stdout_regex.as_ref())).unwrap()); self.stdout_regex = Some(Regex::new(&format!("^{}$", stdout_regex.as_ref())).unwrap());
self self