Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception thrown on Windows 10 /Mac OS and does not seem to work #25

Closed
mickeyvip opened this issue Nov 26, 2020 · 17 comments
Closed

Exception thrown on Windows 10 /Mac OS and does not seem to work #25

mickeyvip opened this issue Nov 26, 2020 · 17 comments

Comments

@mickeyvip
Copy link

mickeyvip commented Nov 26, 2020

Tested on Windows 10, Mac MacOS 10.13.6 High Sierra.

  • VSCode 1.51.1
  • rescript-vscode version 1.0.0
  • bs-platform version 8.3.3

When opening any res file the output of the language server throws an exception and nothing seems to work.

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\server\out\RescriptEditorSupport.js:89:31
    at ChildProcess.exithandler (child_process.js:295:7)
    at ChildProcess.emit (events.js:223:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
[Error - 23:47:10] Connection to server got closed. Server will not be restarted.
[Error - 23:47:10] Request textDocument/completion failed.
Error: Connection got disposed.
	at Object.dispose (c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\client\node_modules\vscode-jsonrpc\lib\main.js:904:25)
	at Object.dispose (c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\client\node_modules\vscode-languageclient\lib\client.js:74:35)
	at LanguageClient.handleConnectionClosed (c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\client\node_modules\vscode-languageclient\lib\client.js:2309:42)
	at LanguageClient.handleConnectionClosed (c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\client\node_modules\vscode-languageclient\lib\main.js:155:15)
	at closeHandler (c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\client\node_modules\vscode-languageclient\lib\client.js:2296:18)
	at CallbackList.invoke (c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\client\node_modules\vscode-jsonrpc\lib\events.js:62:39)
	at Emitter.fire (c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\client\node_modules\vscode-jsonrpc\lib\events.js:121:36)
	at closeHandler (c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\client\node_modules\vscode-jsonrpc\lib\main.js:240:26)
	at CallbackList.invoke (c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\client\node_modules\vscode-jsonrpc\lib\events.js:62:39)
	at Emitter.fire (c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\client\node_modules\vscode-jsonrpc\lib\events.js:121:36)
	at IPCMessageReader.fireClose (c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\client\node_modules\vscode-jsonrpc\lib\messageReader.js:111:27)
	at ChildProcess.<anonymous> (c:\Users\Mickey\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\client\node_modules\vscode-jsonrpc\lib\messageReader.js:213:45)
	at ChildProcess.emit (events.js:228:7)
	at maybeClose (internal/child_process.js:1021:16)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
@mickeyvip mickeyvip changed the title Exception thrown on Windows 10 and does not seem to work Exception thrown on Windows 10 /Mac OS and does not seem to work Nov 28, 2020
@jaknas
Copy link

jaknas commented Nov 29, 2020

So I've managed to place a console.log inside RescriptEditorSupport

exec(command, { cwd: executable.cwd }, function (_error, stdout, _stderr) {

when logging _error:

Error: Command failed: c:\Users\jacko\.vscode\extensions\chenglou92.rescript-vscode-1.0.0\server\win32\rescript-editor-support.exe dump c:\Users\jacko\rescript-todo\pages\index.res:22:77
Fatal error: exception Invalid_argument("Filename.chop_extension")

    at ChildProcess.exithandler (child_process.js:304:12)
    at ChildProcess.emit (events.js:223:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {
  killed: false,
  code: 2,
  signal: null,
  cmd: 'c:\\Users\\jacko\\.vscode\\extensions\\chenglou92.rescript-vscode-1.0.0\\server\\win32\\rescript-editor-support.exe dump c:\\Users\\jacko\\rescript-todo\\pages\\index.res:22:77'
}

side note: when running c:\\Users\\jacko\\.vscode\\extensions\\chenglou92.rescript-vscode-1.0.0\\server\\win32\\rescript-editor-support.exe dump c:\\Users\\jacko\\rescript-todo\\pages\\index.res (without position params) in cmd.exe I got no error.

@yyc-git
Copy link

yyc-git commented Dec 2, 2020

I have no problem when I only install "bs-platform": "8.3.3" !

after I add npms: "@glennsl/bs-jest":"0.6.0" and "jest": "^26.5.2" and restall npm by "npm install --no-bin-links", when I enter rescript code in .res I have the same problem in Mac OS 10.15.1 !!!

@chenglou How to fix it? Thanks very much~

@chenglou
Copy link
Member

chenglou commented Dec 2, 2020

@cristianoc

@yyc-git
Copy link

yyc-git commented Dec 2, 2020

I have found why I have the problem: my yarn's version is too old! haha!

After I update the yarn to v1.22.5, and install by "yarn install", everthing is OK(no symlink error! so not need to use --no-bin-links!)!

so I don't have the problem! Thanks very much~

@mickeyvip
Copy link
Author

Are there a special node.js/npm/yarn requirements?

@cristianoc
Copy link
Collaborator

@Kleyu looks like the c: in c:\Users\jacko\rescript-todo\pages\index.res:22:7 confuses the command-line parsing when splitting out :22:7 based on :.
I guess if one were to try to manually pass instead pages\index.res:22:7 from the root of the project (which I guess is rescript-todo), it would work.
I'm going to change the parsing of command-line arguments.

@mickeyvip
Copy link
Author

MacOS Big Sur 11.0.1,
Node.js 10.22.1
VSCode 1.51.1

Working Ok.

@jaknas
Copy link

jaknas commented Dec 2, 2020

@Kleyu looks like the c: in c:\Users\jacko\rescript-todo\pages\index.res:22:7 confuses the command-line parsing when splitting out :22:7 based on :.
I guess if one were to try to manually pass instead pages\index.res:22:7 from the root of the project (which I guess is rescript-todo), it would work.
I'm going to change the parsing of command-line arguments.

Yes! It works just fine:

$ c:\\Users\\jacko\\.vscode\\extensions\\chenglou92.rescript-vscode-1.0.0\\server\\win32\\rescript-editor-support.exe dump pages\\index.res:16:29
[{"range": {"start": {"line": 16, "character": 18}, "end": {"line": 16, "character": 47}}, "hover": "string"}]

@cristianoc
Copy link
Collaborator

cristianoc commented Dec 2, 2020

There's a fix here: rescript-lang/rescript-editor-support#35
For a quick test, one can pull the binary from the CI artifacts.
It will be available in the next bugfix release of rescript-vscode.

cristianoc added a commit to rescript-lang/rescript-editor-support that referenced this issue Dec 2, 2020
@cristianoc
Copy link
Collaborator

This PR can be used to test that the issue is fixed:
#36

@mickeyvip
Copy link
Author

@cristianoc , thank you.

Unfortunately I have no clue how to test a GitHub repo locally in VSCode.
Same goes for "CI artifacts"

@mickeyvip
Copy link
Author

Also, I still have a problem with MacOS 10.13.6 High Sierra.

@cristianoc
Copy link
Collaborator

@mickeyvip a new release coming up soon, best to test that directly.
That will also include a new executable that hopefully is compatible with MacOS 10.13.6.

@cristianoc
Copy link
Collaborator

@mickeyvip
Copy link
Author

Release 1.0.1 works well on Windows.
Thank you

@mickeyvip
Copy link
Author

Release 1.0.1 works well on MacOS 10.13.6 High Sierra.
Thank you!

@mickeyvip
Copy link
Author

Guess this can be closed

@chenglou chenglou closed this as completed Dec 3, 2020
chenglou pushed a commit to chenglou/rescript-editor-support that referenced this issue Apr 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants