claytonrcarter / tree-sitter-phpdoc

PHPDoc grammar for tree-sitter
22 stars 10 forks source link

Qualifed name starting with backslash not recognized #3

Closed mikehaertl closed 2 years ago

mikehaertl commented 2 years ago

A fully qualified name can also start with a backslash.

ts_phpdoc_backslash

Even though they should not be strictly required they are not wrong either. In fact intelephense does not work well if I leave them away.

It also seems that if the namespace has more path components things break:

ts_phpdoc_backslash2

mikehaertl commented 2 years ago

Everything's fine with @param and @property. Here a better example that shows several combinations:

ts_phpdoc_type

claytonrcarter commented 2 years ago

Thanks for the report. Confirmed. It seems that @param and @property are working properly b/c they require the variable to come between the type and description. Since @return doesn't have that requirement, the description is being greedy and consuming the last segment of the type. For whatever reason, if there is only whitespace between the type and the newline, it works OK.

claytonrcarter commented 2 years ago

Ah 🤦 I wasn't get PR emails for this. I see you already have a fix in place in #4