rescript-lang / rescript-lang/rescript-vscode

Make the type hint more completely.

Open
#784 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
ReScript
Stars
354
Forks
63
Avg merge
11h 29m
Merged PRs (30d)
1

Description

Currently, our editor only support a part of type hints for type, see the code below:

module Matrix2D = {
  type t = {
    row: int,
    col: int,
    data: Js.TypedArray2.Float32Array.t,
  }

  let make = (~row: int, ~col: int, ~data: Js.TypedArray2.Float32Array.t): t => {
    assert false
  }

  let zeros = (~row: int, ~col: int): t => {
    assert false
  }
}

module Matrix2Ds = {
  type t = Matrix2D.t

  let divide = (m1: t, m2: t): t => {
    assert false
  }
}

let m = Matrix2D.zeros(~row=3, ~col=3)

I create two modules, Matrix2D and Matrix2Ds, and a value with type Matrix2D.t. When i typing 'm->', i get some type hints of this:
image
As the image shows, the type hint only contains the functions of module Matrix2D, while, the function divide in module Matrix2Ds can also accept parameter with type Matrix2D.t. It's definitily a much better UE if our editor could support more completely type hints with searching among all functions by the first parameter type, just like the oop function call in Moonbit lang. @bobzhang
image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file, test, or entry point is named. Start by reproducing the Matrix2D and Matrix2Ds example in the editor and tracing how type hints are collected for m->. Done means suggestions also find functions whose first parameter has the value's type, including Matrix2Ds.divide, with coverage for this example.

Written by the indexing model from the issue text.

Assessment

Tech stack
vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.