lukehaas / RunJS

RunJS is a JavaScript playground for macOS, Windows and Linux. Write code with instant feedback and access to Node.js and browser APIs.
https://runjs.app
2.05k stars 44 forks source link

Optional Object Fields Autocomplete Appending Question Mark (?) #646

Open angelplusultra opened 1 month ago

angelplusultra commented 1 month ago

Bug Summary

I've encountered a bug where if you have an object with an optional field and use autocomplete to access the field, it will append a question mark ? to the end of the property name.

Steps to Reproduce Bug

  1. Create an object with an optional field:

const obj: { name?: string } = {}


2. Access the field and let the LSP suggest completion and accept when `name?` appears in the dropdown modal
```js
obj.name?

Video Re-Creation

https://github.com/user-attachments/assets/34eaff49-fea0-402b-8894-60e774ed6c38

lukehaas commented 1 month ago

@angelplusultra, thanks for raising this. I'll look into it. It's most likely an upstream issue.