[ANN] rescript-vscode 1.2.0 released

Hey everyone!

We just published rescript-vscode v1.2.0 in the VSCode Marketplace.

You can install the newest version via the VSCode plugin pane or download the vsix file directly from our 1.2.0 release page.

Changes as stated in the Changelog:

Features:

  • Add autocompletion for object access of the form foo[“x”] and foo[“x”][“y”][“z”].
  • Support autocomplete of records for variables defined in other files.
  • Improve autocomplete when several values have the same name, with a heuristic to approximate the correct scope.
  • Add a “Dead Code Analysis” mode that will highlight globally dead values, redundant optional arguments, dead modules, dead types (records and variants) (#334)

Fixes:

  • Fix issue in JSX autocomplete when the component is declared external.
  • Fix jump-to-definition for uncurried calls.
  • Fix issue where values for autocomplete were pulled from implementations instead of interfaces.
  • Fix issue with autocomplete then punned props are used in JSX. E.g. <M foo …>.
  • Fix issue with JSX autocompletion not working after foo=#variant.
  • Fix issue in JSX autocompletion where the key label would always appear.
  • Fix issue in record field autocomplete not working with type aliases.
  • Fix issue where autocomplete for local values would not work in the presence of @react.component annotations.
  • Fix issue where the server would crash on large output produced by the binary command.
  • Fix issue where the server would crash when a file has a self cycle.

The Vim plugin will be updated soon.

Enjoy!

28 Likes

Great! Thanks a lot for your work! :smile:

Unfortunately, I discovered a regression with syntax highlighting though: https://github.com/rescript-lang/rescript-vscode/issues/345

1 Like

Hm, I am not entirely sure, but I guess this PR is the culprit.

We’ll figure out a fix and push another release.

The probelm about blank lines of raw block is getting more serious on my computer(win10 x64 vscode1.6.3)

After saving…

Edit a blank char and saving aagin…


This problem occurs in rescript build -w mode (The prettier plugin is disabled)

Does this only happen in VSCode?
This must be a problem with the pretty-printer I assume… but then again I wonder why this happens on save?

Just because i set the formatOnSave: true in settings.json on the vscode.
image

This problem does not happen when i called rescript format on command line.

I saw you already started a discussion on the bugtracker. Maybe let’s keep the conversation there for now, since this doesn’t have anything to do with our latest release!

Similar to @Mng12345’s issue with blank lines of raw block, quoted multiline strings also exhibit the same behavior when editor.formatOnSave is set to true.

let multiLineString = "sample
string"
let anotherString = `sample
string2`

Both of them get fed new lines on each save and the resulting format. They become:

let multiLineString = "sample

string"
let anotherString = `sample

string2`

Hi Patrick
I am getting a UnhandledPromiseRejectionWarning on start up with the latest rescript-vscode. I think.
Have you seen this?

[edit: still getting it after downgrade to 1.1.3 so ill have to look into it more]
[edit: is rescript-vscode newly expecting it is the sole execution of rescript watch? Our workflow right now is to run rescript watch in terminal]

Thanks for your work!
Alex:

((node:88897) UnhandledPromiseRejectionWarning: TypeError: Cannot read property ‘content’ of undefined
at Object.parseCompilerLogOutput (/Users/alexmouton/.vscode/extensions/chenglou92.rescript-vscode-1.2.0/server/out/utils.js:429:61)
at /Users/alexmouton/.vscode/extensions/chenglou92.rescript-vscode-1.2.0/server/out/server.js:54:54
at Map.forEach ()
at sendUpdatedDiagnostics (/Users/alexmouton/.vscode/extensions/chenglou92.rescript-vscode-1.2.0/server/out/server.js:52:19)
at FSWatcher. (/Users/alexmouton/.vscode/extensions/chenglou92.rescript-vscode-1.2.0/server/out/server.js:122:5)
at FSWatcher.emit (events.js:315:20)
at FSWatcher.emitWithAll (/Users/alexmouton/.vscode/extensions/chenglou92.rescript-vscode-1.2.0/server/node_modules/chokidar/index.js:535:32)
at FSWatcher._emit (/Users/alexmouton/.vscode/extensions/chenglou92.rescript-vscode-1.2.0/server/node_modules/chokidar/index.js:626:8)
at FsEventsHandler.emitAdd (/Users/alexmouton/.vscode/extensions/chenglou92.rescript-vscode-1.2.0/server/node_modules/chokidar/lib/fsevents-handler.js:420:14)
at FsEventsHandler._addToFsEvents (/Users/alexmouton/.vscode/extensions/chenglou92.rescript-vscode-1.2.0/server/node_modules/chokidar/lib/fsevents-handler.js:495:12)

Congrats on the release!

I’ve been working up a little PR to improve the handling of the textDocument/formatting request in the LSP server. Currently, it sends back a single textEdit that contains the entire file. Preferably, an LSP server sends back textEdits only for the changes. I’ve already implemented this in TypeScript, but I wasn’t thrilled with the performance on large diffs, so I’m re-implementing it in OCaml in the analysis tool.

I’m mainly doing this because I use the ReScript LSP server with Neovim, which currently has an annoying bug that can be mitigated by reducing the size of textEdits as much as possible.

I hope to submit it today or tomorrow.

2 Likes

issue
This may help you

how large are your files to run into performance bottlenecks? :scream:

For formatting I am using vim-rescript's :RescriptFormat command. Never have I been able to run into performance issues, and I have been working on some seriously big ReScript files so far.

Oh, the existing code is fine. What I meant is that I wrote some code to calculate diffs in TypeScript and it added a few tens of milliseconds of overhead, I figured I could get it down to single milliseconds if I re-wrote it in OCaml.

1 Like

We just published a follow up bugfix release 1.2.1 to fix the most critical bugs (e.g. broken syntax highlighting due to interpolation strings).

Changelog

12 Likes