Git Product home page Git Product logo

vscode-intelephense's Introduction

Intelephense

PHP code intelligence for Visual Studio Code.

Intelephense is a high performance PHP language server packed full of essential features for productive PHP development.

  • Fast camel/underscore case code completion (IntelliSense) for document, workspace and built-in symbols and keywords with automatic addition of use declarations.
  • Detailed signature (parameter) help for document, workspace and built-in constructors, methods, and functions.
  • Rapid workspace wide go to definition support.
  • Workspace wide find all references.
  • Fast camel/underscore case workspace symbol search.
  • Full document symbol search that also powers breadcrumbs and outline UI.
  • Multiple diagnostics for open files via an error tolerant parser and powerful static analysis engine.
  • Lossless PSR-12 compatible document/range formatting. Formats combined HTML/PHP/JS/CSS files too.
  • Embedded HTML/JS/CSS code intelligence.
  • Detailed hover with links to official PHP documentation.
  • Smart highlight of references and keywords.
  • Advanced PHPDoc type system supporting templates and callable signatures.
  • Reads PHPStorm metadata for improved type analysis and suggestions.
  • Easy rename of symbols. When appropriate, files/folders are automatically renamed too. PREMIUM
  • Accurate code folding of definitions, blocks, use declarations, heredoc, comments, and custom regions. PREMIUM
  • Quickly find all implementations of interfaces and abstract classes and associated methods. PREMIUM
  • Fast go to type definition of typed variables and parameters. PREMIUM
  • Fast go to declaration for methods implementing an interface or abstract method declaration. PREMIUM
  • Configurable auto PHPDoc creation that infers return types and identifies thrown exceptions. PREMIUM
  • Syntax tree driven smart select to intelligently expand/shrink selection. PREMIUM
  • Helpful code actions to import symbols, add PHPDoc, and implement all abstract methods. PREMIUM

Licence

Purchase a licence at https://intelephense.com to access PREMIUM features. Licence keys grant a single user access to all current and future premium features on multiple devices forever. Licence keys must be activated (automatically) via https before use. Features not marked as PREMIUM are free and always will be free.

The language server client (vscode-intelephense) is open source and licensed under the MIT licence.

The language server (intelephense) is proprietary. Please see here for details.

Quick Start

  1. Disable the built-in VSCode PHP Language Features.

    • Go to Extensions.
    • Search for @builtin php
    • Disable PHP Language Features. Leave PHP Language Basics enabled for syntax highlighting.

    Note that other (3rd party) PHP extensions which provide similar functionality should also be disabled for best results.

  2. Add glob patterns for non standard php file extensions to the files.associations setting.

    For example: "files.associations": { "*.module": "php" }.

  3. Optionally purchase and enter your licence key by opening the command pallete -- ctrl + shift + p -- and searching for Enter licence key.

Further configuration options are available in the intelephense section of settings.

Support

Try the Intelephense Documentation.

Found a bug? Got a feature request? Create an issue.

Acknowledgements

A big thank you to supporters who have bought a premium licence and have enabled the continued development and maintenance of this extension.

Intelephense uses the following open source libraries. Please see the following links for source code and licences.

vscode-intelephense's People

Contributors

artfulrobot avatar bmewburn avatar francoism90 avatar jellisii avatar kapitanoczywisty avatar lyrixx avatar madhancock avatar ssigwart avatar yaegassy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-intelephense's Issues

Is indexing ever finished?

This is my console output:

[Info  - 6:06:27 PM] Initialising
[Info  - 6:06:30 PM] Initialised in 2409 ms
[Info  - 6:06:32 PM] Indexing started.
[Warn  - 6:06:34 PM] file:///home/umpirsky/Projects/yo/vendor/composer/autoload_classmap.php exceeds maximum file size.
[Warn  - 6:06:34 PM] file:///home/umpirsky/Projects/yo/vendor/composer/autoload_static.php exceeds maximum file size.

And status bar label indicates it's still indexing after several hours:

