-
Notifications
You must be signed in to change notification settings - Fork 1.1k
refactor: using FlexSearch in font panel #1749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Changes requested. Reviewed everything up to c7cfc02 in 2 minutes and 4 seconds
More details
- Looked at
126
lines of code in2
files - Skipped
0
files when reviewing. - Skipped posting
8
drafted comments based on config settings.
1. apps/studio/package.json:62
- Draft comment:
New dependency added: Ensure version alignment with @types/flexsearch to avoid incompatibilities. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%
<= threshold50%
The comment is about a new dependency and suggests ensuring version alignment to avoid incompatibilities. This falls under the rule of not commenting on dependency changes or library versions that are not recognized. The comment does not provide a specific code suggestion or ask for a test to be written, which would make it useful.
2. apps/studio/src/lib/editor/engine/font/index.ts:43
- Draft comment:
FlexSearch index is initialized in constructor. Consider updating the index if _allFontFamilies can change at runtime. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50%
The comment is speculative - it's suggesting handling a case that doesn't appear to exist. _allFontFamilies is initialized from a static import and only cleared on dispose(). There's no evidence in the code that it can change during normal operation. The comment is making assumptions about potential future changes rather than addressing a current issue.
I could be missing some higher-level architecture where fontFamilies could be dynamically updated. The dispose() method does clear _allFontFamilies, so there might be a reinitialize case I'm not seeing.
Even if there are cases where _allFontFamilies is reinitialized, that would be a significant architectural change requiring many updates beyond just the search index. We shouldn't speculate about hypothetical future changes.
Delete the comment because it's speculative and assumes changes that aren't supported by the current codebase. If _allFontFamilies becomes mutable in the future, that would require broader architectural changes.
3. apps/studio/src/lib/editor/engine/font/index.ts:292
- Draft comment:
Mapping search results via 'font.doc' assumes FlexSearch returns a 'doc' property. Verify that this matches the API response structure. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%
<= threshold50%
The comment is asking the PR author to verify that the code matches the API response structure, which is against the rules. It doesn't provide a specific suggestion or point out a clear issue with the code.
4. apps/studio/src/lib/editor/engine/font/index.ts:286
- Draft comment:
For empty queries, resetting _searchResults to [] is now correctly done. Confirm that this behavior aligns with UI requirements. - Reason this comment was not posted:
Confidence changes required:30%
<= threshold50%
None
5. apps/studio/src/lib/editor/engine/font/index.ts:1
- Draft comment:
PR description mentions onboarding docs, but the changes only update font search functionality. Ensure that all intended requirements (e.g., framework documentation) are actually addressed. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
6. apps/studio/src/lib/editor/engine/font/index.ts:87
- Draft comment:
Verify that overriding the boolean 'variable' property with a CSS variable string (e.g.--font-${font.id}
) is intentional. - Reason this comment was not posted:
Confidence changes required:33%
<= threshold50%
None
7. apps/studio/src/lib/editor/engine/font/index.ts:292
- Draft comment:
Loading the font batch on each search query (via loadFontBatch) may impact performance on rapid user input. Consider debouncing or caching search results. - Reason this comment was not posted:
Confidence changes required:33%
<= threshold50%
None
8. apps/studio/package.json:62
- Draft comment:
FlexSearch dependency is added. Please verify that the selected version (^0.8.151) and its type definitions are compatible with the project requirements. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
Workflow ID: wflow_Cl9QqIc7iSJgxjVC
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
|
||
// Initialize FlexSearch index | ||
this._fontSearchIndex = new FlexSearch.Document({ | ||
document: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding an encode
option (e.g. encode: 'icase'
) to the FlexSearch.Document
config for reliable case‐insensitive searches.
}); | ||
|
||
// Add all font families to the search index | ||
this._allFontFamilies.forEach((font) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I like this solution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice thanks for adding this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on 20a45cb in 46 seconds
More details
- Looked at
38
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
6
drafted comments based on config settings.
1. bun.lock:46
- Draft comment:
Added flexsearch dependency. Ensure its version (^0.8.151) is compatible with the refactor. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
2. bun.lock:87
- Draft comment:
Added @types/flexsearch. Verify that the types version (^0.7.42) aligns with the flexsearch version used. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
3. bun.lock:1003
- Draft comment:
Lock file updated with flexsearch details. Ensure that all usages in the refactored font panel correctly import and use flexsearch. - Reason this comment was not posted:
Confidence changes required:0%
<= threshold50%
None
4. bun.lock:1687
- Draft comment:
The PR description mentions improvements to onboarding docs, but only dependencies changed. Confirm if documentation updates are expected in this PR. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
5. bun.lock:46
- Draft comment:
PR description and issue refer to onboarding docs, but this change only adds FlexSearch dependency. Please update the description or ensure all intended changes are included. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%
<= threshold50%
This comment asks the PR author to update the PR description, which is against the rules. It also indirectly asks the author to ensure all intended changes are included, which is similar to asking for confirmation of intention. Therefore, this comment should be removed.
6. bun.lock:87
- Draft comment:
Confirm compatibility between flexsearch v0.8.151 and @types/flexsearch v0.7.42 to avoid potential type mismatches. - Reason this comment was not posted:
Comment was not on a location in the diff, so it can't be submitted as a review comment.
Workflow ID: wflow_MNLBBoalkOS0UXP7
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
* using flex search in font
* using flex search in font
Description
Related Issues
Type of Change
Testing
Screenshots (if applicable)
Additional Notes
Important
Refactor
FontManager
to use FlexSearch for improved font search performance in the font panel.flexsearch
and@types/flexsearch
topackage.json
andbun.lock
.FlexSearch.Document
inFontManager
inindex.ts
for font search.searchFonts()
inFontManager
to use FlexSearch for querying fonts.searchFonts()
to "Error searching fonts:".This description was created by
for 20a45cb. It will automatically update as commits are pushed.