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

Opt into html language features #23

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Whoops
Copy link

@Whoops Whoops commented Jan 18, 2024

This opts into VSCode's built-in HTML language features, allowing for autocomplete and documentation based on HTML tags, attributes, etc.

Addresses #20 and #18.

The extension.js implementation is cribbed directly from Jinja's implementation to address microsoft/vscode#160585 as mentioned in the comment.

Copy link

@RedCMD RedCMD Jan 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not required to manually activate the html extension await htmlExtension?.activate();
because "extensionDependencies" already activates the extension for you

I don't think a blank extension.js file is required either

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It didn't activate the extension for me, that's how I found the vscode and Jinja issues. When I first tested it with just the package.json changes I had no auto complete or documentation on hover.

Copy link

@RedCMD RedCMD Jan 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird
it works when I add the package code to my non-html extension

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I retested removing "main": "./src/extension.js", from the package.json and it quit working for me until switching to HTML and back as described in microsoft/vscode#160585. I don't have any experience with VS Code extensions, so I can't really guess what might be different, but the discussion in that issue, especially that it sounds like they are considering auto-activating based on htmlLanguageParticipants makes me think there isn't an obvious better way.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interestingly, a blank extension.js file DOES work for me... which seems weird. I can only assume that running the activation script is enough to activate the dependencies, but just declaring them isn't? I've dropped the contents of extension.js since it apparently isn't needed after all.

Copy link

@RedCMD RedCMD Jan 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch
could prob make a bug report I guess

BTW after adding "main"
a blank "activationEvents": [] is required for publishing

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added, thanks! I can probably write up a bug report later this evening.

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

Successfully merging this pull request may close these issues.

None yet

2 participants