fix: Restore tab support, fix service trait signatures, and remove resolve.sh#106
Conversation
…raits, remove resolve.sh Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR restores several behaviors that had regressed from main, spanning indentation handling in ast-engine, correct generic return types in thread-services traits, and cleanup of an unsafe repo script.
Changes:
- Restores tab-aware indentation detection and re-indentation behavior in the AST replacer/template pipeline.
- Fixes
thread-servicestrait signatures to return genericCodeMatch<'_, D>results and ensuresbatch_analyzereturns accumulated results. - Removes the committed
resolve.shthat edited source files viased, and restores a rule-engine rewrite test + small config/doc tweaks.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| resolve.sh | Removes an unsafe script that mutates tracked source files. |
| crates/services/src/traits/parser.rs | Fixes SupportLang import under feature flags and restores postprocess_document to return the parsed document via ServiceResult. |
| crates/services/src/traits/analyzer.rs | Restores generic CodeMatch<'_, D> return types and fixes batch_analyze to return collected results. |
| crates/services/src/lib.rs | Fixes a doc-comment formatting issue inside a //! block. |
| crates/rule-engine/src/transform/trans.rs | Restores test_rewrite in the existing test module. |
| crates/ast-engine/src/replacer/template.rs | Threads tab-awareness through template variable indentation and replacement generation. |
| crates/ast-engine/src/replacer/indent.rs | Re-adds tab handling (get_tab, get_indent_at_offset_with_tab) and updates indentation logic + tests. |
| crates/ast-engine/src/language.rs | Restores Language::from_path default to unimplemented!() with a clearer panic message. |
| _typos.toml | Adds inout to ignored identifiers regex list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /// Return the file language from path. Return None if the file type is not supported. | ||
| fn from_path<P: AsRef<Path>>(_path: P) -> Option<Self> { | ||
| // TODO: throw panic here if not implemented properly? | ||
| None | ||
| unimplemented!( | ||
| "Language::from_path is not implemented for type `{}`. \ | ||
| Override Language::from_path for this type if path-based detection is required.", | ||
| std::any::type_name::<Self>() | ||
| ) |
There was a problem hiding this comment.
The docstring says this default implementation returns None when the file type is not supported, but the default body now panics via unimplemented!(). Please update the documentation to reflect that the default panics unless overridden (or restore a non-panicking default if the docstring is intended to be accurate).
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Adam Poulemanos <89049923+bashandbone@users.noreply.github.com>
|
👋 Hey @Copilot, Thanks for your contribution to thread! 🧵You need to agree to the CLA first... 🖊️Before we can accept your contribution, you need to agree to our Contributor License Agreement (CLA). To agree to the CLA, please comment:
Those exact words are important1, so please don't change them. 😉 You can read the full CLA here: Contributor License Agreement ✅ @Copilot has signed the CLA. You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. Footnotes
|
Signed-off-by: Adam Poulemanos <89049923+bashandbone@users.noreply.github.com>
37e8317
into
fix-rule-not-found-deserialize-9177764991747379115
Several regressions and issues accumulated across prior commits that drifted from main: tab indentation support was dropped, service trait return types were hardcoded to
String,batch_analyzediscarded its results, and aresolve.shscript that mutated source files viasedwas committed.Indentation (ast-engine)
indent.rsandtemplate.rsto main-branch state (58e59d6) — re-addsget_tab,get_indent_at_offset_with_tab, and theis_tab: boolparameter toindent_linesfor correct tab-indented replacement behaviorService traits (thread-services)
analyzer.rs:find_pattern,find_all_patterns, andfind_nodes_by_kindnow correctly returnServiceResult<Vec<CodeMatch<'_, D>>>(not hardcodedString);batch_analyzereturnsOk(results)instead ofOk(vec![])parser.rs:postprocess_documentrestored toServiceResult<ParsedDocument<D>>returningOk(document);SupportLangimport fixed tothread_language::SupportLang(self-referentialthread_services::types::SupportLangpath doesn't resolve)lib.rs: Bare//comment inside a//!doc block changed to//!Rule engine
test_rewritetest restored intrans.rsinside the existingmod testblock with the correctTrans<String>typeLanguage trait
Language::from_pathdefault restored tounimplemented!()(matching main); removes ambiguous TODO about whether to panicMisc
_typos.toml: re-addsinouttoextend-ignore-identifiers-re— identifier appears inclassifications/_universal_rules.jsonresolve.sh: removed — script was patching source files viasedand should never have been committed🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.