ionide-vscode-fsharp icon indicating copy to clipboard operation
ionide-vscode-fsharp copied to clipboard

Error on Add file above or below

Open somelinguist opened this issue 1 year ago • 2 comments

Describe the bug

After installing 7.2.0, when trying to add a file above another file in the solution explorer, I get the following error:

Error running command fsharp.explorer.addAbove: copyOfStruct is not defined. This is likely caused by the extension that contributes fsharp.explorer.addAbove.

Pretty much the same with Add file below:

Error running command fsharp.explorer.addBelow: copyOfStruct is not defined. This is likely caused by the extension that contributes fsharp.explorer.addBelow.

Downgrading to Ionide 7.1.0 solves this particular issue for now.

Steps to reproduce

  1. Right click on a file in F#: Solution Explorer and choose Add file above or Add file below.

Machine info

  • OS: macOS 12.6
  • .NET SDK version: 6.0.401
  • Ionide version: 7.2.0
  • VS Code version: 1.71.2

somelinguist avatar Sep 25 '22 01:09 somelinguist

Same here, broken with 7.2

OnurGumus avatar Sep 25 '22 11:09 OnurGumus

Not sure if this is helpful, but adding the trace log just in case:

[2022-09-30 20:50:39.871] [exthost] [error] ReferenceError: copyOfStruct is not defined
	at N.setter (/Users/kevin/.vscode/extensions/ionide.ionide-fsharp-7.2.2/fsharp.js:2:750343)
	at set contents [as contents] (/Users/kevin/.vscode/extensions/ionide.ionide-fsharp-7.2.2/fsharp.js:2:615502)
	at Ol (/Users/kevin/.vscode/extensions/ionide.ionide-fsharp-7.2.2/fsharp.js:2:750357)
	at /Users/kevin/.vscode/extensions/ionide.ionide-fsharp-7.2.2/fsharp.js:2:757020
	at /Users/kevin/.vscode/extensions/ionide.ionide-fsharp-7.2.2/fsharp.js:2:757305
	at c._executeContributedCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:85:63770)
	at c.$executeContributedCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:85:64474)
	at i._doInvokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:95:13689)
	at i._invokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:95:13371)
	at i._receiveRequest (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:95:12141)
	at i._receiveOneMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:95:11042)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:95:8950
	at b.invoke (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:61:145)
	at p.deliver (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:61:2266)
	at v.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:61:1844)
	at a.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:69:19042)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:111:17079
	at b.invoke (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:61:145)
	at p.deliver (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:61:2266)
	at v.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:61:1844)
	at a.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:69:19042)
	at r._receiveMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:69:23854)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:69:21224
	at b.invoke (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:61:145)
	at p.deliver (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:61:2266)
	at v.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:61:1844)
	at v.acceptChunk (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:69:15873)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:69:15003
	at Socket.d (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:69:26763)
	at Socket.emit (node:events:526:28)
	at addChunk (node:internal/streams/readable:315:12)
	at readableAddChunk (node:internal/streams/readable:289:9)
	at Readable.push (node:internal/streams/readable:228:10)
	at Pipe.onStreamRead (node:internal/stream_base_commons:190:23) fsharp.explorer.addAbove {"value":"Ionide.Ionide-fsharp","_lower":"ionide.ionide-fsharp"}

somelinguist avatar Oct 01 '22 01:10 somelinguist

I think this might be the same issue, I get a similar error when clicking on the project -> add file in VSCode. The error: Error running command fsharp.explorer.addFile: copyOfStruct is not defined. This is likely caused by the extension that contributes fsharp.explorer.addFile.

kgday avatar Oct 04 '22 22:10 kgday

yep, that's definitely the same root cause. I haven't been able to figure it out yet.

baronfel avatar Oct 04 '22 22:10 baronfel

It fails before the input box is shown.

I see the way the input box is created in each of these cases was refactored to createFileDialg between 7.1.0 and 7.20. In that function two things that changed in the creation of the input box were:

  1. The addition of a validation function to check if the file already exists
  2. opt.value is no longer set before showing the input box.

I’m not familiar enough with the code to know if either of those changes could be the cause. Sorry for not being able to be more of a help.

https://github.com/ionide/ionide-vscode-fsharp/compare/7.1.0...7.2.0#diff-13ae03b738fb9bcc3ffeb34994ecc2d80e815e98079c87f8e9c0c42fadd2a9d9

somelinguist avatar Oct 05 '22 16:10 somelinguist

The error seems to be caused by these lines:

https://github.com/ionide/ionide-vscode-fsharp/blob/7059f31e3747a26c7314607bee6f888040bc2f95/src/Components/SolutionExplorer.fs#L631-L660

I am certain that it was working when I contributing the PR, I am not sure what changed.

Still investigating

MangelMaxime avatar Oct 05 '22 18:10 MangelMaxime

Oupsy, it is possible that I modified the binding in the paket-files folders directly but didn't send a PR because I didn't remember this requirements 😅

@baronfel I you

  1. Merge https://github.com/ionide/ionide-vscode-helpers/pull/47
  2. Update the dependency inside of ionide-vscode-fsharp
  3. Re-compile the project, then it should be fixed

MangelMaxime avatar Oct 05 '22 19:10 MangelMaxime

Lovely! I can merge that from mobile, but I'm away from a computer so if you could handle sending an update PR here after it's merged that would be amazing.

baronfel avatar Oct 05 '22 19:10 baronfel