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

Overriding html-language-features in extension #55088

Closed
batisteo opened this issue Jul 25, 2018 · 4 comments
Closed

Overriding html-language-features in extension #55088

batisteo opened this issue Jul 25, 2018 · 4 comments
Assignees
Labels
html HTML support issues

Comments

@batisteo
Copy link

I’m writing an extension that support the Django template language. The id of the language is django-html and when it’s set this way, I’m losing the nice features given by HTML Language Features bundled extension.

On the other hand, if I set the language id as html, I’ve got my syntax, the auto-indentation and others, but I (and users) are losing the ability to switch to plain html.

This issue seems similar to #28145 but it’s not about embedding HTML here, nor injecting, as far as I understood.

I see that in html-language-features/client/src/htmlMain.ts the auto-indent is loaded based on hardcoded language id html.

What would it be the best way to use these features in a different language id?
And what if I want to add more indentation rules?

I opened a question on Stack Overflow as well.

@aeschli
Copy link
Contributor

aeschli commented Jul 26, 2018

Please have a look at #47288.
Clearly, you want to define your own language (django) along with a text mate grammar and language configuration.
You will need code with a scanner/parser that understands the django templating language
and can extract HTML out of the django document.
Having that you can either

  • create this as a virtual html document and forward requests to the HTML language server.
  • embed libraries to your language server that handle these calls.

@aeschli
Copy link
Contributor

aeschli commented Jul 26, 2018

We also have #49210, which aimes for a simpler, ideally configuration based approach.

@aeschli aeschli closed this as completed Jul 26, 2018
@batisteo
Copy link
Author

Thanks @aeschli for the pointers, I totally missed those. I’ll have a close look.

@batisteo
Copy link
Author

Either way, that’s a bit overwhelming for me yet.

@vscodebot vscodebot bot locked and limited conversation to collaborators Sep 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
html HTML support issues
Projects
None yet
Development

No branches or pull requests

2 participants