Skip to content
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

Is there a way to show all available commands when the user hasn't typed anything yet? #15

Open
ashleydavis opened this issue Sep 12, 2018 · 16 comments

Comments

@ashleydavis
Copy link
Contributor

Hi, great component!

Just wondering if there is any way that I can show all commands before the user has typed anything?

The way VS code does it:

vs command palette

Thanks so much!
Ash

@1egoman
Copy link
Owner

1egoman commented Sep 12, 2018

Hmm, no, not by default.

However, you should be able to subclass FuzzyPicker and override the getInitialItems method to return the initial set of items to render when the popup is opened - see https://github.com/1egoman/fuzzy-picker/blob/master/src/fuzzy-picker.js#L88. In addition, some logic may be required (depending on hte behavior that you need) to show all items on further searches. If you end up going this route and would be willing contribute this back (in a fashion that this option would be configurable) I'd gladly accept a pull request for it!

@ashleydavis
Copy link
Contributor Author

I'd love to contribute actually. I have a few things I'd like to add, I'll keep each change simple and in separate pull requests so that you can consider them independently.

Do you have any coding style or unit tests I need to know about?

@1egoman
Copy link
Owner

1egoman commented Sep 13, 2018

I'd love to contribute actually.

Sweet!

Do you have any coding style or unit tests I need to know about?

There's a contributing document that talks about both of those: https://github.com/1egoman/fuzzy-picker/blob/master/CONTRIBUTING.md. Let me know if you have any specific comments and I'd be happy to address them.

@ashleydavis
Copy link
Contributor Author

Cheers, just getting started. I forked, cloned and did thenpm install.

But I get the following error relating to the 'hoek' module. Any idea what this is all about?


> npm install                                                                                                                                                                                                                                  
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning EINTEGRITY: sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM= integrity checksum failed when using sha1: wanted sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM= but got sha512-yJ
VQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==. (11423 bytes)                                                                                                                                           
npm WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.                                                                                                                        
npm WARN notice [SECURITY] lodash has the following vulnerability: 1 low. Go here for more details: https://nodesecurity.io/advisories?search=lodash&version=3.7.0 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit
 to get more info.                                                                                                                                                                                                                             
                                                                                                                                                                                                                                               
> [email protected] install C:\projects\github\fuzzy-picker\node_modules\node-sass                                                                                                                                                               
> node scripts/install.js                                                                                                                                                                                                                      
                                                                                                                                                                                                                                               
module.js:540                                                                                                                                                                                                                                  
    throw err;                                                                                                                                                                                                                                 
    ^                                                                                                                                                                                                                                          
                                                                                                                                                                                                                                               
Error: Cannot find module 'hoek'                                                                                                                                                                                                               
    at Function.Module._resolveFilename (module.js:538:15)                                                                                                                                                                                     
    at Function.Module._load (module.js:468:25)                                                                                                                                                                                                
    at Module.require (module.js:587:17)                                                                                                                                                                                                       
    at require (internal/module.js:11:18)                                                                                                                                                                                                      
    at Object.<anonymous> (C:\projects\github\fuzzy-picker\node_modules\boom\lib\index.js:4:12)                                                                                                                                                
    at Module._compile (module.js:643:30)                                                                                                                                                                                                      
    at Object.Module._extensions..js (module.js:654:10)                                                                                                                                                                                        
    at Module.load (module.js:556:32)                                                                                                                                                                                                          
    at tryModuleLoad (module.js:499:12)                                                                                                                                                                                                        
    at Function.Module._load (module.js:491:3)                                                                                                                                                                                                 
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):                                                                                                                                                        
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})                                                                              
                                                                                                                                                                                                                                               
npm ERR! code ELIFECYCLE                                                                                                                                                                                                                       
npm ERR! errno 1                                                                                                                                                                                                                               
npm ERR! [email protected] install: `node scripts/install.js`                                                                                                                                                                                    
npm ERR! Exit status 1                                                                                                                                                                                                                         
npm ERR!                                                                                                                                                                                                                                       
npm ERR! Failed at the [email protected] install script.                                                                                                                                                                                         
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.                                                                                                                                             
                                                                                                                                                                                                                                               
npm ERR! A complete log of this run can be found in:                                                                                                                                                                                           
npm ERR!     C:\Users\ash\AppData\Roaming\npm-cache\_logs\2018-09-13T05_39_05_838Z-debug.log                                                                                                                                                   
                          

@ashleydavis
Copy link
Contributor Author

I'm working on Windows, which seems pertinent.

@ashleydavis
Copy link
Contributor Author

Ok, problem solved.

I'm making a slight tweak to your contribution guide (what I need to get started).

I'll make a pull request so we can test the integration process!

@1egoman
Copy link
Owner

1egoman commented Sep 13, 2018

Ok, sweet! This process may be a bit rough around the edges, it's been a while since I did any real development on this project. It seems like in general it's gone relatively well so far! I merged #16, and I also pushed a commit to change the versions of node that travis ci builds with as some dependencies have updated to no longer support node 5 and 6 (travis now builds with node 8 and 10). That will hopefully fix up the ci process.

@ashleydavis
Copy link
Contributor Author

Yeah it's definitely a good start for what I need.

One issue I have is that it won't dismiss when I hit enter. Should that already work?

@1egoman
Copy link
Owner

1egoman commented Sep 13, 2018

It should if an item is selected - ie, in https://1egoman.github.io/fuzzy-picker/ or with gulp example locally, if I press / to open, then type lorem and press enter, it selects the given item and the picker closes. Are you unable to replicate this behavior?

@ashleydavis
Copy link
Contributor Author

Not currently, but it's probably my fault. Pretty tired at the moment and still hacking away.

@ashleydavis
Copy link
Contributor Author

These are things I want to add to it:

  • Display all items (make this opt in for backward compatibility).

Potentially later:

  • Show 1-3 recently used commands at the top of the list.
  • Be able to switch modes, for example Visual Studio Code has one command palette but you can dynamically switch it between commands and the list of open files.

@ashleydavis
Copy link
Contributor Author

BTW this is the app that I'm building:

http://www.data-forge-notebook.com/

@1egoman
Copy link
Owner

1egoman commented Sep 13, 2018

That looks pretty cool!

@ashleydavis
Copy link
Contributor Author

Also I'd like to show hotkeys for the commands in the fuzzy picker. But that's low priority.

@ashleydavis
Copy link
Contributor Author

It also needs a dark theme ;)

@1egoman
Copy link
Owner

1egoman commented Sep 13, 2018

Also, all those ideas sound great! I'd say that it'd be nice if all of them could be enabled or disabled such that someone could pick how minimal or extensible of a picker they'd like. Ha, and I agree on the dark theme too, it's something that I tend to do in applications as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants