Skip to content

fix problems with html style comments in embedded code#160981

Merged
aeschli merged 10 commits into
microsoft:mainfrom
w1redch4d:html-in-js
Oct 26, 2022
Merged

fix problems with html style comments in embedded code#160981
aeschli merged 10 commits into
microsoft:mainfrom
w1redch4d:html-in-js

Conversation

@w1redch4d

Copy link
Copy Markdown
Contributor

Fixes #47448

@aeschli aeschli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you add a test case to

assertEmbeddedLanguageContent('<html><script>var i = 0;</script></html>', 'javascript', ' var i = 0; ');
?

if (fileName === currentTextDocument.uri) {
text = currentTextDocument.getText();
if (fileName.endsWith('html')) {
text = currentTextDocument.getText().replace(`<!--`, `/*`).replace(`-->`, `*/`);

@aeschli aeschli Sep 15, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The replacement should have the same amount of characters, so that all offsets stay the same.
-> /* instead of /*

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Can you add a test case to

assertEmbeddedLanguageContent('<html><script>var i = 0;</script></html>', 'javascript', ' var i = 0; ');

?

sure working on it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, pleaese add also one with some JavaScript code before and after it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

check the new commits, will that work?

w1redch4d and others added 3 commits September 15, 2022 20:02
add same amount of characters, in the replacements so that all offsets stays the same
@ghost

ghost commented Sep 15, 2022

Copy link
Copy Markdown

CLA assistant check
All CLA requirements met.

@w1redch4d

Copy link
Copy Markdown
Contributor Author

PTAL!

@w1redch4d

Copy link
Copy Markdown
Contributor Author

any progress on this?

@aeschli aeschli added this to the October 2022 milestone Sep 29, 2022
@aeschli
aeschli enabled auto-merge (squash) October 21, 2022 14:44
@aeschli

aeschli commented Oct 23, 2022

Copy link
Copy Markdown
Contributor

@w1redch4d Looks like the CLA bot is still not happy, can you add a comment with

@microsoft-github-policy-service agree [company="{your company}"]

to get the PR merged?

@aeschli aeschli modified the milestones: October 2022, November 2022 Oct 25, 2022
@w1redch4d

Copy link
Copy Markdown
Contributor Author

@aeschli what if i dont work for any company?, im currently a student

@aeschli

aeschli commented Oct 26, 2022

Copy link
Copy Markdown
Contributor

@w1redch4d If you work just on your behalf, then you can skip the company part and accept the Contributor License Agreement by replying

@microsoft-github-policy-service agree

@w1redch4d

Copy link
Copy Markdown
Contributor Author

@w1redch4d please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.

Contributor License Agreement

@microsoft-github-policy-service agree

@aeschli
aeschli merged commit 70328b1 into microsoft:main Oct 26, 2022
@aeschli aeschli modified the milestones: November 2022, October 2022 Oct 26, 2022
formigoni pushed a commit to formigoni/vscode that referenced this pull request Oct 27, 2022
)

* fix problems with html style comments in embedded code

* add spacings to the replaced characters

add same amount of characters, in the replacements so that all offsets stays the same

* revert javascriptMode.ts

* add replace characters in embeddedSupport.ts instead

* added few more tests with javascript

more testcases with js code before and after the comments

* polish

Co-authored-by: UwUeeb <[email protected]>
Co-authored-by: Martin Aeschlimann <[email protected]>
@w1redch4d
w1redch4d deleted the html-in-js branch October 28, 2022 05:45
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[html] problems with html style comments in embedded code

3 participants