Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

contains template #default Syntax coloring #761

Closed
gezhigang1005 opened this issue Dec 7, 2021 · 11 comments
Closed

contains template #default Syntax coloring #761

gezhigang1005 opened this issue Dec 7, 2021 · 11 comments
Labels
bug Something isn't working

Comments

@gezhigang1005
Copy link

gezhigang1005 commented Dec 7, 2021

contains template #default Syntax coloring

image

@gezhigang1005 gezhigang1005 changed the title contains template #344 default Syntax coloring contains template #default Syntax coloring Dec 7, 2021
@IWANABETHATGUY
Copy link
Contributor

please offer a minimum reproduce code snippet instead a screenshot

@IWANABETHATGUY
Copy link
Contributor

<template>
    <div class="settings-main card">
        <a-input title="标题" >
            <template #default={row}>

            </template>
        </a-input>
    </div>
</template>

minimum reproduce snippet

@gezhigang1005
Copy link
Author

So you can reproduce it

Volar: v0.29.8

VsCode: 1.62.3

appVersion: "5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55
Safari/537.36"

<template>
    <div class="settings-main card">
        <a-input title="标题" >
            <template #default={row}>

            </template>
        </a-input>
        <a-input title="标题" >
            <template #default={row}>

            </template>
        </a-input>
        <a-input title="标题" >
            <template #default={row}>

            </template>
        </a-input>
    </div>
</template>

@gezhigang1005
Copy link
Author

Just add in the position of the deconstruction " It's good

#default="{row}"

<template>
    <div class="settings-main card">
        <a-input title="标题" >
            <template #default="{row}">

            </template>
        </a-input>
        <a-input title="标题" >
            <template #default="{row}">

            </template>
        </a-input>
        <a-input title="标题" >
            <template #default="{row}">

            </template>
        </a-input>
    </div>
</template>

@IWANABETHATGUY
Copy link
Contributor

i wrote a sematic token extension MVP here https://github.com/IWANABETHATGUY/volar-semantic-token-demo,
maybe we could integrate this in volar so that we could reduce the syntax highlighting issue

@IWANABETHATGUY
Copy link
Contributor

@johnsoncodehk any thought about this ?

@johnsoncodehk
Copy link
Member

This is a tmLanguage issue, and may not be suitable to be solved by semitic token, because vscode relies on tmLanguage to parse embedded language. This will affect the language configuration of autoClosingPairs, wordPattern, code snippet... in interpolation.
螢幕截圖 2021-12-08 上午9 38 20

It should modify here to resolve. html tmLanguage has resolved it already and I will refer to.
https://github.com/johnsoncodehk/volar/blob/b71700d1ce0ff8be7fda857b022530e02a58f2bd/extensions/vscode-vue-language-features/syntaxes/vue.tmLanguage.json#L783-L794

@johnsoncodehk johnsoncodehk added the bug Something isn't working label Dec 8, 2021
@IWANABETHATGUY
Copy link
Contributor

This is a tmLanguage issue, and may not be suitable to be solved by semitic token, because vscode relies on tmLanguage to parse embedded language. This will affect the language configuration of autoClosingPairs, wordPattern, code snippet... in interpolation. 螢幕截圖 2021-12-08 上午9 38 20

It should modify here to resolve. html tmLanguage has resolved it already and I will refer to.

https://github.com/johnsoncodehk/volar/blob/b71700d1ce0ff8be7fda857b022530e02a58f2bd/extensions/vscode-vue-language-features/syntaxes/vue.tmLanguage.json#L783-L794

agree, but tmLang seems more complicated and unpredicatable, we only use semantic token for html template, leave other with tmLang. semantic could be a experimental feature and disabled by default.What's more tree-sitter is incremental parser and parsing after every keystroke only took a few ms (normally 1-5ms) no matter how big the file is.

@johnsoncodehk
Copy link
Member

agree, but tmLang seems more complicated and unpredicatable

Yes, even though I rewrote vue tmLanguage, I still don't fully understand how it works. :S

What's more tree-sitter is incremental parser and parsing after every keystroke only took a few ms (normally 1-5ms) no matter how big the file is.

It will not be so fast in real world, because the semantic token will be implemented based on the LSP request. All LSP performance problems will affect the semantic token. For example, the request blocking problem caused by the long diagnosis time, the user may see that the semantic token is updated only after the diagnosis is updated.

@IWANABETHATGUY
Copy link
Contributor

the request blocking problem caused by the long diagnosis time, the user may see that the semantic token is updated only after the diagnosis is updated.

need to test on real project and open this feature on demand, so i don't think this would be a big problem

@IWANABETHATGUY
Copy link
Contributor

agree, but tmLang seems more complicated and unpredicatable

Yes, even though I rewrote vue tmLanguage, I still don't fully understand how it works. :S

What's more tree-sitter is incremental parser and parsing after every keystroke only took a few ms (normally 1-5ms) no matter how big the file is.

It will not be so fast in real world, because the semantic token will be implemented based on the LSP request. All LSP performance problems will affect the semantic token. For example, the request blocking problem caused by the long diagnosis time, the user may see that the semantic token is updated only after the diagnosis is updated.

IIRC, vscode will fallback to regex based highlight when semantic token is hanging. We could also add a switch to control it ,
open it as needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants