microsoft / TypeScript-Sublime-Plugin

IO wrapper around TypeScript language services, allowing for easy consumption by editor plugins
Apache License 2.0
1.72k stars 237 forks source link

Add basic syntax highlighting to signature/quickinfo popups #707

Closed kbjr closed 5 years ago

kbjr commented 5 years ago

Adds syntax highlighting to signature popups, based on the currently active theme.

image

Also adds styling to the quickinfo popup

image

msftclas commented 5 years ago

CLA assistant check
All CLA requirements met.

DanielRosenwasser commented 5 years ago

This looks great - I will try to find some time to try the change out locally.

kbjr commented 5 years ago

So, I've also started looking at what it would take to implement this in the other (quick info) popups. It's looking like that will unfortunately be more complicated. Looking at the data that is available when it tries to render, there is nothing broken down into separate tokens like was already done in the signature popups.

{'info_str': '(parameter) foo: Bar', 'doc_str': '', 'error': ''}

(from https://github.com/Microsoft/TypeScript-Sublime-Plugin/blob/master/typescript/commands/quick_info.py#L67)

Is there some function or such somewhere that can break down the plain text from these info popups into a similar structure as the one used for the signature popups? If that can be done, then these can be highlighted in the exact same way, which would be really nice.

kbjr commented 5 years ago

Okay, I've got syntax highlighting working on quickinfo popups now, too.

I need to backport some extra changes I made back into the signature popups now, too (better highlighting pulling in bold/italics as well as color).

I have noticed some of the typing data that tsserver provides is... unusual.

Like calling this a keyword:

image

Or calling the 0 | 1 here a string literal

image

But, for the most part, it works

kbjr commented 5 years ago

Any chance of this moving forward? Been sitting idle for a few weeks

mohitsinghs commented 5 years ago

@kbjr 2f18af1 looks empty. Isn't it supposed to contain a method named quick_info_full in service_proxy.py ? I guess you already have those changes locally. BTW, cool work.

kbjr commented 5 years ago

Hmm... guess that's what I get for being lazy and copy pasting local changes into github. I'll go track that down.

kbjr commented 5 years ago

Okay, pulled a fresh copy, added the missing method, and confirmed its actually working. Should be good to go.

kylebebak commented 5 years ago

This would be a really nice improvement. Hope this can get merged soon.

@DanielRosenwasser

DanielRosenwasser commented 5 years ago

You're the best @kbjr! Thanks for the patience!