Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[semantic][typescript] Constants with function type should be rendered as functions #89337

Closed
IllusionMH opened this issue Jan 27, 2020 · 3 comments
Assignees
Labels
semantic-tokens Semantic tokens issues typescript Typescript support issues verified Verification succeeded
Milestone

Comments

@IllusionMH
Copy link
Contributor

Issue Type: Bug

If function is declared as const + arrow function it will be hightlighted as variable in editor, but as function in hover.

image

Is it expected behavior?

/cc @aeschli

VS Code version: Code - Insiders 1.42.0-insider (3c6f6af, 2020-01-27T05:27:06.595Z)
OS version: Windows_NT x64 10.0.18363

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz (12 x 3192)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: enabled
rasterization: enabled
skia_renderer: disabled_off
surface_control: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 31.72GB (15.05GB free)
Process Argv
Screen Reader no
VM 0%
Extensions: none
@IllusionMH IllusionMH changed the title Semantic Highlight: Colors differs between editor and hover Semantic Highlight: Colors are different in editor and hover Jan 27, 2020
@aeschli
Copy link
Contributor

aeschli commented Jan 27, 2020

In general, with semantic highlighting there will be difference between code in the editor and code snippets in hovers the's no semantic resultion possible in hovers (lack of context).

The sample that you show is interesting, and not really related to semantic information. The TypeScript TextMate grammar classified fn as a function, but semantic highlighting calls is a variable. So basically the type of the variable is used to figure out that it is a function.
I will fix this in the semantic highlighting code.

@aeschli aeschli added this to the January 2020 milestone Jan 27, 2020
@IllusionMH
Copy link
Contributor Author

So basically the type of the variable is used to figure out that it is a function.

Looks like this is only working with variables, and interesting that TS doesn't highlight properties with arrow functions.
image

I will fix this in the semantic highlighting code.

So constants with function type will be highlighted as functions (yellow)? That would be awesome!

BTW, TS doesn't highlight unions as function even if all union members are function types 😢
image

@aeschli aeschli changed the title Semantic Highlight: Colors are different in editor and hover Semantic Highlight: Constants with function type should be rendered as functions Jan 28, 2020
@aeschli aeschli added typescript Typescript support issues semantic-tokens Semantic tokens issues labels Jan 28, 2020
@aeschli aeschli modified the milestones: January 2020, February 2020 Jan 30, 2020
@aeschli aeschli changed the title Semantic Highlight: Constants with function type should be rendered as functions [semantic][typescript] Constants with function type should be rendered as functions Feb 5, 2020
@aeschli
Copy link
Contributor

aeschli commented Feb 7, 2020

fixed by aeschli/typescript-vscode-sh-plugin@10f9e7f

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
semantic-tokens Semantic tokens issues typescript Typescript support issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

2 participants