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

Corrected the regex to detect espaced percent symbol. #139437

Merged
merged 2 commits into from
Jan 5, 2022

Conversation

KhaledSamir
Copy link
Contributor

This PR fixes #138921. The fix is correcting the regex that was being used for inline comment.

"%" should comment an inline comment but "%" should escape and treat the text if you write % along with a text after it. Example:

$$ % This is comment $$
Rendered as empty space.

$$ % Show this text $$
Rendered as "%Showthistext"

How to test

  • You can refer to this file to see how VS renders it: /vscode/extensions/vscode-colorize-tests/test/colorize-fixtures/md-math.md
  • You can create your own .md file and test the cases.

@ghost
Copy link

ghost commented Dec 18, 2021

CLA assistant check
All CLA requirements met.

@Nopec
Copy link

Nopec commented Dec 18, 2021

Hey @KhaledSamir,

I think your PR looks nice. But there is one thing I have to mention. Maybe you already considered the following, in that case just ignore me, I'm also pretty new to this repository 😊. Eventually there is a more experienced contributor who might clarify that or posts a link to a resource where the vscode tests are explained.

In my research I figured out that this file extensions/vscode-colorize-tests/test/colorize-results/md-math_md.json
contains the expected test results for the integration tests. Did you execute them?

When you are running the integration tests it takes your changes here extensions/vscode-colorize-tests/test/colorize-fixtures/md-math.md and generates the vscode editor output somehow and checks the output against the expected values in here extensions/vscode-colorize-tests/test/colorize-results/md-math_md.json

If you change the behavior in highlighting you can simply run the integration tests and check if other highlighting is affected or not.

After having no failures, just add your changes here extensions/vscode-colorize-tests/test/colorize-fixtures/md-math.md and run the integration test again. The tests will fail and automatically alter the vscode-colorize-tests/test/colorize-results/md-math_md.json file. Now you can run the tests again and they should pass and you can commit the changes.

Long story short, I've this gut feeling that your changes break the integration tests. I'll checkout your PR tomorrow morning and check if the integration test are still running.

P.S.: To execute the integration tests. You can do bash scripts/test-integration.sh in your devcontainer.

@KhaledSamir
Copy link
Contributor Author

KhaledSamir commented Dec 19, 2021

@Nopec Very good point, Andre! I actually didn't run the integration tests but I tests my changes in all default themes and it worked fine. But of course, this doesn't mean to avoid running the integration tests, so I tried to run them but I always get this error when I do:

image

This error happens with test-integration or test.sh files. Are you getting the same or is it working for you?

@Nopec
Copy link

Nopec commented Dec 19, 2021

@KhaledSamir No, I didn't encounter your problem.

I made a new devcontainer using your forked repository, checked out the corresponding branch ksaleh-katexcomment. Next I executed yarn install and ran the integration tests by executing bash scripts/test-integration.sh.

As I expect I'm getting this error:
Bildschirmfoto 2021-12-19 um 13 34 34

I copied the whole output to this file:
integration-test-fails-log-19-12-21.txt

After failing I get these unstaged changes:
https://diffy.org/diff/a729be820ce1d

Feel free to download this patch, apply it to your branch and amend the commit.

  1. git checkout ksaleh-katexcomment
  2. git apply downloaded-diff-file.diff
  3. git add extensions/vscode-colorize-tests/test/colorize-results/md-math_md.json
  4. git commit --amend
  5. Save and exit
  6. git push --force-with-lease

If you did so, I will checkout your changes and try again to execute the integration tests.
I hope we didn't miss something else. 🚀

@Nopec
Copy link

Nopec commented Dec 19, 2021

You also have to adjust your PR description, you need to write \\% to get \%. Now your text is a little bit confusing.

@Nopec
Copy link

Nopec commented Dec 22, 2021

Hello, I saw that my diff link was expired. So, here is a permanent one: https://diffy.org/diff/a729be820ce1d
I updated the link in my previous answer as well, to prevent confusion in the future.

@KhaledSamir You have any updates regarding fixing the integration tests? If you struggle, I could create a pull request to your fork if you want. Then we'll see what happens. Just, let me know.

@KhaledSamir
Copy link
Contributor Author

Hi @Nopec,

Thank you so much for helping with the PR, am actually travelling now and would be hard for me to do that until Friday or maybe tomorrow. Could you please help with a PR to my fork repo?

@Nopec
Copy link

Nopec commented Dec 22, 2021

@KhaledSamir sure, I'll do so tomorrow. Stay safe!

@Nopec
Copy link

Nopec commented Dec 23, 2021

@KhaledSamir Unfortunately, I'm not able to create such a PR. You might give me access to your fork, so I'd be able to extend your PR. On the other hand, I think it is not a problem to wait until Friday or even longer. Have a wonderful Christmas! 🎄

@rzhao271 rzhao271 requested a review from mjbvz December 27, 2021 16:39
@rzhao271 rzhao271 assigned mjbvz and unassigned rzhao271 Dec 27, 2021
@KhaledSamir
Copy link
Contributor Author

@Nopec Unfortunately, still am getting the same error "dirname path" but I gave you access to my fork. Could you please update the file and ran the integration tests again?

@Nopec Nopec force-pushed the ksaleh-katexcomment branch from 1b65c4b to 6c8168e Compare December 30, 2021 10:17
@Nopec
Copy link

Nopec commented Dec 30, 2021

@KhaledSamir I updated the test expectation values and rebased this branch to the latest main. The scripts/test-integration.sh script runs successfully. We should wait now for further reviews. Nice. 🚀

@Nopec Nopec force-pushed the ksaleh-katexcomment branch from 6c8168e to 3da81c4 Compare December 30, 2021 10:26
@KhaledSamir
Copy link
Contributor Author

KhaledSamir commented Dec 30, 2021

@Nopec Thank you, Andre! :) I'll try to fix this issue that I'm facing whenever I ran the integration tests script. Let's wait for the reviews now 💯

@mjbvz mjbvz added this to the January 2022 milestone Jan 5, 2022
@mjbvz mjbvz merged commit 0dba492 into microsoft:main Jan 5, 2022
@mjbvz
Copy link
Collaborator

mjbvz commented Jan 5, 2022

Thanks! The change looks good to me. Will be in the next insiders build and is scheduled for VS Code 1.64

@github-actions github-actions bot locked and limited conversation to collaborators Feb 19, 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.

Markdown KaTeX Highlighting: Percent symbol (%) not escaped
4 participants