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

auto closing of tags appears to not work on gjs/gts files #44

Open
NullVoxPopuli opened this issue Oct 15, 2023 · 12 comments
Open

auto closing of tags appears to not work on gjs/gts files #44

NullVoxPopuli opened this issue Oct 15, 2023 · 12 comments

Comments

@NullVoxPopuli
Copy link

Screencast.from.2023-10-15.09-11-24.webm
@evoactivity
Copy link
Contributor

When I did my deep dive into this to support gts/gjs I was not able to figure this part out. My assumption was injecting the html/handlebars context in a template tag should enable auto closing tags but that doesn't work.

I'll have another look some point next week to.

@lifeart
Copy link
Owner

lifeart commented Oct 19, 2023

@evoactivity
Copy link
Contributor

evoactivity commented Nov 10, 2023

These docs should be helpful when I get time to look at this
https://code.visualstudio.com/api/language-extensions/embedded-languages

@lifeart I'm assuming we could pull the completion you highlighted in typescript-hbs-plugin to your ember-language-server so this works for everyone?

@lifeart
Copy link
Owner

lifeart commented Nov 10, 2023

@evoactivity yep, right

@IgnaceMaes
Copy link

Not sure where exactly this should be configured in this extension.

Made a PR to vscode-auto-close-tag for people relying that: formulahendry/vscode-auto-close-tag#224

To get it working already today, you could install the extension and add this config:

{
  // other settings ...
  "auto-close-tag.activationOnLanguage": [
    "*",
    "glimmer-js",
    "glimmer-ts",
  ],
}

@evoactivity
Copy link
Contributor

Interesting approach, will be a lot simplar than adding this to the language server. It might be worth adding that addon to the extension pack rather than here though, especially since your PR was accepted installing it should just work.

@IgnaceMaes
Copy link

That seems reasonable to me, I can look to PR it. We'll need some info in the README though as to why it's needed, as VS Code ships this natively since https://code.visualstudio.com/updates/v1_16#_html-close-tags.

Seems like a good quick blog post to make as well, if I can find some time 👀

@evoactivity
Copy link
Contributor

hmm, this is kind of annoying, it auto closes when I'm writing typescript

image

@IgnaceMaes
Copy link

Good catch, apparently it's a known issue reported 8 years ago 🙃 (formulahendry/vscode-auto-close-tag#17)

I can take a look to fix it in the extension, but at that point it might be worth rather to take over the extension's functionality in this one?

@lifeart
Copy link
Owner

lifeart commented Feb 6, 2024

@evoactivity
Copy link
Contributor

evoactivity commented Feb 6, 2024

Using vscode-html-languageserver for this is the proper way to do it. I began looking into that with your typescript-hbs-plugin but I'm just not sure where to begin with it to be honest. I couldn't even figure out what calls getJsxClosingTagAtPosition, I assume something in vscode, but then how do we get it to be called for <template></template> regions?

It'd be good to get the full html intellisense working, not just auto closing tags too.

I plan on watching this at some point https://www.youtube.com/watch?v=Xo5VXTRoL6Q so hopefully I'll have a better understanding LSP's and can help contribute more.

@lifeart
Copy link
Owner

lifeart commented Feb 6, 2024

@evoactivity start with tests and original repo (https://github.com/microsoft/typescript-lit-html-plugin)
To proper support document fragments in we could take RangeWalker from Ember Language Server: https://github.com/lifeart/ember-language-server/blob/2583961db0415f0eac3ab929a2f99ce5b99429e6/src/utils/glimmer-script.ts#L166C14-L166C25 it allow us to have proper fragments for <style>, <template>, etc

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

No branches or pull requests

4 participants