Add selective alias disable and version check#53
Conversation
There was a problem hiding this comment.
Bug: Autocomplete Includes Disabled Components
Autocomplete suggestions generated by findComponentWithPrefix (called within handleElementNameCloseCompletion) incorrectly include disabled components. This creates inconsistent behavior, as other component lookup methods correctly filter based on the disabledComponents set.
packages/poml/file.tsx#L976-L977
Lines 976 to 977 in bbf0867
packages/poml/file.tsx#L1072-L1132
Lines 1072 to 1132 in bbf0867
BugBot free trial expires on July 22, 2025
Learn more in the Cursor dashboard.
Was this report helpful? Give feedback by reacting with 👍 or 👎
There was a problem hiding this comment.
Pull Request Overview
This PR adds selective component alias disabling and version checking functionality to the POML system. It enables fine-grained control over which components are available during parsing and provides version compatibility checks.
- Implements version range validation with minVersion and maxVersion checks
- Adds selective component/alias disabling through meta tag configuration
- Expands component lookup functions to respect disabled component sets
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/poml/version.ts | Exports POML version constant for version checking |
| packages/poml/tests/meta.test.tsx | Comprehensive test coverage for version checks and component disabling |
| packages/poml/file.tsx | Core implementation of meta tag handling, version validation, and disabled component tracking |
| packages/poml/base.tsx | Updates component registry to support disabled component filtering |
| } | ||
| const op = token[0]; | ||
| const name = token.slice(1).toLowerCase(); | ||
| if (!name) { |
There was a problem hiding this comment.
The component name should be validated to ensure it's not empty after trimming and slicing. Consider adding a check for empty names after the slice operation.
| if (!name) { | |
| if (!name.trim()) { |
| @@ -1090,6 +1151,22 @@ const camelToHyphenCase = (text: string): string => { | |||
| return text.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); | |||
| }; | |||
|
|
|||
There was a problem hiding this comment.
The compareVersions function lacks documentation explaining its return values (-1, 0, 1) and expected input format. Consider adding a JSDoc comment to clarify the semantic version comparison behavior.
| /** | |
| * Compares two semantic version strings (e.g., "1.2.3"). | |
| * | |
| * @param a - The first version string in the format "x.y.z". | |
| * @param b - The second version string in the format "x.y.z". | |
| * @returns -1 if `a` is less than `b`, 1 if `a` is greater than `b`, and 0 if they are equal. | |
| */ |
| public getComponent( | ||
| name: string, | ||
| returnReasonIfNotFound: boolean = false | ||
| returnReasonIfNotFound: boolean | Set<string> = false, | ||
| disabled: Set<string> | undefined = undefined | ||
| ): PomlComponent | string | undefined { | ||
| if (returnReasonIfNotFound instanceof Set) { | ||
| disabled = returnReasonIfNotFound; | ||
| returnReasonIfNotFound = false; | ||
| } | ||
|
|
||
| const hyphenToCamelCase = (s: string) => { | ||
| return s.toLowerCase().replace(/-([a-z])/g, g => g[1].toUpperCase()); |
There was a problem hiding this comment.
The parameter overloading pattern with returnReasonIfNotFound accepting both boolean and Set creates an unclear API. Consider using separate method overloads or a clearer parameter structure to improve type safety and readability.
packages/poml/file.tsx
Outdated
| const pa = a.split('.').map(n => parseInt(n)); | ||
| const pb = b.split('.').map(n => parseInt(n)); |
There was a problem hiding this comment.
parseInt without a radix parameter can lead to unexpected behavior with leading zeros. Use parseInt(n, 10) to ensure decimal parsing, or consider using Number() for cleaner conversion.
| const pa = a.split('.').map(n => parseInt(n)); | |
| const pb = b.split('.').map(n => parseInt(n)); | |
| const pa = a.split('.').map(n => parseInt(n, 10)); | |
| const pb = b.split('.').map(n => parseInt(n, 10)); |
Summary
PomlFilegetComponentto take a disabled setTesting
npm run build-webviewnpm run build-clinpm run lint(with warnings)npm testpython -m pytest python/testshttps://chatgpt.com/codex/tasks/task_e_687739351228832eb5d8933aca68352d