gencer / SCSS-Everywhere

A Visual Studio Code extension that provides CSS class and ID atttribute completion with incremental build and usage explorer for the HTML class attribute based on the CSS/Template files in your workspace. Also supports React's className attribute.
https://marketplace.visualstudio.com/items?itemName=gencer.html-slim-scss-css-class-completion
MIT License
24 stars 9 forks source link

Peek definition and link to class style #18

Closed imichall closed 5 years ago

imichall commented 5 years ago

Hi,

thanks for huge upgrade since yesterday. I'd like to ask you for some feature. Is it possible to make classes linkable to each scss style? I mean for example in latte:

where is for example span with class label

<span class="label">{label phone}</span>

and what would be great, make a class="label" linkable to style label.scss.

snimek obrazovky 2019-02-13 v 12 03 09
gencer commented 5 years ago

Hi @imichall,

You mean ctrl + click? (Go to definition?)

imichall commented 5 years ago

Hi @imichall,

You mean ctrl + click? (Go to definition?)

Exactly :)

gencer commented 5 years ago

Yes, this is possible. My proposal would be;

gencer commented 5 years ago

Furthermore, I will try to implement a basic support first on my end and update here.

Kcko commented 5 years ago

@imichall , @gencer You are talking about click & jump to file which i selected (clicked) from popup window with occurences? http://bit.ly/2RWFrDv

gencer commented 5 years ago

No. Let say you write a latte template and there is a class in it. When you ctrl + clik on that element it will open related SCSS/CSS file.

Kcko commented 5 years ago

@gencer oh, now i understand. Its that basically same action like as in my prev video, or not?

imichall commented 5 years ago

@gencer yes, that's what I mean :) And yes, I've tried it and the class is in single file. When I try to use cmd (macos) and hover on .some-class. Then it shows me, where is the class used. But I need, as you said, link from latte, html, php into definition directly to scss :)

gencer commented 5 years ago

I will look how vscode handle such actions and try to implement.

Kcko commented 5 years ago

@gencer You will have a lot of work because VSC is little buggy with this behavior, see my issue on VSC channel: https://github.com/Microsoft/vscode/issues/66984

imichall commented 5 years ago

Hi @gencer , how are you? Do you remember to my question of link from html, latte to each class style into defined style in scss? Have you already check it or started on it, please?

gencer commented 5 years ago

Hi @imichall, Yes, I will work on that. I am another city and will return to home in a week. This is why i did not go forward with any issues yet.

But, what I learned is that it requires some kind of language server/client. I also get some high cpu alerts from users. I hoped to fixed them before, Still weird.

imichall commented 5 years ago

Hi, how does it look? Just asking. Thanks for reply.

gencer commented 5 years ago

It seems we need a language server for this. I was hoping to implement without it but that is the way how it should be handled which is require significant changes that i cannot have at the moment. But, this is on my radar so subscribe on this thread.

gencer commented 5 years ago

Update: I might be a found a way of doing this without Language Server/Client via Hover feature.

I will try to implement this.

/cc @imichall