Skip to content

fix(php): start context from name if begins with an attribute #424

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

Merged

Conversation

przepompownia
Copy link
Contributor

@przepompownia przepompownia commented Mar 27, 2024

Problem: attribute list can leave no room for class or function name
Solution: start the context from the name

@przepompownia przepompownia marked this pull request as draft March 27, 2024 14:36
@przepompownia przepompownia marked this pull request as ready for review March 27, 2024 14:56
@przepompownia przepompownia changed the title fix(php): start class_declaration context from name fix(php): start context from name if begins with an attribute Mar 27, 2024
@przepompownia
Copy link
Contributor Author

Example for test:

<?php

namespace X;

use Attribute;
use ReturnTypeWillChange;

#[Attribute]
class Example
{
    #[ReturnTypeWillChange]
    public function foo(): void
    {
        $x = 1;
    }
}

#[ReturnTypeWillChange]
function foo(): void
{
    $x = 1;
}

@lewis6991
Copy link
Member

Can you add that to the test file?

@przepompownia przepompownia marked this pull request as draft March 27, 2024 16:51
@przepompownia przepompownia marked this pull request as ready for review March 27, 2024 17:38
@przepompownia
Copy link
Contributor Author

@lewis6991 test seems to be ready

Fix method_declaration context

Fix for function_definition context

Add test for functions

Test for class and method
@przepompownia przepompownia force-pushed the php-class-context-start branch from 12d41fd to 18fc627 Compare April 14, 2024 10:51
@lewis6991 lewis6991 merged commit 29fcd4a into nvim-treesitter:master Apr 16, 2024
@przepompownia przepompownia deleted the php-class-context-start branch April 16, 2024 15:06
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