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

include php blade plugin in php cluster #7618

Open
wants to merge 34 commits into
base: master
Choose a base branch
from

Conversation

haidubogdan
Copy link

@haidubogdan haidubogdan commented Jul 29, 2024

Laravel is one of the most used frameworks in php, yet it still doesn't have support in Netbeans. (#7531 , #7231).
Mostly the main missing support is for blade templates syntax.

I've started to work on a plugin https://github.com/haidubogdan/netbeans-php-blade-plugin 3 years ago.
After using antlr as a lexer and parser, I found that scaling the plugin was much maintainable.
It's not the cleanest code, but I realized that I will always reach to the 99% finish status if I don't do the first pull request.

Most of the available features to be included are listed at https://github.com/haidubogdan/netbeans-php-blade-plugin.

  • syntax highlighting
  • blade syntax completion
  • declaration finder for specific blade template
    ....

And some are still missing

  • php embedded syntax validation
  • more advanced php syntax completion.

All feedbacks are welcome, I hope to reach nb 23 deployment :) .

TODO

  • Submit an ICLA (sent on 3 august) //I didn't received any response but I can consider it was submited
  • Change to the full name in commits
  • Check the license of the image (no response received from Tailor [laravel], using personal icon)
  • Add unit tests
    • basic lexer tests
    • basic parser error tests
    • basic completion tests
    • basic embedding tests (html, php)
    • basic braces tests
    • basic typehook tests
    • basic formatting test (wip)
  • Write all features with screenshots

@ebarboni ebarboni requested a review from junichi11 July 29, 2024 08:56
@junichi11 junichi11 added the PHP [ci] enable extra PHP tests (php/php.editor) label Jul 30, 2024
@junichi11
Copy link
Member

First of all, thank you for your contribution!

I hope to reach nb 23 deployment

Unfortunately, it's too late. The feature freeze date is July 26th.

Please write all features of this module with screenshots here as well. (not only the link)

Please add unit tests for features. e.g. code completion, indexer, navigator, parser, lexer, formatter etc. (also see: CslTestBase.java)

Did you submit an ICLA?

Probably, it takes a lot of time to review this.

@junichi11 junichi11 requested a review from tmysik July 30, 2024 05:03
@junichi11 junichi11 added this to the NB24 milestone Jul 30, 2024
@haidubogdan
Copy link
Author

Hi,
thank you for your feedback.
I will prepare the unit tests. ( I hope the base parser unit test classes will be available now that it's included in the IDE folder).
I didn't submit the ICLA. I will read about it.

@junichi11
Copy link
Member

How did you generate icons? (Are there icons based on something?)

https://github.com/apache/netbeans/pull/7618/files#diff-24c53d9c7defe885e1ee8adee9ff009c57d69e75621ad84625d8f9eaa8d7c9e1

…mpletion handler, parse, blade typed text interceptor
…d tokens, rename braces golden file for unix detection
@haidubogdan
Copy link
Author

This currently fails to build from source. With this patch I can build again:

diff --git a/php/php.blade/build.xml b/php/php.blade/build.xml
index 409c84c8400b..4ea7b71c6021 100644
--- a/php/php.blade/build.xml
+++ b/php/php.blade/build.xml
@@ -26,23 +26,35 @@
         <property name="v10.outdir" location="${src.dir}/org/netbeans/modules/php/blade/syntax/antlr4/v10"/>
         <property name="formatter.outdir" location="${src.dir}/org/netbeans/modules/php/blade/syntax/antlr4/formatter"/>
 
-        <java classname="org.antlr.v4.Tool"  fork="true" dir="${v10.outdir}">
+        <java classname="org.antlr.v4.Tool"  fork="true" dir="${v10.outdir}"  failonerror="true">
             <arg value="-o"/>
             <arg value="${v10.outdir}"/>
             <arg value="BladeAntlrLexer.g4"/>
             <arg value="BladeAntlrParser.g4"/>
+            <classpath>
+                <fileset dir="../../ide/libs.antlr4.runtime/external" includes="*.jar" />
+                <fileset dir="../../ide/libs.antlr3.runtime/external" includes="antlr-runtime-*.jar" />
+            </classpath>
         </java>
-        <java classname="org.antlr.v4.Tool"  fork="true" dir="${v10.outdir}">
+        <java classname="org.antlr.v4.Tool"  fork="true" dir="${v10.outdir}" failonerror="true">
             <arg value="-o"/>
             <arg value="${v10.outdir}"/>
             <arg value="BladeAntlrColoringLexer.g4"/>
+            <classpath>
+                <fileset dir="../../ide/libs.antlr4.runtime/external" includes="*.jar" />
+                <fileset dir="../../ide/libs.antlr3.runtime/external" includes="antlr-runtime-*.jar" />
+            </classpath>
         </java>
 
-        <java classname="org.antlr.v4.Tool" fork="true" dir="${formatter.outdir}">
+        <java classname="org.antlr.v4.Tool" fork="true" dir="${formatter.outdir}" failonerror="true">
             <arg value="-o"/>
             <arg value="${formatter.outdir}"/>
             <arg value="BladeAntlrFormatterLexer.g4"/>
             <arg value="BladeAntlrFormatterParser.g4"/>
+            <classpath>
+                <fileset dir="../../ide/libs.antlr4.runtime/external" includes="*.jar" />
+                <fileset dir="../../ide/libs.antlr3.runtime/external" includes="antlr-runtime-*.jar" />
+            </classpath>
         </java>
         <delete dir="${v10.outdir}" includes="*.tokens"/>
         <delete dir="${v10.outdir}" includes="*.interp"/>

I can add the updates.

I guess it could be something similar to https://github.com/apache/netbeans/blob/master/webcommon/javascript2.json/build.xml

@ebarboni ebarboni modified the milestones: NB24, NB25 Oct 22, 2024
@haidubogdan
Copy link
Author

Hi,
A progress update.
I've started to work on some big code refactoring (hopefully improvement). This might take a week or two to finish.

The changes started from way the parser data collection works, so all the important functionality : code completion, declaration finder ... etc needs to be adapted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do not merge Don't merge this PR, it is not ready or just demonstration purposes. PHP [ci] enable extra PHP tests (php/php.editor)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants