Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Format on save (goreturns) no longer works after upgrade #1333

Closed
matthewmueller opened this issue Nov 12, 2017 · 4 comments · Fixed by #1334
Closed

Format on save (goreturns) no longer works after upgrade #1333

matthewmueller opened this issue Nov 12, 2017 · 4 comments · Fixed by #1334

Comments

@matthewmueller
Copy link

matthewmueller commented Nov 12, 2017

Everytime I try and save, I see this in the console:

[Extension Host] TypeError: Cannot add property 0, object is not extensible
	at Array.push (<anonymous>)
	at Promise (/Users/matt/.vscode-insiders/extensions/lukehoban.go-0.6.67/out/src/goFormat.js:23:29)
	at Promise (<anonymous>)
	at Formatter.formatDocument (/Users/matt/.vscode-insiders/extensions/lukehoban.go-0.6.67/out/src/goFormat.js:15:16)
	at document.save.then (/Users/matt/.vscode-insiders/extensions/lukehoban.go-0.6.67/out/src/goFormat.js:70:35)
	at Object.g [as _notify] (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:65589)
	at Object.enter (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:68936)
	at n.Class.derive._oncancel._run (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:70764)
	at n.Class.derive._oncancel._completed (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:70205)
	at e.resolveOk (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:4:352592) (at formatter.formatDocument.then.err (/Users/matt/.vscode-insiders/extensions/lukehoban.go-0.6.67/out/src/goFormat.js:77:29))

A bit hard to write go without gofmt and goimports after getting used to them 😅

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Nov 12, 2017

Thanks for reporting @matthewmueller
Thanks for the fix @philk

I have updated a few other places where the array from the configuration was being modified directly. This issue occurs only in the 1.19 Insiders. Folks on VS Code 1.18 should be fine.

I'll release an update next week, until then you can do the below to get the fix beforehand:

@matthewmueller
Copy link
Author

matthewmueller commented Nov 13, 2017

Thanks for the quick fix! Works like a charm

Yep, I can also confirm that it was only happening on Insiders.

@KISSMonX
Copy link

Thank You.

@ramya-rao-a
Copy link
Contributor

The fix is now out in the latest update to the Go extension (0.6.69)

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants