vknabel / vscode-swiftformat

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

Report ENOTDIR spawnSync /usr/local/bin/swiftformat ENOTDIR #11

Closed amalendukar closed 4 years ago

amalendukar commented 4 years ago

Error: spawnSync /usr/local/bin/swiftformat ENOTDIR at Object.spawnSync (internal/child_process.js:982:20) at spawnSync (child_process.js:606:24) at Object.execFileSync (child_process.js:634:13) at Object.module.(anonymous function) [as execFileSync] (ELECTRON_ASAR.js:160:31) at format (/home/amalendu/.vscode/extensions/vknabel.vscode-swiftformat-1.3.3/out/src/SwiftFormatEditProvider.js:46:14) at SwiftFormatEditProvider.provideDocumentFormattingEdits (/home/amalendu/.vscode/extensions/vknabel.vscode-swiftformat-1.3.3/out/src/SwiftFormatEditProvider.js:74:16) at define.provideDocumentFormattingEdits.o.asPromise (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:555:286) at t.asPromise.Promise (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:55:720) at new Promise (<anonymous>) at Object.t.asPromise (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:55:692) at P.provideDocumentFormattingEdits (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:555:257) at define.$provideDocumentFormattingEdits._withAdapter.e (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:570:430) at W._withAdapter (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:565:723) at W.$provideDocumentFormattingEdits (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:570:408) at d._doInvokeHandler (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:623:396) at d._invokeHandler (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:623:88) at d._receiveRequest (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:621:730) at d._receiveOneMessage (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:620:605) at define.constructor._protocol.onMessage.e (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:618:791) at u.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:50:207) at v.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:186:579) at i.constructor.e.onMessage.e (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:783:484) at u.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:50:207) at v.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:186:579) at x._receiveMessage (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:191:17) at define.constructor._socketDisposables.push._socketReader.onMessage.e (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:188:116) at u.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:50:207) at f.acceptChunk (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:184:17) at define.constructor._register._socket.onData.e (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:183:372) at Socket.t (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:192:491) at Socket.emit (events.js:182:13) at addChunk (_stream_readable.js:283:12) at readableAddChunk (_stream_readable.js:264:11) at Socket.Readable.push (_stream_readable.js:219:10) at Pipe.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)

vknabel commented 4 years ago

Hi @amalendukar! Have you installed swiftformat yet? Make sure you have set the correct path for swiftformat.path in your VS Code settings.

What happens if you try to run /usr/local/bin/swiftformat manually from your terminal? What happens if you run which swiftformat?

amalendukar commented 4 years ago

Hi @amalendukar! Have you installed swiftformat yet? Make sure you have set the correct path for swiftformat.path in your VS Code settings.

What happens if you try to run /usr/local/bin/swiftformat manually from your terminal? What happens if you run which swiftformat?

amalendu@amalendu-HP-Pavilion-15-Notebook-PC:~$ swift run /usr/local/bin/swiftformat error: root manifest not found amalendu@Notebook-PC:~$ which swiftformat amalendu@Notebook-PC:~$ which swiftformat

vknabel commented 4 years ago

Thanks @amalendukar.

In order to use this extension you need to manually install the underlaying command line tool: nicklockwood/SwiftFormat.

When running which swiftformat it should print a path as below. Store this path into your swiftformat.path vscode setting.

$ which swiftformat
/usr/local/bin/swiftformat

Are you using Windows or Linux?

vknabel commented 4 years ago

Closing this due to inactivity.

Probably wrong config of the swiftformat path.