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

PHP IntelliSense extension - unable to edit files after selecting 'Go To Definition' #24506

Closed
GeorgeWells opened this issue Apr 11, 2017 · 23 comments
Assignees
Labels
info-needed Issue requires more information from poster *not-reproducible Issue cannot be reproduced by VS Code Team member as described

Comments

@GeorgeWells
Copy link

  • VSCode Version: Code 1.11.1 (d9484d1, 2017-04-06T13:58:12.954Z)
  • OS Version: Windows_NT ia32 6.1.7601
  • Extensions:
Extension Author Version
githistory donjayamanne 0.2.0
php-debug felixfbecker 1.10.0
php-intellisense felixfbecker 1.1.5
debugger-for-chrome msjsdiag 2.7.3
gitblame waderyan 1.3.0

Steps to Reproduce:

  1. Right click a function and select 'Go To Definition'
  2. The cursor doesn't blink and the file is not editable

This also happens if you select 'Peek Definition' and double click in the output to open the file.

@GeorgeWells
Copy link
Author

No idea if this helps but when I 'Go To Definition' on a file which works I see this:
image

But for a file which doesn't work I see this:
image

Notice how it doesn't show the file encoding or the line ending format. Does it sound like it's failing some process of opening the file hence not working? This is the first time it has happened since I have raised this issue so it's quite hard to replicate.

@roblourens
Copy link
Member

roblourens commented May 19, 2017

If you open the same file a different way, like through the file explorer, does this happen?

@GeorgeWells
Copy link
Author

The workaround I have is to find the file in the explorer bar and open it.

@rebornix
Copy link
Member

@GeorgeWells can you help check the debugger console to see if there is any error there when it happens? Help -> Toggle Developer Tools.

@rebornix rebornix added the info-needed Issue requires more information from poster label Aug 11, 2017
@GeorgeWells
Copy link
Author

I'll have a look the next time it happens and let you know the results of the console.

I'm trying to see if I can replicate this issue again and again but may have come across a separate issue. If you switch git branch after the PHP Language Server parses (should it be parsing twice?) and this branch contains a new file with a class and another new file calling in the class and calling functions to it, you can't 'Go To Definition' on the functions to the class; it comes up with 'No definition found for xxx'. I'm guessing it's because it hasn't been parsed. After you've manually opened the file and closed it, it works.

@GeorgeWells
Copy link
Author

Okay so it's just happened, I've captured the whole console so some errors may not be related. Hope this helps

image
image

@GeorgeWells
Copy link
Author

GeorgeWells commented Aug 14, 2017

I've cleared out the console and 'Go To Definition' on the function, it's opening the file in a read-only state but no errors are appearing in the console

@roblourens
Copy link
Member

Yeah it looks like those errors are coming from emmet, and it has some issue with the grammar.

@jens1o
Copy link
Contributor

jens1o commented Aug 14, 2017

cc @ramya-rao-a

@GeorgeWells
Copy link
Author

Just happened again and checked the console, seeing different errors today. The below image is repeated on separate lines (14, 61, 129, 131, 132, 1331).

image

@jens1o
Copy link
Contributor

jens1o commented Aug 15, 2017

Can you do a SHA-1 checksum of that file?

It should be 5F9CB7AFD681E6C7CECE2F3E15108E266E6D2860

When it is different to mine, try reinstalling the extension, then you might have corrupt data.

@GeorgeWells
Copy link
Author

SHA-1 checksum comes out exactly the same:

F56B3864595701CD5C87AFE5248003247FEEFD9E

@jens1o
Copy link
Contributor

jens1o commented Aug 15, 2017

Err, that's not the same checksum?

@GeorgeWells
Copy link
Author

Reinstalled and got the same SHA-1 checksum as before:

F56B3864595701CD5C87AFE5248003247FEEFD9E

@jens1o
Copy link
Contributor

jens1o commented Aug 15, 2017

Can you attach your file? It's really weird...

@GeorgeWells
Copy link
Author

Had to zip it in order to upload it:

PhpTokenizer.zip

@jens1o
Copy link
Contributor

jens1o commented Aug 15, 2017

Seems valid... I don't know... PHP binaries are fine?

@GeorgeWells
Copy link
Author

I'm wondering if it's to do with the way I link up php.exe, I use the same one for both WAMP and PHP Intellisense at the same time:

image

Should I not be doing this?

@jens1o
Copy link
Contributor

jens1o commented Aug 15, 2017

I think that should be fine. Sorry, but I don't know what happens there... 😭

@roblourens
Copy link
Member

That error in PhpTokenizer is ok, it means that the tokenizer read a file with an unterminated comment, not that the file itself has an unterminated comment.

@jens1o
Copy link
Contributor

jens1o commented Aug 15, 2017

Oh really? That musn't be true... Oh my gosh. Sorry. :/

@GeorgeWells
Copy link
Author

I want to try to provide as much info as I can with this issue.

  • This issue only exists if you use the 'PHP Intellisense' plugin due to needing the 'Go To Definition' and 'Peek Definition'

  • This issue seems to only happen if you change git branches after the folder/repository has been parsed

  • Sometimes when you 'Go To Definition' you get a message saying saying 'No definition found for...' but sometimes it will open the file in some sort of read-only state

  • In this 'read-only' state, you are unable to edit the file, the cursor doesn't blink, there's no file path next to the file name

  • If you leave it open and do nothing for a while, a popup appears saying 'The window is no longer responding', although you can close this and continue using it with no problems

  • There are no errors/warnings appearing in the console

  • Once you open the file manually and close it, 'Go To Definition' works as intended but having to open the file manually somewhat defeats the point of this

  • I am using the latest version of VS Code and the PHP Intellisense plugin, using PHP 7.1.9

I'm guessing a potential fix to this could be to parse any new file that appears in the folder/repository i.e. when a git branch changes.

As always, if anyone wants me to check something or report anything then let me know.

@roblourens
Copy link
Member

Thanks for the details, it seems most likely that the language server is doing something unexpected here. I'm not sure where to go from here, but I don't have evidence of a vscode bug.

@roblourens roblourens added the *not-reproducible Issue cannot be reproduced by VS Code Team member as described label Nov 21, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster *not-reproducible Issue cannot be reproduced by VS Code Team member as described
Projects
None yet
Development

No branches or pull requests

5 participants