screenshot from 2017-07-04 19-49-58

It this expected?

Traits Auto Import

am using version 0.8.1 of the extension and version 1.18.0 of VS Code , when trying to autocomplete for traits so that they get imported it didn't work .

peek 2017-11-17 01-38

Unable to read complex string syntax

The intelephense is flagging this as an error.
Eclipse can process this.

$sql = "update EVENT_LEVEL_SESSION set
StartDate='${"session_start_$s"} ${"session_start_time_$s"}',
EndDate='${"session_end_$s"} ${"session_end_time_$s"}'
where EventID=$event_id and SID=$s";

image

Add configuration option to enable/disable formatter

From @jjtriff bmewburn/intelephense#53

Hello:

I was trying to modify your code:

1. adding a configuration setting in package.json:
"intelephense.formatter.enable": { "type": "boolean", "default": true, "description": "Enable debug logging." }
2.  and asking for it before doing
this._registeredHandlers.set( DocumentFormattingRequest.type.method, new LanguageFeature<TextDocumentRegistrationOptions>((options) => this.createDocumentFormattingProvider(options)) );
inside client.ts file.

but I'm not sure what will I get when doing
Workspace.getConfiguration(this._id)

so I was trying to debug your extension, but I wasn't able to do it. Didn't make vscode to run in debug extension mode.

BTW: I think I'm mixing here code from two different github repos.

What I'm trying to ask is for a short guide to clone your repo, edit it, debug it, push it, and make a pull request.

Zanks in advanced

PS: this has to do with #46, so I can keep working using your wonderful extension

Variable and property scope

When placing your cursor on a variable, it will highlight everything (including strings).

Add the ability to only highlight scoped variables, which might be a start for variable name refactoring.

Project Not Indexing

It seems intelephense is only indexing ~20 files, or in many cases 0 files for my php projects. Auto complete, symbol search, and goto definition seem to now work until I open a file, then it gets indexed and works well.

screen shot 2017-11-22 at 10 42 33 pm

You can find my verbose output log HERE

  • Thanks for the help!

Maximum call stack size exceeded

I'm always getting this error when working on my php project

RangeError: Maximum call stack size exceeded
    at TypeString.merge (C:\Users\user\.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.2\server\node_modules\intelephense\lib\typeString.js:61:30)
    at VariableTable._mergeSets (C:\Users\user\.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.2\server\node_modules\intelephense\lib\typeResolver.js:546:83)
    at VariableTable.pruneBranches (C:\Users\user\.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.2\server\node_modules\intelephense\lib\typeResolver.js:521:18)
    at VariableTypeVisitor.postorder (C:\Users\user\.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.2\server\node_modules\intelephense\lib\typeResolver.js:296:36)
    at VariableTypeResolver.postorder (C:\Users\user\.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.2\server\node_modules\intelephense\lib\types.js:273:22)
    at TreeTraverser._traverse (C:\Users\user\.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.2\server\node_modules\intelephense\lib\types.js:142:21)
    at TreeTraverser._traverse (C:\Users\user\.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.2\server\node_modules\intelephense\lib\types.js:134:22)
    at TreeTraverser.traverse (C:\Users\user\.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.2\server\node_modules\intelephense\lib\types.js:38:14)
    at Context.get variableTable [as variableTable] (C:\Users\user\.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.2\server\node_modules\intelephense\lib\context.js:219:23)
    at SimpleVariableCompletion.completions (C:\Users\user\.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.2\server\node_modules\intelephense\lib\completionProvider.js:380:31)

Code checker

On thing what PHPstorm does very well is check your code for OOP errors like unused methods unused namespaces and mark the error when possible. I think you already have context of the classnames and the matching symbols somewhere in mem. You think this could be integrated quickly?

After upgrade to v0.8.0 the plugin doesn't work

After the v0.8.0 update the cmd+click and go to definition does not work properly

My configuration is

