sandhje / vscode-phpmd

VSCode PHP Mess Detector extension
MIT License
15 stars 4 forks source link

Prevent "file does not exist" error upon creation of a new file #56

Closed alegag closed 3 years ago

alegag commented 4 years ago

When in Terminal, if I open a file that doesn't exists yet (let say by tiping code new_file.php, PHP Mess Detector report that the file it not found and auto-switch to the Output tab.

It shouldn't auto-switch on error. If it could at least be an option to be disabled by a setting, it would be nice.

This happens multiple time a day and have to take back the mouse to switch tab, it's kind of annoying and a lost of productivity.

Thanks !

sandhje commented 4 years ago

The switching to the tab is vscode default behaviour that I probably can't (but also do not want to) change. Off course the error of not existing files should not happen upon creating a new file as that is to be expected. I'll put this improvement on the list for the next release.

alegag commented 3 years ago

@sandhje In fact, looking closer to the output, I'm realizing that the issue is coming from the fact that it appends .git at the end of the fine name I'm opening.

From VSCode terminal:

code app/cli/some_script.php

Then PHP Mess Detector open the Output window and have the following errors:

[Error - 11:47:14 PM] File /home/www-data/public_html/project/app/cli/some_script.php.git not found
[Error - 11:47:14 PM] An error occured during document validation after open with the following message: ENOENT: no such file or directory, open '/home/www-data/public_html/project/app/cli/some_script.php.git'

For some reason, the .git get appended on files in some directories, but not all.

I haven't found a pattern for this.

alegag commented 3 years ago

I haven't had that issue (where the tab switch) in a while, I'll close this.

ghost commented 2 years ago

I'm getting this error on new, untitled files after they get auto-detected as PHP:

[Info  - 10:17:02 AM] New document opened, starting validation.
[Error - 10:17:02 AM] File Untitled-1 not found
[Error - 10:17:02 AM] An error occured during document validation after open with the following message: ENOENT: no such file or directory, open 'Untitled-1'

I'm guessing we don't need mess validation on scratchpad-like files, so these shouldn't be processed.