shikijs / twoslash

You take some Shiki, add a hint of TypeScript compiler, and 🎉 incredible static code samples
https://shikijs.github.io/twoslash/
MIT License
1.08k stars 53 forks source link

Autocomplete from dot #63

Open paarthenon opened 3 years ago

paarthenon commented 3 years ago

Is it possible to autocomplete from the . (dot) of the property accessor?

In short, I'd like to write something equivalent to this simplified example

// @noErrors
const obj = {
    alpha() { }
    beta() { }
    gamma() { }
};

obj.
//  ^|

and have alpha, beta, and gamma populated in the list.

I'm trying to demonstrate in my tutorial that an object I generate is limited to certain properties and if this were working it would be an excellent way to do that. As things are, this is what I see:

image

Thanks for taking a look.

orta commented 3 years ago

Agree, this is a bug all the way at ts-twoslash level here - I think this is just a case I didn't account for (as I did want the prefix in all my usecases)