FHIR / vscode-fsh

A Visual Studio Code language extension for FHIR Shorthand (FSH)
Apache License 2.0
18 stars 3 forks source link

Update collectFshFilesForPath to not check the same folder multiple times #99

Closed ethanjdiamond closed 1 week ago

ethanjdiamond commented 2 weeks ago

Description: The FSH extension was causing pretty bad CPU issues for my team. We work in a monorepo using pnpm workspaces, which means that all our packages, internal and external, are linked using symlinks in node_modules. The "find the fsh files in workspace" step didn't have logic to prevent the same folders from being repeatedly checked for every time they're added as a dependency to another package.

This PR does two things - 1) use realpath in fs, which will resolve symlink paths, and 2) keeps track of all the realpaths that have been visited and do an immediate return if the folder has been visited before. This should fix our issue.

Testing Instructions: It passes the previously existing tests and returns the proper .fsh files.

Related Issue: N/A

ethanjdiamond commented 1 week ago

@jafeltra Do you mind taking a look at this? Thanks!

cmoesel commented 1 week ago

Hi @ethanjdiamond. We just started a new sprint on Friday and I asked @mint-thompson to take the lead on reviewing this. I expect they will look at it soon! Thank you for the contribution!

ethanjdiamond commented 1 week ago

Thank you!