{
    "window.zoomLevel": 0,
    "gitlens.blame.line.enabled": false,
    "editor.fontSize": 14,
    "files.autoSave": "afterDelay",
    "editor.letterSpacing": 0,
    "php.suggest.basic": false,
    "gitlens.codeLens.recentChange.enabled": false,
    "gitlens.codeLens.enabled": false,
    "extensions.ignoreRecommendations": false,
    "go.formatTool": "gofmt",
    "editor.wordWrap": "on",
    "editor.minimap.enabled": false,
    "editor.fontWeight": "normal",
    "editor.fontFamily": "Monaco, 'Courier New', monospace",
    "workbench.colorTheme": "Base16 Dark Tomorrow",
    "intelephense.trace.server": "verbose",
    "intelephense.debug.enable": true,
    "emmet.showExpandedAbbreviation": "never"
}

Here a trace example

[Trace - 10:55:57] Sending request 'textDocument/definition - (23723)'.
Params: {
    "textDocument": {
        "uri": "file:///{removed path}CampaignCreator.php"
    },
    "position": {
        "line": 93,
        "character": 38
    }
}


[Trace - 10:55:57] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[Debug - 10:55:57] onDefinition | file:///{removed path}CampaignCreator.php | {\"line\":93,\"character\":38} | 0.009 ms | 83.7 MB"
}


[Debug - 10:55:57] onDefinition | file:///{removed path}CampaignCreator.php | {"line":93,"character":38} | 0.009 ms | 83.7 MB
[Trace - 10:55:57] Received response 'textDocument/definition - (23723)' in 2ms.
No result returned.


[Trace - 10:55:57] Sending request 'documentLanguageRanges - (23724)'.
Params: {
    "textDocument": {
        "uri": "file:///{removed path}CampaignCreator.php"
    }
}


[Trace - 10:55:57] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[Debug - 10:55:57] onDocumentLanguageRanges | 0.006 ms | 83.7 MB"
}


[Debug - 10:55:57] onDocumentLanguageRanges | 0.006 ms | 83.7 MB
[Trace - 10:55:57] Received response 'documentLanguageRanges - (23724)' in 1ms.
No result returned.


[Trace - 10:55:57] Sending request 'textDocument/hover - (23725)'.
Params: {
    "textDocument": {
        "uri": "file:///{removed path}CampaignCreator.php"
    },
    "position": {
        "line": 93,
        "character": 38
    }
}


[Trace - 10:55:57] Received response 'textDocument/hover - (23725)' in 1ms.
No result returned.


[Trace - 10:55:57] Sending request 'documentLanguageRanges - (23726)'.
Params: {
    "textDocument": {
        "uri": "file:///{removed path}CampaignCreator.php"
    }
}


[Trace - 10:55:57] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[Debug - 10:55:57] onDocumentLanguageRanges | 0.006 ms | 83.7 MB"
}


[Debug - 10:55:57] onDocumentLanguageRanges | 0.006 ms | 83.7 MB
[Trace - 10:55:57] Received response 'documentLanguageRanges - (23726)' in 2ms.
No result returned.


[Trace - 10:55:58] Sending request 'textDocument/documentHighlight - (23727)'.
Params: {
    "textDocument": {
        "uri": "file:///{removed path}CampaignCreator.php"
    },
    "position": {
        "line": 93,
        "character": 38
    }
}


[Trace - 10:55:58] Received response 'textDocument/documentHighlight - (23727)' in 2ms.
No result returned.


[Trace - 10:55:58] Sending request 'documentLanguageRanges - (23728)'.
Params: {
    "textDocument": {
        "uri": "file:///{removed path}CampaignCreator.php"
    }
}


[Trace - 10:55:58] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[Debug - 10:55:58] onDocumentLanguageRanges | 0.005 ms | 83.8 MB"
}


[Debug - 10:55:58] onDocumentLanguageRanges | 0.005 ms | 83.8 MB
[Trace - 10:55:58] Received response 'documentLanguageRanges - (23728)' in 3ms.
No result returned.


