Skip to content

Update Readme #419

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

Merged
merged 3 commits into from
May 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,22 @@ The plugin activates on `.res` and `.resi` files. If you've already got Reason-L
- `try`, `for`, etc.
- Folding, and [custom folding](https://code.visualstudio.com/docs/editor/codebasics#_folding) through `//#region` and `//#endregion`.

### Commands

#### `> ReScript: Create an interface file for this implementation file.`

Creates an interface file (`.resi`) for the current `.res` file, automatically filling in all types and values in the current file.

#### `> Open the compiled JS file for this implementation file.`

Opens the compiled JS file for the current ReScript file.

#### `> ReScript: Switch implementation/interface`

Switches between the implementation and interface file. If you're in a `.res` file, the command will open the corresponding `.resi` file (if it exists), and if you're in a `.resi` file the command will open the corresponding `.res` file.

> This can also be triggered with the keybinding `Alt+O`.

### Experimental Features

#### Dead Code Analysis mode
Expand All @@ -69,6 +85,24 @@ When done, stop the dead code analysis mode by clicking the `Stop Dead Code Anal

Currently does not work for full monorepo dead code analysis (although it should work for each monorepo package individually).

## Configuration

### Hide generated files

You can configure VSCode to collapse the JavaScript files ReScript generates under its source ReScript file. This will "hide" the generated files in the VSCode file explorer, but still leaving them accessible by expanding the source ReScript file they belong to.

Open your VSCode settings and type `editor.filenesting`. Enable the feature and scroll down to patterns.

The example has two patterns added:

![Shows configuration of file nesting patterns in VSCode.](https://user-images.githubusercontent.com/1457626/168123605-43ef53cf-f371-4f38-b488-d3cd081879de.png)

This nests implementations under interfaces if they're present and nests all generated files under the main ReScript file. Adapt and tweak to your liking.

A screenshot of the result:

![Shows the end result in VSCode, with ReScript related files nested under eachother appropriately.](https://user-images.githubusercontent.com/1457626/168123647-400e2f09-31e3-45a2-b74b-190c7c207446.png)

## Use with Other Editors

This repo also contains a language server that can power other editors. **However, the language server in this project is a pure implementation detail. We don't guarantee its stability for other editors' consumption** apart from Vim and Sublime Text.
Expand Down