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

Exclude directories from workspace for crawling performance reasons #130

Closed
7 tasks
jevakallio opened this issue Jul 15, 2020 · 5 comments
Closed
7 tasks
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@jevakallio
Copy link
Collaborator

@jojanaho reported on Twitter:

I started to experience slowdowns also yesterday, basically the the editor didnt respond to paste events for a while, and then all of a sudden multiple pastes from buffer

Not sure what caused it, but iirc markdown notes/links was showing some status update somewhere
I believe I had foam monorepo loaded, so it was prolly scanning various node_modules

In Foam we use workspace.findFiles, which has an exclude glob pattern option:
https://code.visualstudio.com/api/references/vscode-api#workspace (search for findFiles)

Markdown Notes uses the same:
https://github.com/kortina/vscode-markdown-notes/blob/c6d97c15c665a7f5f189b5a17d59ff808933c1f0/src/NoteWorkspace.ts#L291

Markdown links uses workspace.fs.readDirectory, which does not support an exclude glob:
https://github.com/tchayen/markdown-links/blob/78baab74c0d40a89eadcd3bfda8415ca2269ed6f/src/parsing.ts#L93

Foam and Markdown Notes already support files.exclude via workspace.findFiles, sowe can do this in .vscode/settings.json:

  "files.exclude":{
    "**/node_modules": true
  },

Steps to fix this issue are:

  • Submit a PR to Markdown Links to move to using workspace apis instead of workspace.fs apis
  • Add node_modules, _layout, and other known "bad" folders to files.exclude in foam-template
    • submit a PR to foam-gatsby-template
    • submit a PR to foam-eleventy-template
  • Document how to fix this for existing workspaces

We could also research:

  • Change the globbing pattern to be **/*{all markdown extensions here} in Foam -- this is a more of an advanced optimisation, as we already filter out all non-markdown files, so only work we save with this is iterating through a shorter array of paths
    • Submit the same change to Markdown Notes once we've gotten it to work
@jevakallio jevakallio added bug Something isn't working good first issue Good for newcomers labels Jul 15, 2020
@jivthesh
Copy link

@jevakallio Can i work on this issues I am a beginer to open source community can u guide can until be how to work with this

@jevakallio
Copy link
Collaborator Author

@jivthesh I think @ingalless is already looking to make the code fixes in vscode markdown links, but another useful thing would be add node_modules directories to the exclude lists in the different templates.

Basically, that would involve submitting PRs to the projects, adding this setting:

  "files.exclude": {
    "**/node_modules": true,
  },

To these settings.json files:

Here's an article that shows how to make a pull request:
https://www.freecodecamp.org/news/how-to-make-your-first-pull-request-on-github-3/

@ingalless
Copy link
Member

Just to add

files.exclude is good, but I'd love to see it respecting .gitignore too!

@Thiruppathi
Copy link

@jevakallio I've fixed it for Gatsby template here.
mathieudutour/foam-gatsby-template#11

Can you please have a look at the PR?

@riccardoferretti
Copy link
Collaborator

this is now fixed in foam core by #300

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

5 participants