[Trace - 10:55:58] Sending request 'textDocument/definition - (23729)'.
Params: {
    "textDocument": {
        "uri": "file:///{removed path}CampaignCreator.php"
    },
    "position": {
        "line": 93,
        "character": 38
    }
}


[Trace - 10:55:58] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[Debug - 10:55:58] onDefinition | file:///{removed path}CampaignCreator.php | {\"line\":93,\"character\":38} | 0.016 ms | 83.8 MB"
}


[Debug - 10:55:58] onDefinition | file:///{removed path}CampaignCreator.php | {"line":93,"character":38} | 0.016 ms | 83.8 MB
[Trace - 10:55:58] Received response 'textDocument/definition - (23729)' in 1ms.
No result returned.


[Trace - 10:55:58] Sending request 'documentLanguageRanges - (23730)'.
Params: {
    "textDocument": {
        "uri": "file:///{removed path}CampaignCreator.php"
    }
}


[Trace - 10:55:58] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[Debug - 10:55:58] onDocumentLanguageRanges | 0.006 ms | 83.8 MB"
}


[Debug - 10:55:58] onDocumentLanguageRanges | 0.006 ms | 83.8 MB
[Trace - 10:55:58] Received response 'documentLanguageRanges - (23730)' in 2ms.
No result returned.

I found also an error

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at fs.readFile (/Users/***/.vscode/extensions/bmewburn.vscode-intelephense-client-0.8.0/server/node_modules/intelephense/lib/cache.js:68:26)
    at /Users/***/.vscode/extensions/bmewburn.vscode-intelephense-client-0.8.0/server/node_modules/graceful-fs/graceful-fs.js:78:16
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:439:3)
[Info  - 11:41:09] Connection to server got closed. Server will restart.
[Warn  - 11:41:09] Error: Connection got disposed.
[Warn  - 11:41:09] Error: Connection got disposed.
[Warn  - 11:41:09] Error: Language client is not ready yet
[Warn  - 11:41:09] Error: Language client is not ready yet
[Info  - 11:41:10] Initialising
[Info  - 11:41:12] Initialised in 2155 ms

TypeError: Cannot read property 'baseClause' of undefined

After the last update I have got this error:

[Info - 20:25:36] Initialising
[Info - 20:25:37] Initialised in 928 ms
[Info - 20:25:38] Indexing started.
[Error - 20:25:43] TypeError: Cannot read property 'baseClause' of undefined
at NameResolverVisitor._anonymousClassDeclaration (C:\Users\jlcal.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.0\server\node_modules\intelephense\lib\nameResolverVisitor.js:71:24)
at NameResolverVisitor.preorder (C:\Users\jlcal.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.0\server\node_modules\intelephense\lib\nameResolverVisitor.js:27:54)
at SymbolReader.preorder (C:\Users\jlcal.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.0\server\node_modules\intelephense\lib\types.js:255:49)
at TreeTraverser._traverse (C:\Users\jlcal.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.0\server\node_modules\intelephense\lib\types.js:126:31)
at TreeTraverser._traverse (C:\Users\jlcal.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.0\server\node_modules\intelephense\lib\types.js:134:22)
at TreeTraverser._traverse (C:\Users\jlcal.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.0\server\node_modules\intelephense\lib\types.js:134:22)
at TreeTraverser._traverse (C:\Users\jlcal.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.0\server\node_modules\intelephense\lib\types.js:134:22)
at TreeTraverser._traverse (C:\Users\jlcal.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.0\server\node_modules\intelephense\lib\types.js:134:22)
at TreeTraverser._traverse (C:\Users\jlcal.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.0\server\node_modules\intelephense\lib\types.js:134:22)
at TreeTraverser._traverse (C:\Users\jlcal.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.0\server\node_modules\intelephense\lib\types.js:134:22)
[Error - 20:25:43] TypeError: Cannot read property 'baseClause' of undefined
at NameResolverVisitor._anonymousClassDeclaration (C:\Users\jlcal.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.0\server\node_modules\intelephense\lib\nameResolverVisitor.js:71:24)
at NameResolverVisitor.preorder (C:\Users\jlcal.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.0\server\node_modules\intelephense\lib\nameResolverVisitor.js:27:54)
at SymbolReader.preorder (C:\Users\jlcal.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.0\server\node_modules\intelephense\lib\types.js:255:49)
at TreeTraverser._traverse (C:\Users\jlcal.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.0\server\node_modules\intelephense\lib\types.js:126:31)
at TreeTraverser._traverse (C:\Users\jlcal.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.0\server\node_modules\intelephense\lib\types.js:134:22)
at TreeTraverser._traverse (C:\Users\jlcal.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.0\server\node_modules\intelephense\lib\types.js:134:22)
at TreeTraverser._traverse (C:\Users\jlcal.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.0\server\node_modules\intelephense\lib\types.js:134:22)
at TreeTraverser._traverse (C:\Users\jlcal.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.0\server\node_modules\intelephense\lib\types.js:134:22)
at TreeTraverser._traverse (C:\Users\jlcal.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.0\server\node_modules\intelephense\lib\types.js:134:22)
at TreeTraverser._traverse (C:\Users\jlcal.vscode\extensions\bmewburn.vscode-intelephense-client-0.7.0\server\node_modules\intelephense\lib\types.js:134:22)
[Info - 20:25:55] Indexing ended | 10185 files | 16.948 s

