Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Curious how to get the JSON output for rescript build on version 12. I want it for more easily parsing the output in a build system.

You must be logged in to vote

Well, getting JSON output in rescipt build is just wish fulfillment.
If there is nothing indicating in rescript build --help it probably doesn't exists.

The best next thing would be to parse the lib/bs/.compiler.log file.
This is what the LSP server does to construct diagnostics.

Of course, your question also makes me wonder why the LSP is not providing you the same information?

Replies: 1 comment · 7 replies

Comment options

Can you elaborate a bit? What exactly were you doing in earlier versions?

You must be logged in to vote
7 replies
@dannyfritz
Comment options

I'm new to rescript so i wasn't doing it before.

To avoid an x/y problem: I'm trying to run rescript build and parse the output into my neovim quickfix panel. Parsing this cli output is proving tricky for me; hence the request for a more structured output.

@nojaf
Comment options

Well, getting JSON output in rescipt build is just wish fulfillment.
If there is nothing indicating in rescript build --help it probably doesn't exists.

The best next thing would be to parse the lib/bs/.compiler.log file.
This is what the LSP server does to construct diagnostics.

Of course, your question also makes me wonder why the LSP is not providing you the same information?

Answer selected by dannyfritz
@dannyfritz
Comment options

Alright. I should be able to get something working with the build artifacts or with the Language Server. Might be the right time for me to learn LSP.

@dannyfritz
Comment options

The LSP is leaving a lot to be desired, at least in Neovim. I'm finding it will only show diagnostics for open buffers and not for the whole project. So if a buffer is closed, it has no errors according to LSP until I try and build it with rescript build.

@nojaf
Comment options

Yes, LSP will only report diagnostics for the open files.
Can you describe one more time what you are actually after.
I still don't quite get your workflow.

@dannyfritz
Comment options

I have a binding in one module that I'm exporting. In another module I am importing it and using it. My editor will not tell me of any errors if I change the binding in the exporting module. As soon as I open the file of the importing module it will tell me of an error.

Ideally I would like to be able to change a type or binding and be told everywhere where I need to update its usage. Exhaustive checks on a pattern match is a good example of where I'd like to see errors for when I add a member to a Tuple or Variant type.

Both buffers open, I see the error:
Screenshot From 2025-12-23 08-04-40

One buffer open, I do not see the error:
Screenshot From 2025-12-23 08-04-29


I do see that workspace diagnostics is something that LSP supports and Neovim nightly supports. However, it doesn't seem like rescript-language-server nor my stable Neovim supports it. Therefore, I believe I am left with looking for a structured output of npx rescript build --json or parsing the stdout/stderr with regex to get workspace diagnostics in my editor. Another good option for me is to use the terminal built into my editor and run the command there, that way I can easily open files from the error message still, but missing out on a lot of the infrastructure built around Diagnostics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.