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

Add support for Evaluatable Expression #2414

Open
zobo opened this issue Oct 25, 2023 · 2 comments
Open

Add support for Evaluatable Expression #2414

zobo opened this issue Oct 25, 2023 · 2 comments

Comments

@zobo
Copy link
Contributor

zobo commented Oct 25, 2023

This service helps a vscode (php) debugger to better understand what part of the code can be evaluated - usually in a "hover" context.

If there is code like $this->arr['foo'][$xx['bar']]->buz[777] hovering over different parts should tell the debugger what par of the code to evaluate. For example:

  • $xx if hovering over $xx
  • $xx['bar'] if hovering over bar`
  • $this->arr if hovering over arr
  • $this->arr['foo'][$xx['bar']]->buz if hovering over buz
  • ...

The implementation consists of two parts - registering a provider in VSCode extension and handing the processing of to LS over a non standard LSP call.
https://github.com/zobo/vscode-php-intellisense/pull/64/files#diff-04bba6a35cad1c794cbbe677678a51de13441b7a6ee8592b7b50be1f05c6f626R146

https://github.com/zobo/php-language-server/pull/58/files

Functionality wise it's very similar to the textDocument/hover action.

@dantleech
Copy link
Collaborator

Phpactor basically already evaluates expressions e.g. hover over $a in $a = 1+5 / 2 but happy for this to be added.

@zobo
Copy link
Contributor Author

zobo commented Oct 25, 2023

Sorry, wasn't explicit that I intend to work on this. 😀
And as you said, there's probably already everything needed in there.

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

No branches or pull requests

2 participants