fix: suppress warning for shared file extensions (like .h)#148
Merged
kapral18 merged 1 commit intoelastic:mainfrom Feb 16, 2026
Merged
fix: suppress warning for shared file extensions (like .h)#148kapral18 merged 1 commit intoelastic:mainfrom
kapral18 merged 1 commit intoelastic:mainfrom
Conversation
da7f85b to
d977b01
Compare
- Add a shared-extension helper and allow `.h` only for the `c`/`cpp` pair. - Apply the same allowlist in parser warning logic and language validation. - Expand parser and validator unit tests for allowed and disallowed duplicate cases. Co-authored-by: Cursor <cursoragent@cursor.com>
d977b01 to
439ee53
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the language-extension conflict logic so that intentionally shared extensions (currently .h) do not produce duplicate-extension warnings/errors except for explicitly allowed language pairs, keeping runtime (LanguageParser) and startup validation (validateLanguageConfiguration) behavior consistent.
Changes:
- Introduces
isSharedExtensionAllowedto explicitly allow.hsharing only betweencandcpp. - Applies the shared-extension rule to both
LanguageParserwarning emission and language configuration validation. - Adds unit tests covering allowed
.hsharing, disallowed.hconflicts with other languages, and regression coverage for non-shared duplicates.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/parser_extension_conflict.test.ts | Adds unit tests ensuring .h sharing between c/cpp does not warn, while other .h and non-.h duplicates still warn. |
| tests/unit/language_validator.test.ts | Adds validator tests ensuring .h is allowed only for the c/cpp pair and still errors for other language pairs. |
| src/utils/shared_extensions.ts | Adds centralized shared-extension allowlist logic via isSharedExtensionAllowed. |
| src/utils/parser.ts | Suppresses duplicate-extension warnings when the duplicate is explicitly allowed (e.g., .h for c/cpp). |
| src/utils/language_validator.ts | Suppresses duplicate-extension validation errors for explicitly allowed shared extensions, matching runtime behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
isSharedExtensionAllowed, allowing.honly forcandcpp.LanguageParserand language validation so runtime and startup warnings are consistent..hsharing (c/cpp), disallowed.hduplicates with other languages, and non-shared duplicate regression behavior.Test plan
npm testnpm run lint