-
Notifications
You must be signed in to change notification settings - Fork 23
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
fix issue #30, take care of uppercase #31
fix issue #30, take care of uppercase #31
Conversation
@@ -23,12 +23,20 @@ import { AppHelper } from "../app-helper"; | |||
|
|||
function suggestWords(words: Word[], query: string, max: number): Word[] { | |||
return Array.from(words) | |||
.filter((x) => x.value !== query) |
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.
I remove this to L27, because I think it will cost more time when words list in very long, in my case, 2w words 😂
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.
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.
A similar improvement can be done at https://github.com/tadashi-aikawa/obsidian-various-complements-plugin/blob/main/src/ui/AutoCompleteSuggest.ts#L41.
This will iterate the words again.
A better ways is just use a list, and iterate the word list one time, put valid candidate to the list.
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.
This will iterate the words again.
What does that mean? 🤔
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.
After you merge the code, the code line number is not right now.
It's now https://github.com/tadashi-aikawa/obsidian-various-complements-plugin/blob/main/src/ui/AutoCompleteSuggest.ts#L49.
we may remove this line for performance, because it will iterate the long list again.
.filter((x) => x.value !== undefined)
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.
In my local, I actually change export function caseIncludes(one: string, other: string): boolean {
return one.startsWith(other);
} This will complete in strict prefix. Any special reason we use |
Because I am inspired by Vim search mode. Vim search works as the On the other hand, This plugin is for complements, not search. There are many different complements logics, but famous editors and IDEs suggest first what we input. (ex: However, Obsidian is not IDE for a coder. Therefore, I think it would be suitable as you said.
I agree. It is a bit of another issue, so I might implement it after merging your PR. |
I had thought it depended on how we use it or who uses it. However, now I think they might be noisy in most cases. So I'll try it soon, thanks! :) ※ If no one uses partial match, it seems possible to complement more fast by indexing optimized. (in exchange for indexing speed) |
By the way, this issue includes breaking changes as I didn't expected. So I'll merge it and then release v3.0.0 :) |
No description provided.