-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Keyword search #110
Keyword search #110
Conversation
Before I go into details about the implementation, I would recommend to check the contribute paragraph of the readme. The most important parts of that paragraph with regards to writing code, are the ones suggesting to use editorconfig and eslint. The eslint style guide clearly wasn't used while working on this, and as such I don't like the way the code is written currently. I think a better name for this setting would be |
Renamed to 'searchwords' Uses the string list syntax (key0~value0,key1~value1,...) Adds checks on settings set() Passes eslint
Alright, @Jelmerro, I updated it to use the string list and to pass eslint, so the style now seems consistent. I tried editorconfig and I believe it's passing, as I didn't see any complaints, but I'm not that familiar with that tool. My vim was already configured to indent with 4 spaces and use \LF, however, and there aren't any trailing whitespaces. |
My comment was mostly about the eslint style guide, I think there were no issues with editorconfig. This is already much more consistent and it works well. There are just four small things I would like to change:
Feel free to discuss these suggestions, this is just what makes sense to me. |
|
I meant that I would prefer there to be no searchwords by default, not that you need to define them at other places too. It's confusing to suddenly introduce this without making it opt-in. Please just set it to an empty string in the defaultSettings and let users define these themselves. I was talking about the border color of the navbar. As explained in |
Good point about no keywords by default. I was figuring it'd be instructive to users, but there's really no point in forcing them to have a default, and the help explains how to use it. I added a new style and set the bar to change colors (currently to I couldn't find a great way to avoid duplicating some code, now in Ideally I'd want to return a touple, where the first element is True or False indicating if it's a searchword, and the second element is a key/value pair of the detected searchword and the replaced URL. You can probably do that with arrays in JS, but it just felt like it'd be a big departure from how this codebase does things, and isn't especially intuitive for future coders. If you think those duplicated lines are a problem, or can think of a more elegant solution, let me know |
There are some small adjustments I want to make to the help and the appearance in the light colorscheme, but overall this seems ready to merge, thanks a lot for implementing this. |
Great, thanks! |
* Checking in keyword search feature * Adding help documentation for keywords feature * Removing trailing whitespace * Modifying keywordSearch feature to searchwords, rewriting Renamed to 'searchwords' Uses the string list syntax (key0~value0,key1~value1,...) Adds checks on settings set() Passes eslint * Updating help page for searchwords * Updating help page for searchwords * Minor verbiage change for searchwords * Re-ordering the help for searchwords * Searchwords now doesn't search with an empty query * Setting searchwords default value to empty string * Changing the suggest bar when a searchword is entered Co-authored-by: InconsolableCellist <you@example.com> Co-authored-by: Jelmer van Arnhem <Jelmerro@users.noreply.github.com>
@Jelmerro What do you think? It's parsing the Map every time you visit a URL, though I think the performance impact may be negligible. I didn't know where I could stick and fetch a Map object without just pulling the new String from the settings.