PHP Format

Hello!
The PHP format in this extension has a weird behavior:

<?php

/*
 * Copyright 
 */

require 'file.php';

Is formated to:

<?php

/*
 * Copyright 
 */require 'file.php';

Inline Comments also strange:

<?php

// register something
$container['some'] = function () {
};

this will be insert as much blank lines as you hit the format command between comment and the $container declaration. :/

Fuzzy search for "Go To Symbol in Workspace"?

Apologies if this is in the wrong place, but I can't figure out if this is a VSCode or intelephense problem.

I'd really like to be able to "Go To Symbol in Workspace" (command-T) and type a string in the middle of a symbol (even if that slows down the match a lot) rather than having to search from the start.

E.g At the moment if I have the class "Foo_Bar" somewhere in my workspace and I search for "Bar" "Foo_Bar" doesn't show in the list, I have to remember the start of the symbol.

Copying variable excludes '$'

When double clicking to highlight a variable (i.e. $abc) the '$' is not selected. It is inconvenient to manually type '$' when cutting and pasting multiple lines

CPU Spike

I am having a consistent CPU spike running high on 99%++ trough out, any idea what could be causing this ?

screen shot 2017-11-08 at 12 44 18 pm

screen shot 2017-11-08 at 12 43 53 pm

No autocomplete when using Traits

When a class uses a trait there is no autocomplete for the methods that it should then have access to.

i.e.

trait UserTrait {
    /**
     * isAdmin
     *
     * @return boolean
     */
    public function isAdmin() {
        ...
    }
}
class User {
    use UserTrait;
}

Under the given/similar scenario there is nothing that shows up in autocomplete that would suggest that isAdmin() method should be available for a User object.

No autocompletion for Vendor files

It doesn't autocomplete/use the "Use" statement when I add classes from the vendor folder. I am using the Laravel Framework if it helps to shed more light

Keep braces on the same line

Could there be a way to keep the braces on the same line when formatting.

For classes and methods/functions the brace gets moved to the next line, and I would like them on the same line.

Extra newlines added by code formatting

When running code formatting I get extra newlines added. This appears to happen when a comment is inside an empty code block.

To reproduce create a new php file with the following code, then format the code

<?php
if (1 == 1) {
    // Every format or file save will add a new line under here
}
?>

Improved diagnostics

