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

[ISSUE 1846] Resolve indent issue with class method named in #2004

Merged
merged 6 commits into from
Apr 22, 2022

Conversation

kcamsanc
Copy link
Contributor

@kcamsanc kcamsanc commented Mar 29, 2022

Description

  • Source branch in your fork has meaningful name (not main)

Fixes Issue:
#1846 Originally, if a class method was named in, it would get reformatted one level too far. This was caused by a previous hack for the in and of keywords, which would be tokenized as OPERATORs.

The fix was to tokenize in and of as OPERATORs only if the previous token was a WORD or STRING. This was how I differentiated between in/of as a keyword or as a class method name. Note: these changes resolve the issue for the of keyword as well.

I added unit tests to test in/of in cases in which they are keywords and when they are class method names.

CURRENT DISCUSSION:

  • I'm under the impression that when I add unit tests to /test/data/*/test.js, corresponding tests are automatically generated for the Python implementation. Is this correct?
  • If so, I found that my unit tests did not fail for the Python implementation before I made any changes to that implementation. However, I created a .js file myself, ran ./tools/python-dev js-beautify on my file, and found that the issue was actually reproducible in the Python implementation.
  • How can I add unit tests for the Python implementation to incur a test failure before making changes to the Python implementation?

Before Merge Checklist

These items can be completed after PR is created.

(Check any items that are not applicable (NA) for this PR)

  • JavaScript implementation
  • Python implementation (NA if HTML beautifier)
  • Added Tests to data file(s)
  • [NA] Added command-line option(s) (NA if
  • [NA] README.md documents new feature/option(s)

@kcamsanc
Copy link
Contributor Author

Hi, just checking back in, is there any more work to be done with this issue on my end?

@bitwiseman bitwiseman merged commit 3f22fa1 into beautifier:main Apr 22, 2022
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