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

VSCode extension does not show hints for functions annotated with record contract #1885

Closed
suimong opened this issue Apr 11, 2024 · 1 comment · Fixed by #1888
Closed

VSCode extension does not show hints for functions annotated with record contract #1885

suimong opened this issue Apr 11, 2024 · 1 comment · Fixed by #1888

Comments

@suimong
Copy link
Contributor

suimong commented Apr 11, 2024

Is your feature request related to a problem? Please describe.

Consider the following example:

{
  Schema = {
    foo,
    bar
      | {
        baz,
      }
  },
  some_func
    | Schema -> Dyn
    = fun src =>
      {
        some_val = src.bar.baz
      }
      ,
  some_record = {
    src | Schema,
    some_val  = src.bar.baz
  }
}

within some_record, the extension beautifully shows hints on the structure of Schema as I type after some_val = src., whereas within some_func, no hint is available after some_val = src.

Describe the solution you'd like
Enable hints for function parameters that are annotated with record contract.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context

> nickel --version  
nickel-lang-cli nickel 1.5.0 (rev 13ffc85)
@yannham yannham self-assigned this Apr 11, 2024
@yannham
Copy link
Member

yannham commented Apr 11, 2024

Assigning myself because I don't think this needs any support on the LSP side (I mean, not directly), but rather on the typechecker side. As far as I can tell, it should be simple to do, just need a bit of special casing (when walking an annotated term whose content is a function and type is a function type, retype() the function parameter with the domain of the function type)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants