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

Won't propose classes and its methods #368

Closed
felixfbecker opened this issue Apr 26, 2017 · 38 comments
Closed

Won't propose classes and its methods #368

felixfbecker opened this issue Apr 26, 2017 · 38 comments

Comments

@felixfbecker
Copy link
Owner

From @regs01 on April 26, 2017 12:44

$zip = new ZipArchive; It won't propose ZipArchive. Won't propose new as well.
ZipArchive:: also won't propose methods.

Copied from original issue: felixfbecker/vscode-php-intellisense#114

@felixfbecker
Copy link
Owner Author

In what context are you testing this? Is it in a namespace? In global scope or in a function?

@regs01
Copy link

regs01 commented Apr 26, 2017

pure empty file

@felixfbecker
Copy link
Owner Author

What do you mean with "pure empty file"? You will need at least a <?php tag

@regs01
Copy link

regs01 commented Apr 27, 2017

Talking of PHP classes. It will propose own classes.

<?php
$zip = new ZipArchive;
?>

@felixfbecker
Copy link
Owner Author

Cannot reproduce

image

@regs01
Copy link

regs01 commented May 1, 2017

Further looking it seem extension's code completion doesn't work at all. Code Tools works, but Code Completion doesn't. All i have is VSC's internal completion.

Recent PHP 7.1.4 is setup correctly. php --ini in console brings no errors.

PS S:\_uwamp\bin\php\php-7.1.4-Win32-VC14-x86> php --ini
Configuration File (php.ini) Path: C:\WINDOWS
Loaded Configuration File:         S:\_uwamp\bin\php\php-7.1.4-Win32-VC14-x86\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

VSC output says all files parsed. Without any errors.
VSC console says PHP process connected. No errors as well. And nothing else as well.

Config

    "php.suggest.basic": false,
    "php.executablePath": "s:\\_uwamp\\bin\\php\\php-7.1.4-Win32-VC14-x86\\php.exe"

Tried reinstalling extension many time. No other php extensions.

@jens1o
Copy link
Contributor

jens1o commented May 2, 2017

Dumb question, is the extension installed? If yes, which version?

@regs01
Copy link

regs01 commented May 2, 2017

The one from marketplace. Tried uninstall/restart/install it many times. No luck.
https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-intellisense

@jens1o
Copy link
Contributor

jens1o commented May 2, 2017

Which version? The newest? Could you try to generate some errors, for example putting an invalid memory limit inside the settings and check wether the language server boots up. Any errors in the developer console?

@regs01
Copy link

regs01 commented May 2, 2017

1.2.1
http://i.imgur.com/rIg5acP.png

Removing fbclient,dll from PHP folder brings errors.

PS S:\Works\_uwamp\bin\php\php-7.1.4-Win32-VC14-x86> php --ini
PHP Warning:  PHP Startup: Unable to load dynamic library 'ext/php_interbase.dll' - ═х эрщфхэ єърчрээ√щ ьюфєы№.
 in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'ext/php_interbase.dll' - ═х эрщфхэ єърчрээ√щ ьюфєы№.
 in Unknown on line 0
Configuration File (php.ini) Path: C:\WINDOWS
Loaded Configuration File:         S:\Works\_uwamp\bin\php\php-7.1.4-Win32-VC14-x86\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

Seem to work.

PS S:\Works\_uwamp\bin\php\php-7.1.4-Win32-VC14-x86> php -r "`$x='hey there!'; echo `$x;"
hey there!

@jens1o
Copy link
Contributor

jens1o commented May 2, 2017

Nah, I meant to generate some errors the extension should throw when the php executable couldn't be found or is not valid...

Also, the error logs from the developer tools are missing. Do you know how you get this?
One last hint: The language server boots up as soon as you opened a php file.

@regs01
Copy link

regs01 commented May 2, 2017

[Extension Host] PHP process connected extensionHost.ts:284
That's all. Nothing else at all. Nothing appears while typing or pressing ctrl+space as well.
http://i.imgur.com/sPzrVoN.png

Even turned off all other extensions.

Changing php.executablePath brings error
PHP executable not found. Install PHP 7 and add it to your PATH or set the php.executablePath setting messageService.ts:126

At last same error from VSC if ruining config
[img]http://i.imgur.com/YHSpT1t.png[/img]

@jens1o
Copy link
Contributor

jens1o commented May 2, 2017

Seems that the language server is operating as usual as it should...

Is there anything interesting in the output panel? Errors and Exception are logged there. Please send us the full log.

@regs01
Copy link

regs01 commented May 2, 2017

[Info  - 22:51:38] 9 files total
[Info  - 22:51:38] Indexing project for definitions and static references
Parsing file:///s:/Works/AmES/uploader/config/config.php
Parsing file:///s:/Works/AmES/uploader/config/dev.config.php
Parsing file:///s:/Works/AmES/uploader/src/class.db.php
Parsing file:///s:/Works/AmES/uploader/src/class.filemanager.php
Parsing file:///s:/Works/AmES/uploader/src/class.varchecks.php
Parsing file:///s:/Works/AmES/uploader/src/functions.thirdparty.php
Parsing file:///s:/Works/AmES/uploader/test.php
Parsing file:///s:/Works/AmES/uploader/uploader.php
[Info  - 22:51:38] Indexing project for dynamic references
Parsing file:///s:/Works/AmES/uploader/config/config.php
Parsing file:///s:/Works/AmES/uploader/config/dev.config.php
Parsing file:///s:/Works/AmES/uploader/src/class.db.php
Parsing file:///s:/Works/AmES/uploader/src/class.filemanager.php
Parsing file:///s:/Works/AmES/uploader/src/class.varchecks.php
Parsing file:///s:/Works/AmES/uploader/src/functions.thirdparty.php
Parsing file:///s:/Works/AmES/uploader/test.php
Parsing file:///s:/Works/AmES/uploader/uploader.php
[Info  - 22:51:38] 0 Packages
[Info  - 22:51:38] All 9 PHP files parsed in 0 seconds. 66 MiB allocated.

@jens1o
Copy link
Contributor

jens1o commented May 2, 2017

Normal. Works fine. Did you modified your VSCode Installation(except for plug-ins)?

@regs01
Copy link

regs01 commented May 2, 2017

No. Straight from installer. Updates itself time to time. Extensions are only from marketplace.

@jens1o
Copy link
Contributor

jens1o commented May 2, 2017

hmm. Sorry, I don't know. I just can't reproduce...

Last thing: Is it possible to get the files your editing? (Maybe in a git repository?)

I could try and debug.

@regs01
Copy link

regs01 commented May 2, 2017

Same with empty php files in empty folder as i noted at first. Do you have any tests to catch the problem?

Aside of that i noticed that all hover tooltips have <?php in them. Seem to be parsing problem? Could be related?
http://i.imgur.com/iE9oQac.png

@jens1o
Copy link
Contributor

jens1o commented May 3, 2017

To be honest: I think there is no failure in the language server, but in your setup, since we got so many users where it is working fine.

Nah, the <?php tag is needed, so vscode can make the syntax highlighting right and there are no mistakes. This on purpose and works pretty well, we do that because in the protocol we aren't possible to set a language mode which will be respected.

Could you please give me access to your project folder and your full (workspace and user) settings? Maybe you disabled something you need to activate.

@boenrobot
Copy link

I'm having what I think is the same issue as this one...

A new empty folder, brand new PHP file, the only VSC extension enabled being this one (and I just now reinstalled it from the marketplace, just in case, and have never modified it), regardless of whether basic PHP auto complete is enabled or disabled (for that workplace), pretty much same results...

with the contents

<?php
Z

and hitting ctrl+space at the end there, I do get ZipArchive as a suggestion, but

<?php
$z = new Z

I don't get any classes. I get no suggestion if basic suggestions are off, and I get zip functions (not the class) if they're on.

Output:

[Info  - 16:21:55] 1 files total
[Info  - 16:21:55] Indexing project for definitions and static references
Parsing file:///d:/Vasko/WEB/php_test/test.php
[Info  - 16:21:55] Indexing project for dynamic references
[Info  - 16:21:55] 0 Packages
[Info  - 16:21:55] All 1 PHP files parsed in 0 seconds. 84 MiB allocated.

(where test.php has the above contents)

If I intentionally add a non-existent PHP in php.executablePath, I get

messageService.ts:125 PHP executable not found. Install PHP 7 and add it to your PATH or set the php.executablePath setting

but otherwise (be it not having this setting at all, or having it explicitly point to an installation of php-7.0.13-Win32-VC14-x64), in the console, I get

extensionHost.ts:285 [Extension Host] PHP process connected

Visual Studio Code about:

Version 1.12.2
Commit 19222cdc84ce72202478ba1cec5cb557b71163de
Date 2017-05-10T13:20:36.315Z
Shell 1.6.6
Renderer 56.0.2924.87
Node 7.4.0

VSC extension version: 1.2.2.

@jens1o
Copy link
Contributor

jens1o commented May 27, 2017

@boenrobot Could you show us the your full settings, including user settings? Maybe something disables autocomplete... Does autocompletion in general work?

@boenrobot
Copy link

boenrobot commented May 27, 2017

My workplace settings.json:

// Place your settings in this file to overwrite default and user settings.
{
    "files.eol": "\n",
    "files.trimTrailingWhitespace": true,
    "php.suggest.basic": false
}

my user settings:

{
    "terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
    "workbench.iconTheme": "vs-seti",
    "workbench.colorTheme": "Visual Studio Light"
}

everything else is default.

Does autocompletion in general work?

Starting off with an empty PHP file, and hitting ctrl+space, I do get <?php as the only suggestion, and after that, ctrl+space suggests keywords (array, if, for, etc.), and typing a letter before hitting ctrl+space again shows me all classes and functions starting with that letter (as expected). Typing $ instead of a letter shows me no suggestions (I mean, weird... not even superglobals?). If instead I type new with a space after, and hit ctrl+space then, I get keywords as suggestions.

@jens1o
Copy link
Contributor

jens1o commented May 27, 2017

With general, I mean other languages like TypeScript etc. But it looks like vscode is not the problem...

At the moment, $_GET and other superglobals aren't suggested, this is something I want to add once we switched to the tolerant parser by Microsoft. (#357)

Sorry, but I can't reproduce this 😢

@boenrobot
Copy link

Yes, it works for TypeScript and HTML certainly (double checked with files in the same folder as the PHP file).

Could it maybe be an OS specific issue? I have Windows 10 Pro x64 (version 1703, build 15063.332, all windows updates installed).

@jens1o
Copy link
Contributor

jens1o commented May 27, 2017

That's exactly the same setup as mine, except I do have a Home version.

@regs01
Copy link

regs01 commented Jun 8, 2017

Forgot about it. Access to project folder is pointless as it's same on empty files in empty folder. But if you mean something like TeamViewer, then no problem.

My user settings are

{
    "editor.tabSize": 2,
    "window.openFilesInNewWindow": "default",
    "window.newWindowDimensions": "inherit",
    "workbench.iconTheme": "material-icon-theme",
    "workbench.colorTheme": "Default Light+",
    "window.menuBarVisibility": "default",
    "php.suggest.basic": false,
    "php.executablePath": "s:\\Works\\_uwamp\\bin\\php7\\php.exe",
    "editor.fontWeight": "400",
    "editor.scrollBeyondLastLine": false,
    "powershell.codeFormatting.alignPropertyValuePairs": false,
    "editor.acceptSuggestionOnEnter": "on",
    "files.trimTrailingWhitespace": true,
    "editor.dragAndDrop": false,
    "extensions.autoUpdate": false
}

I keep worskspace (folder) empty, unless need to force specific encoding. But it's not of current case.

I added args.push('-c ./php.ini'); to make sure it's loading own php.ini. This is clean php from php.net. May be missing some extensions?

@jens1o
Copy link
Contributor

jens1o commented Jun 8, 2017

Hmm, let's see: Could you execute php -m and show us the output?

@regs01
Copy link

regs01 commented Jun 8, 2017

PS S:\Works\_uwamp\bin\php7> php -c ./php.ini -m
[PHP Modules]
bcmath
calendar
Core
ctype
date
dom
fileinfo
filter
gd
gettext
hash
iconv
interbase
intl
json
libxml
mbstring
mcrypt
mysqlnd
pcre
PDO
PDO_Firebird
Phar
readline
Reflection
session
SimpleXML
sockets
SPL
sqlite3
standard
tidy
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
zip
zlib

[Zend Modules]

@jens1o
Copy link
Contributor

jens1o commented Jun 8, 2017

looks good to me. :/

@SrMordred
Copy link

+1. Same problem.
Custom functions also don´t show parameters with autocomplete.

@regs01
Copy link

regs01 commented Jun 9, 2017

Tried also setting US to system locale in case of there could be some parsing problems. But no.

Does it need any additional extension?

@regs01
Copy link

regs01 commented Jun 9, 2017

Aside of Windows, tried to install it on clean Ubuntu 17.04. Absolutely same behavior.

@jens1o
Copy link
Contributor

jens1o commented Jun 10, 2017

Custom functions also don´t show parameters with autocomplete.

That's not implemented, yet. (Called "signature support")

Soon they will be a huge update, because we're switching the parsers. Maybe then it works?

@regs01
Copy link

regs01 commented Jun 10, 2017

Hope so

@regs01
Copy link

regs01 commented Jun 16, 2017

With new update suggestions works. Still no suggestion tootips though.

And have few problems.

Error expected semicolon on this

$config = require(getcwd() . '/config/config.php');

Few also problems could be related to original php extension? Should i post in VS Code issues?

  • Comments gets parsed and proposed despite editor.quickSuggestions comments is set to false
  • Suggestions won't autoinvoke on \ sign and on ::, like foo\bar::function
  • Snippets appears inside objects, namespaces and function declaration when calling ctrl+space manually

@boenrobot
Copy link

boenrobot commented Jun 16, 2017

I can also confirm that the original problem no longer occurs with version 1.4.0 of the VSC extension. I'm curious though... What changed? What was likely the key cause?

@roblourens
Copy link
Contributor

The "expected semicolon" error will be fixed by #415.

@felixfbecker
Copy link
Owner Author

Closing this, please open new issues for the other problems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants