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

Rewrite the Tailwind classes replacement & imports replacement engines, update configs #37

Merged
merged 16 commits into from
May 18, 2024

Conversation

WarningImHack3r
Copy link
Owner

@WarningImHack3r WarningImHack3r commented May 5, 2024

Replace the regex-based Tailwind classes replacement mechanism with an AST-based one. It will help better support various cases not working with the current implementation, as well as reduce the code verbosity.

The AST parsing requires the built-in JavaScript module, which is only available on WebStorm and IntelliJ IDEA Ultimate. Other IDEs are thus no longer supported.

Also, the Svelte and Vue extensions (JSX support is built-in/sufficient with the JavaScript module), mandatory to be able to parse their associated files, are also now dependencies of this plugin.
Vue is already a built-in plugin for IU & WS, however Svelte will have (unless I find a workaround) to be installed with this plugin. However, both plugins are optional to install.

A similar engine is also brought to the imports replacement part, as well as for React's "use X" directives. Frameworks configurations have also been updated for comprehensive implementations.

TODO list

  • Make parsing of all supported file types working
  • Add more complex tests and support cases for robustness and real-world situations support
  • Implement file visitors into the real sources
  • Check for regressions and working implementations
  • Try to make Svelte plugin dependency optional (Vue is already built-in for both IU and WS)

@WarningImHack3r WarningImHack3r self-assigned this May 5, 2024
@WarningImHack3r WarningImHack3r marked this pull request as draft May 5, 2024 18:18

This comment was marked as outdated.

This comment was marked as outdated.

@WarningImHack3r WarningImHack3r changed the title Rewrite the Tailwind classes replacement engine Rewrite the Tailwind classes replacement & imports replacement engines, update configs May 12, 2024
- Fix r/w issues by moving actions
- Create a visitor for React directives
- Change way of working of current visitors for r/w
- Fix format for test files
- Fix code smell
- Remove (now?) useless Source.cleanAlias
- Move `runXAction`s to the lower possible level
- Fix their usage
- Fix inverted condition for RSC in React
- Invert condition in VueSource for readability
- Remove useless createPsiFile(Project, FileType, String)
Now time for regressions and stuff (I wish there was a better solution than allowSlowOperations {} though)
- Fix another read action issue
- Fix cssVariables setting never used for React
- Fix cssVariables being misused for Vue
- Fix imports replacements for Svelte
Copy link
Contributor

github-actions bot commented May 18, 2024

Qodana Community for JVM

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked

View the detailed Qodana report

To be able to view the detailed Qodana report, you can either:

To get *.log files or any other Qodana artifacts, run the action with upload-result option set to true,
so that the action will upload the files as the job artifacts:

      - name: 'Qodana Scan'
        uses: JetBrains/[email protected]
        with:
          upload-result: true
Contact Qodana team

Contact us at [email protected]

@WarningImHack3r WarningImHack3r marked this pull request as ready for review May 18, 2024 17:32
@WarningImHack3r WarningImHack3r merged commit bb51d83 into main May 18, 2024
5 of 6 checks passed
@WarningImHack3r WarningImHack3r deleted the ast-classes-parsing branch May 18, 2024 17:51
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.

2 participants