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

Support code folding in custom block if lang is defined on the block #3119

Closed
1 task done
mrleblanc101 opened this issue Aug 18, 2021 · 13 comments
Closed
1 task done
Labels

Comments

@mrleblanc101
Copy link

mrleblanc101 commented Aug 18, 2021

  • I have searched through existing issues

Feature Request

I use vue-i18n-loading which create a <i18n></i18n> custom block in the SFC.
Currently I cannot use code folding inside this block even if it's just regular JSON.
The lang is defined on the block just like for <script> and <style> but the default is JSON.
<i18n lang="json"> or <i18n lang="yaml"> are both valid.
Capture d’écran, le 2021-08-18 à 17 33 58
Capture d’écran, le 2021-08-18 à 17 34 53

@mrleblanc101
Copy link
Author

mrleblanc101 commented Aug 18, 2021

Maybe the issue come from somewhere else as code folding seem to work when I do > Developper: Reload windows but disappear after a few seconds.
2021-08-18 17 35 49

@yoyo930021
Copy link
Member

yoyo930021 commented Oct 4, 2021

We can't support other languages in vetur.
If you want traditional behavior, #2308 (comment)

@mrleblanc101
Copy link
Author

I dont understand why it work for SCSS then.

@yoyo930021
Copy link
Member

yoyo930021 commented Oct 5, 2021

I dont understand why it work for SCSS then.

We have built-in SCSS features in vetur for Vue SFC.

@mrleblanc101
Copy link
Author

mrleblanc101 commented Oct 5, 2021

But why not for JSON, pug, stylus and LESS ? All of these are supported by Vue.
Why only SCSS ? These other language are also very common

@yoyo930021
Copy link
Member

But why not for JSON, pug, stylus and LESS ? All of these are supported by Vue. Why only SCSS ? These other language are also very common

We only support languages in doc.
https://vuejs.github.io/vetur/guide/intellisense.html#template

We don't have any time to maintaining other languages.
In fact, we don't even have good support for existing languages.
I'm welcome any PR for this.

@mrleblanc101
Copy link
Author

mrleblanc101 commented Oct 5, 2021

I'm not sure I understand. The code folding is handled natively by VS Code, don't you just provide the scope so VS Code know which language server to use ?
Since the lang attribute is provided in my exemple, can't you just provide it for all custom block so VS Code can handle it correctly ?
VS Code already does code folding for json and yaml

@mrleblanc101
Copy link
Author

From what I can see, Vetur already expose <i18n> custom block as json and the syntax highlighting is already working.
Why would code folding for JSON explicitly not be supported ? Can't we reopen as a feature request ? Why was this closed ?

@yoyo930021
Copy link
Member

I'm not sure I understand. The code folding is handled natively by VS Code, don't you just provide the scope so VS Code know which language server to use ? Since the lang attribute is provided in my exemple, can't you just provide it for all custom block so VS Code can handle it correctly ? VS Code already does code folding for json and yaml

You can refer this.
#2234 (comment)

@mrleblanc101
Copy link
Author

I'm not sure I understand. This issue has a PR that seem would fix this issue, but it seem like it got reverted.
I see no resolution in the ticket.

@mrleblanc101
Copy link
Author

mrleblanc101 commented Oct 5, 2021

Wait 🤔 It work on my personal machine but not on my work marchine...
Which is weird because I use setting sync so they should have identical config.
2021-10-04 22 56 34
l.

@yoyo930021
Copy link
Member

In the past, the code folding is from vscode built-in for indentation.
but we need advanced code folding, so we use code folding from LSP folding. https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_foldingRange

When using LSP folding, vscode built-in will disable.
You only can "editor.foldingStrategy": "indentation" for toggle to vscode built-in folding.

Otherwise, you will have to add the language LSP folding. Like HTML <template>.
We can't add LSP folding for any language from the custom block.
We will not have enough time to be able to maintain.

Otherwise, you have to use the proxy mechanism, but this is beyond the scope of this plugin.

@mrleblanc101
Copy link
Author

Weird that it work on my personal machine right now tho 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants