Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Type Inference in hint list. - #11949

Merged
abose merged 14 commits into
masterfrom
swmitra/TypeInferenceInHintlist
Dec 10, 2015
Merged

Type Inference in hint list.#11949
abose merged 14 commits into
masterfrom
swmitra/TypeInferenceInHintlist

Conversation

@swmitra

@swmitra swmitra commented Nov 23, 2015

Copy link
Copy Markdown
Collaborator

Show type data in the hint list. This is work in progress as we need more ideas about the type symbols which are just text in this PR.
types

A snapshot of the rendered types from this implementation.

@swmitra

swmitra commented Nov 23, 2015

Copy link
Copy Markdown
Collaborator Author

Tagging @nethip @abose @ryanstewart

@swmitra swmitra added this to the Release 1.6 milestone Nov 23, 2015
@swmitra swmitra self-assigned this Nov 23, 2015
@sprintr

sprintr commented Nov 23, 2015

Copy link
Copy Markdown
Contributor

I believe it would be nice to show the data types as the output of typeof(instance) such as "string", "number", "function".

Edit: We can also use "keyword" to show type of keywords.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures

@swmitra

swmitra commented Nov 23, 2015

Copy link
Copy Markdown
Collaborator Author

Thanks @sprintr. I will try that once and post a snapshot of the rendering. Our goal is to have the type data without being too loud. We have to compare different displays in order to conclude.

@swmitra

swmitra commented Nov 24, 2015

Copy link
Copy Markdown
Collaborator Author

@sprintr With some CSS changes and new literals , this is how it looks.

types1

I must confess , to me it looks cluttered.

@petetnt

petetnt commented Nov 24, 2015

Copy link
Copy Markdown
Collaborator

@swmitra maybe aligning the literal labels to right would help (plus maybe more padding to the right side). I think that the labels the OP look pretty nice too, but then again the literals are more clearer (in a way). Maybe the labels could come from a labelProvider for a customization option 🍻

What about mixed types? For example [0, "string", {object: "foo"}]

@abose

abose commented Nov 24, 2015

Copy link
Copy Markdown
Contributor

+1 for right align.
+1 for short symbols as in the initial implementaion. Maybe a hybrid- on hover/arrow key on current selected entity, we could expand the short symbol to detailed string?

@ficristo

Copy link
Copy Markdown
Collaborator

FWIW, I like the second screenshot with right alignment.
I looked a bit in VisualStudioCode which has the inference type too: I like it can inference the return type of a function too.

@swmitra

swmitra commented Nov 24, 2015

Copy link
Copy Markdown
Collaborator Author

@petetnt @ficristo @abose @sprintr A snap with right aligned symbols and more padding.
types2

@swmitra

swmitra commented Nov 24, 2015

Copy link
Copy Markdown
Collaborator Author

@petetnt I will write a label provider which can be overridden by extensions.
autocomplete plus works in the same way I guess.
Also I have to infer a mixed type array , will update the PR with the check.

@ficristo

Copy link
Copy Markdown
Collaborator

@swmitra Can you try to put the type on the right of the variable names?

@abose

abose commented Nov 24, 2015

Copy link
Copy Markdown
Contributor

😅 I too meant right align after the variable names!

@sprintr

sprintr commented Nov 24, 2015

Copy link
Copy Markdown
Contributor

This looks good. I am not sure if short names will look good in right alignment.
+1 for right alignment.

@swmitra

swmitra commented Nov 24, 2015

Copy link
Copy Markdown
Collaborator Author

@sprintr @petetnt @ficristo @nethip Was trying with different styles. This one
types3
stands out with a small css tweak.

@swmitra

swmitra commented Nov 24, 2015

Copy link
Copy Markdown
Collaborator Author

@larz0 @ryanstewart Please provide your inputs.

@swmitra

swmitra commented Nov 24, 2015

Copy link
Copy Markdown
Collaborator Author

Some more tuning with the type details ( font-style and weight change )
types4

@ficristo

Copy link
Copy Markdown
Collaborator

Just throwing a couple of ideas:

  • the icon and the type should gray and only the one selected ones should be blue so the focus is on the autocomplete (or simply found some way to make the autocomplete a bit more outstanding)
  • the icons seem ot use another style but they are interesting, maybe make them use less space
  • I don't like much the italic version but the word keyword look better there. In the previous screen it has a too much different style

@swmitra great job 👍