Maushundb / quick-editor

This repo has been DEPRECATED. Please use https://atom.io/packages/code-peek
MIT License
25 stars 6 forks source link

Support for excluding directories? #3

Closed benadamstyles closed 6 years ago

benadamstyles commented 9 years ago

Hey, love this package, thanks so much for building it!

It runs quite slow in some of my larger projects. Do you think this could be because atom.workspace.scan searches all directories? If so, it would be great to have a config setting to exclude some directories, because for example I'm never going to want it to search node_modules.

Maushundb commented 9 years ago

Hey thanks for the feedback I appreciate it! I figured this would be the case while building it, and have two fixes in mind to improve performance on larger projects:

  1. Cache the last edited style file for each markdown page (xxx.css -> xxx.html) and scan there first, else scan the whole project, so that you only need to do a slow search once per page.
  2. To your request, I was thinking of rather doing something along the lines of specifying a styles directory in a config setting and only searching there. From my experience I figure including your styles directory would be easier than excluding all your non-styles directory. Is this a correct assumption?
benadamstyles commented 9 years ago

1) is a great idea.

2) haha yes I think you're right. Can't think of an example where specifying excludes rather than includes would be better. If there's any way I can help, let me know.

Maushundb commented 9 years ago

Hey man, just published an update implementing #2 from above. Thought through the first idea and it actually causes some correctness issues when extended to the case where styles and defined in multiple directories so I'm going to save that one for a bit later. Let me know if specifying the style directory alone speeds things up on your larger projects!

benadamstyles commented 9 years ago

Hey, thanks. Forgive me for being thick, but how should I be referencing the path? My file structure is:

- app
  - common
    - stylesheets

I've tried app/common/stylesheets, app/common/stylesheets/, ./app/common/stylesheets...

Maushundb commented 9 years ago

Its an absolute path for now! So gotta do the full thing like /Users/MyName/Documents/code/project/styles...

Maushundb commented 9 years ago

Let me know if this improves performance at all for you!

benadamstyles commented 9 years ago

Hey, sorry for the delay – it works a treat yep. However, it's probably not a final solution because every time you work on a different project (I have like 8 on the go at the moment!) you have to change the path. The only solution i can think of off the top of my head is to require an optional json file in each project's root that can hold the path. .atomqe or something.