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

[Feature Request]: show defaulted parts of types in CLS type hints #25048

Open
jabraham17 opened this issue May 14, 2024 · 0 comments
Open

[Feature Request]: show defaulted parts of types in CLS type hints #25048

jabraham17 opened this issue May 14, 2024 · 0 comments
Labels
area: Python bindings For things related to chapel-py, chpl-language-server, chplcheck, etc. area: Tools type: Feature Request

Comments

@jabraham17
Copy link
Member

Summary of Feature

Description:
CLS currently provides type hints when a user has not fully specified the type for a variable (using Chapel's type inference)

Screenshot 2024-05-14 at 4 32 03 PM

This feature also works well with generics.

One improvement to this would be to support generics with defaults, by showing the default.

Take the following code, where we assume the definition of R is far away from var a. The user has been explicit about the type, but perhaps they don't know the other type defaults for R.

record R {
  type t;
  type t2 = int;
  proc init(type t, type t2) {
    this.t = t;
    this.t2 = t2;
  }
}


var a: R(string) = new R(string);

We could have inlays to show what the defaults are, for example (the comments represent inlays)

var a: R(string/*, int*/) = new R(string/*, t2 = int*/);

In this case, the types constructors don't even need to exist, but this provides users more information to reason about their code and generics, without needing to invoke chpl or leave the editor.

This feature should probably be controlled by a flag, separate from the existing --type-inlays.

@jabraham17 jabraham17 added type: Feature Request area: Tools area: Python bindings For things related to chapel-py, chpl-language-server, chplcheck, etc. labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Python bindings For things related to chapel-py, chpl-language-server, chplcheck, etc. area: Tools type: Feature Request
Projects
None yet
Development

No branches or pull requests

1 participant