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

Activate embedded languages for indent rules #98621

Closed
roblourens opened this issue May 27, 2020 · 7 comments · Fixed by #124015
Closed

Activate embedded languages for indent rules #98621

roblourens opened this issue May 27, 2020 · 7 comments · Fixed by #124015
Assignees
Labels
author-verification-requested Issues potentially verifiable by issue author bug Issue identified by VS Code Team member as probable bug debt Code quality issues insiders-released Patch has been released in VS Code Insiders verification-steps-needed Steps to verify are needed for verification verified Verification succeeded
Milestone

Comments

@roblourens
Copy link
Member

From #98181 (comment)

PHP defines HTML as an embedded language here: https://github.com/microsoft/vscode/blob/master/extensions/php/package.json#L44. The bug is that VSCode doesn't activate 'html' when it needs it's indent rules. As HTML defines the indent rules in code, activation is necessary.

It's a VSCode issue. I suggest to create a new issue and assign it to @alexdima.

@alexdima
Copy link
Member

alexdima commented Jun 1, 2020

Currently, the onLanguage activation event fires only when a file that resolves to a certain language gets opened -- https://code.visualstudio.com/api/references/activation-events#onLanguage -- and not when encountering an embedded language as part of tokenization.

I am not 100% convinced we should activate all embedded languages. e.g. Is it expected to activate java when writing markdown and using fenced code blocks?

If the experience of php is so dependent on html, shouldn't the php extension take a dependency on the html extension?

FYI @aeschli

@alexdima alexdima added the under-discussion Issue is under discussion for relevance, priority, approach label Jun 1, 2020
@roblourens
Copy link
Member Author

via extensionDependencies? Could also do that. But it makes sense to me that if I want to add rules for the 'foo' language, then I always get activated when those rules would be applied to a region in some file.

@alexdima
Copy link
Member

alexdima commented Jun 1, 2020

Currently, the language-configuration.json is read when encountering an embedded language. This is done here. But I think this must be something that the html extension does via API and not via the language-configuration.json? We want at one point to move also the onEnter rules to the language-configuration.json, perhaps that's what's missing here?

@roblourens
Copy link
Member Author

Yeah, the html extension uses vscode.languages.setLanguageConfiguration with onEnterRules, wordPattern, and indentationRules.

@andrestone
Copy link

Hi!

Is there any workaround for this?

I have an autocompletion extension that works with onLanguage activation and I'd like to have it working when the language is used as embeddedLanguage.

Thanks.

@alexdima
Copy link
Member

alexdima commented May 6, 2021

Since we now support defining regular expression in language-configuration.json files, we could simply move the setLanguageConfiguration calls to the JSON files.

@alexdima alexdima added bug Issue identified by VS Code Team member as probable bug and removed under-discussion Issue is under discussion for relevance, priority, approach labels May 6, 2021
hediet added a commit that referenced this issue May 17, 2021
…descriptions in language-configuration.json. This fixes #98621.
@hediet hediet added this to the June 2021 milestone Jun 2, 2021
@andreamah andreamah added the verification-steps-needed Steps to verify are needed for verification label Jun 30, 2021
@mjbvz mjbvz added the author-verification-requested Issues potentially verifiable by issue author label Jul 1, 2021
@roblourens roblourens added the verified Verification succeeded label Jul 1, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jul 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
author-verification-requested Issues potentially verifiable by issue author bug Issue identified by VS Code Team member as probable bug debt Code quality issues insiders-released Patch has been released in VS Code Insiders verification-steps-needed Steps to verify are needed for verification verified Verification succeeded
Projects
None yet
7 participants
@roblourens @hediet @alexdima @andrestone @mjbvz @andreamah and others