Diagnostics are currently limited to explicit parse errors reported by bmewburn/php7parser. The diagnostics provider could be improved by providing diagnostics on:

  • Incorrect argument types or number of arguments in call expressions.
  • Unused symbols
  • Undefined variables
  • Deprecated warnings 1.3
  • Duplicate identifiers
  • Unknown classes and methods #120 #468 #474 1.3
  • Strict null checking 1.3

Keybindings

There's now an Add Use Declaration command to condense a fully qualified name to a name (or alias) and add the corresponding use declaration. There are plans to add further commands. This issue tracks suggestions for the default keybindings for commands.

Error in output

[Error - 8:58:23 AM] Error: Unexpected token: 149
    at throwUnexpectedTokenError (/home/umpirsky/.vscode/extensions/bmewburn.vscode-intelephense-client-0.7.1/server/node_modules/php7parser/lib/parser.js:1098:15)
    at precedenceAssociativityTuple (/home/umpirsky/.vscode/extensions/bmewburn.vscode-intelephense-client-0.7.1/server/node_modules/php7parser/lib/parser.js:115:17)
    at unaryExpression (/home/umpirsky/.vscode/extensions/bmewburn.vscode-intelephense-client-0.7.1/server/node_modules/php7parser/lib/parser.js:2430:56)
    at expressionAtom (/home/umpirsky/.vscode/extensions/bmewburn.vscode-intelephense-client-0.7.1/server/node_modules/php7parser/lib/parser.js:653:24)
    at expression (/home/umpirsky/.vscode/extensions/bmewburn.vscode-intelephense-client-0.7.1/server/node_modules/php7parser/lib/parser.js:481:19)
    at returnStatement (/home/umpirsky/.vscode/extensions/bmewburn.vscode-intelephense-client-0.7.1/server/node_modules/php7parser/lib/parser.js:1937:38)
    at statement (/home/umpirsky/.vscode/extensions/bmewburn.vscode-intelephense-client-0.7.1/server/node_modules/php7parser/lib/parser.js:1466:24)
    at list (/home/umpirsky/.vscode/extensions/bmewburn.vscode-intelephense-client-0.7.1/server/node_modules/php7parser/lib/parser.js:406:27)
    at statementList (/home/umpirsky/.vscode/extensions/bmewburn.vscode-intelephense-client-0.7.1/server/node_modules/php7parser/lib/parser.js:446:16)
    at compoundStatement (/home/umpirsky/.vscode/extensions/bmewburn.vscode-intelephense-client-0.7.1/server/node_modules/php7parser/lib/parser.js:1423:47)
[Warn  - 8:58:25 AM] file:///home/umpirsky/Foo/vendor/composer/autoload_classmap.php exceeds maximum file size.
[Warn  - 8:58:25 AM] file:///home/umpirsky/Foo/vendor/composer/autoload_static.php exceeds maximum file size.
[Error - 8:58:25 AM] Request discover failed with message: Cannot read property 'text' of undefined
[Error - 8:58:25 AM] Request discover failed with message: Cannot read property 'text' of undefined

Files are not indexed after branch switch

Ciao guys,
I tried to force a reindex by clearing intelephense cache, but it doesn't seem to help much.

I just can't search for symbols that are in new files that where not in the master branch when I first indexed and appeared after I switched to a feature branch.

All the new files are invisible to intelephense even if it seems it indexed something.

screen shot 2017-11-27 at 16 56 29

I checked #38, but my files are all .php

Feature : copy Reference

I think I would be a nice addition to your project.
Add a right click copy Reference option in the menu.

These are needed when intellisense will not work
For example in service xml files.

Autocomplete variable when typehinting class name in a method

Would be nice to have a feature that phpstorm has, when you typehint a class/interface FooBar and you start to write parameter name $f, it would provide autocompletion for $fooBar.

I have actually tried to implement this myself and kind of got it working, however I was having a really hard time compiling the whole thing, as the change needs to happen in intelephense repository, and not in the extension itself. So in the end I pretty much had to copy/paste compiled js to client/server/node_modules and gave up after a few tries.

