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

Restrict attribute completion using targets #2629

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

Conversation

przepompownia
Copy link
Contributor

Fix #2199

@przepompownia przepompownia changed the title Index attribute flags Restrict attribute completion using targets Apr 3, 2024
@przepompownia
Copy link
Contributor Author

Any idea how to better read target names from an attribute? At the moment it digs into Attribute node to find ScopedPropertyAccessExpression nodes and get their text representations.


if ($node->getEndPosition() > $truncatedLength) {
$node = $this->parser->parseSourceFile($truncatedSource)->getDescendantNodeAtPosition($truncatedLength);
}
Copy link
Contributor Author

@przepompownia przepompownia Apr 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dantleech @mamazu It's hacky and probably worth a better replacement, but passes all current tests.

  • on truncated source cannot determine attribute context (whether it's attached to class, method, etc.) because the relevant information is after the cursor
  • without truncation: the data set does not use variables declared after offset a in WorseParameterCompletorTest (and not only) does not pass.
  • inserting additional space after the cursor before parsing does not break any existing behavior but seems to help to get the correct node if there are no white space after the cursor (and avoid get the replacement for truncated document).

@przepompownia przepompownia marked this pull request as ready for review April 17, 2024 11:14
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.

Attribute completion: restrict result list by target, if present
1 participant