vknabel / vscode-swiftformat

SwiftFormat for VS Code
https://marketplace.visualstudio.com/items?itemName=vknabel.vscode-swiftformat
MIT License
39 stars 7 forks source link

Extension causes VS Code to ask macOS permissions to read unrelated folders #44

Open davidalejandroaguilar opened 2 weeks ago

davidalejandroaguilar commented 2 weeks ago

Hi,

I'm getting prompts asking to grant permissions to unrelated folders when saving a file located in: /Users/david/src/swift/UnitConversions/UnitConversions/ContentView.swift

I saw that nicklockwood/SwiftFormat's repo has a warning:

WARNING: swiftformat . will overwrite any Swift files it finds in the current directory, and any subfolders therein. If you run it in your home directory, it will probably reformat every Swift file on your hard drive.

I'm wondering if this extension accidentally caused that.

image image image image

vknabel commented 2 weeks ago

Hi @davidalejandroaguilar, thanks for the report. This is a bug when searching for your swiftformat binary when editing single files outside of workspaces. At least it wouldn't have formatted all your code. Working on a fix.

davidalejandroaguilar commented 2 weeks ago

Ahh interesting, glad you found the bug!

Just to clarify, the extension was only searching for the binary, and not formatting every Swift file it found in those folders, right?

vknabel commented 2 weeks ago

Correct. It didn’t want to format all those folders