The question is, do you think this is a feature that you would like to have, and if yes, would you point me in the right direction as to how should I setup the dev environment (or feel free to implement it yourself)

Global PHP functions: Ommit leading namespace separator

When using autocompletion on global PHP functions it automatically puts a leading backslash in front of the function. Is there a way to ommit this?

Example:

<?php
namespace Foo\Bar;
class Something {
    public function something()
    {
        return \array_shift();
    }
}

How do you use the "Add Use Declaration" command?

I originally wrote a review of this plugin and in it, I mentioned a Sublime PHP Companion feature that I would love to see in this plugin. It has been added (thanks!), but I'm either not using it correctly, or it doesn't seem to work.

I have the new command bound to a key. I've tried starting to type a class name and hitting the hotkey for Add Use Declaration. It does pop up a dialog to enter an alias for the class (a nice feature that isn't available with Sublime PHP Companion as far as I know), but nothing happens.

I've also tried expanding the class name and hitting the hotkey. highlighting it and doing the same - all with the same result.

Is there some documentation on how to use the Add Use Declaration feature? What is the correct way to use it?

Add basic formatting config options

Is there any way (or could it be added) to have some basic formatting options?

something like...

"intelephense.format.options": {
    curly {
        nextLineAfterFunction: [true, false],
        nextLineAfterIf: [true, false],
    }
},

How those options are there isn't that important. I'd mainly just like a way to provide some basic guidance on where brackets should be placed. Possibly some control over spacing as well.

i.e. if(...){} vs if (...) {} with options to add a space before after parens

The reason this bugs me enough to add a request (beyond just having the end of the line bracket preference) is due to how VS Code folds code when you collapse a block.'

codefoldingexample

Formatting a document incorrectly modifies string values

I'm using PHP's doubling quotes to build out a string value...

i.e.

return "<li><a href='/inspection-groups/$ig->id/locations/create'>Edit Inspection</a></li>";

When running the formatter it modifies the value of the string by adding spaces before the "$".

i.e.

return "<li><a href='/inspection-groups/ $ig->id/locations/create'>Edit Inspection</a></li>";

If a variable is used inside of a string then it shouldn't be modifying the string spacing!

Specify path for project

For our large project (about 7k files in multiple directories) I create small VS Code projects containing only needed directories. Unfortunatelly, Intelephense scans only those small directories when working with small projects.
It would be great, if I could define directory to scan (different from project directory), so Intelephense would provide definitions and symbols from whole project.

Example:
whole projects lays in c:/projects/system
I'm working with directory c:/projects/system/submodule

It would be great, if I could define

"intelephense.scanDir": "c:/projects/system"

in my c:/projects/system/submodule/.vscode/settings.json

to make Intelephense scan whole large project.

Go to Definition for Magic Methods

I know that this may be very difficult to do, so I guess that this is more of a feedback post.

In laravel and other frameworks (and non-frameworks), magic methods are used for certain features, so I would suggest that it could be possible to define a method/property using PHPDoc.

I don't believe that there is a doc comment for this, so I will make one up called: @called in this example.

It would look something like this:

class A extends ClassWithMagic {
    /**
     * @called MyMethod
     */
    public function scopeMyMethod() {}
}

Example of what the extended class might look like:

class ClassWithMagic {
    public function __call($name, $args){
        $func = 'scope' . $name;
        $this->$func($args);
    }
    
    public function __get($name) {
        return $this->$name;
    }
}

Then it could be used something like this:

A::MyMethod();
// or
$a = new A;
$a->MyMethod();
// or
(new $a)->MyMethod();

It would know about the method due to the doc comment.

Function namespaced by default

When using some built-in PHP function eg. array_combine, the extension automatically namespaces it making it

\array_combine()

which is not necessary.

Translations

Sorry, I do not speak english very well. The case is its extension is great but would have like to search the definitions of the commands in php in the portuguese language brazil.
That would help a lot.
I thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.