Code Monkey home page Code Monkey logo

symfony-vscode's Introduction

Symfony for VSCode

This extension aims to help developing Symfony2+ projects, by providing basic autocompletion and visualization of the Symfony container.

Autocomplete

Features

This extension provides the following features :

  • Autocompletion in YML and XML files of services and parameters
  • Hover details on services and parameters name
  • Go to implementation of a service
  • A custom view to visualize the current project container, with services, routes and parameters

Debug view

How does it works ?

To detect Symfony projects, this extension rely on composer.json files with symfony/symfony as one of its dependencies.

The composer.json file is supposed to be at the root of your Symfony project.

When the project is detected, it simply uses the debug:container and debug:router console commands to hydrate the views and autocompletions.

Extension settings

Here are the settings that can be overridden for convenience :

  • phpExecutablePath: Path to the PHP executable. This path is ignored if the shellExecutable parameter is different than false (default value : /usr/bin/php).
  • shellExecutable: The shell executable path. If differant that false, console commands will be called via shell instead of just calling the PHP executable. Useful for particular setup, such as Dockerized projects (default value : false).
  • shellCommand: The shell command. Only used when calling the shell to do console commands. Useful for particular setup, such as Dockerized projects (default value : false).
  • consolePath: Path to the Symfony console, relative to the root directeory. If null, the extension try to guess the path with the Symfony version from the composer.json file (default value : null).
  • showConsoleErrors: If false, the extension doesn't show error messages caused by compilation errors (default value : true).
  • enableFileWatching: If false, the extension refresh automatically when a YAML file is modified (default value : true).
  • fileWatchingPatterns: Files with one of these extensions will trigger a container refresh on save. By default, watches only *.yml and *.xml files.
  • servicesFilters, routesFilters and parametersFilters : Filters out container elements. Filtered elements doesn't show in the Symfony view, nor does they appear in autocompletion.

Various environments

If your Symfony app is not running on a conventional installation (for example, you are running a Symfony app on a Docker container), you can find different configuration recipes here.

Contribution

If you want to contribute to this extension, everything you want to know is here.

Release Notes

See the changelog for releases notes.

Acknowledgments

Icons from www.flaticon.com, by :

symfony-vscode's People

Contributors

axel-veber-beclood avatar axelveber avatar thenouillet avatar

Stargazers

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

Watchers

 avatar

symfony-vscode's Issues

Container view is empty

Symfony 3.4.14

Settings:

"symfony-vscode.phpExecutablePath": "/usr/local/opt/[email protected]/bin/php",
    "symfony-vscode.enableFileWatching": true,
    "symfony-vscode.consolePath": "app/console",
    "symfony-vscode.showConsoleErrors": true,
    "symfony-vscode.fileWatchingPatterns": [
        "yml",
        "yaml",
        "xml"
    ],

vendor php code lives in vendor/php instead of vendor.

app/console debug:container works in terminal. So does other debug commands.

Container view is empty. There is no console errors.

Would you be able to add some debug logs as to what this plugin is doing? If it's just running app/console debug:container to get the list of services available in symfony, technically this should work.

However, I am getting an empty container/parameter/route view on the side bar and the autocomplete does not work.

Would be good if you could shared some light as to how this is to be configured to get the best output.

Thanks.

Error parsing XmlFileLoader.php

Hello,

I can't figure out why i'm getting this error:

In XmlFileLoader.php line 386: Unable to parse file "\192.168.56.102\PROJECTS\neopiv2\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle/R esources/config\web.xml": [WARNING 1549] failed to load external entity "file://///192.168.56.102/PROJECTS/neopiv2/ vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd" (in n /a - line 0, column 0) [WARNING 3084] Element '{http://www.w3.org/2001/XMLSchema}import': Failed to locate a schema at location 'file://// /192.168.56.102/PROJECTS/neopiv2/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/schema/dic /services/services-1.0.xsd'. Skipping the import. (in in_memory_buffer - line 8, column 0) ...

My environment is as follows:
Application running on server debia 9, nginx, php7.3 and vscode is running on windows machine (access server with samba).
My setting.json has "symfony-vscode.phpExecutablePath": "C:\PHP7\php.exe",

Any ideas ?

Support VS Code Workspaces

Is it possible to support workspaces? Some features works, like autocompletion in YML files, but others no, like container view that show entries of one project only.

Be able to define the root path

Hi,

I want to know if it's possible to define the root symfony project path ?
For example I have my symfony application in : apps/symfony.

Thank you

Symfony 4 - refresh services definitions

Hello,
Thank you for this plugin . I got this error when i refresh services definitions

PHP Fatal error: Cannot use Riak\Object as Object because 'Object' is a special class name in .../vendor/doctrine/cache/lib/Doctrine/Common/Cache/RiakCache.php on line 8
12:44:35 CRITICAL [php] Fatal Compile Error: Cannot use Riak\Object as Object because 'Object' is a special class name ["exception" => Symfony\Component\Debug\Exception\FatalErrorException { …}]

In RiakCache.php line 8:

Compile Error: Cannot use Riak\Object as Object because 'Object' is a speci
al class name

debug:container [--show-private] [--show-arguments] [--show-hidden] [--tag TAG] [--tags] [--parameter PARAMETER] [--parameters] [--types] [--format FORMAT] [--raw] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] []

Add icons on views

Goals : discriminate services and aliases, why not routes of different methods (too much cluttering ?)...

"Go to implementation of a service" function not working

When I press Ctrl and left mouse click on service function call, it does not open the implementation of a function. And it does not open service class when I press Ctrl + left mouse click on service ID.
Symfony version: 2.8

the plugin does not initiate

the plugin does not work.

It stays stucked on "Symfony is reading".

I have used :
"symfony-vscode.phpPath": "C:/wamp/bin/php/php7.1.26/"

Any idea why ?

The "--show-private" option does not exist.

I'm always getting the following error upon startup of VSCode:

The "--show-private" option does not exist.  
                                               

debug:container [--show-arguments] [--show-hidden] [--tag TAG] [--tags] [--parameter PARAMETER] [--parameters] [--types] [--env-var ENV-VAR] [--env-vars] [--format FORMAT] [--raw] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> [<name>]

Doesn't matter if workspace within symfony project or not.

Get php executable path from "php.validate.executablePath"

Rather a proposal than an issue. I have configured the path to php executable with "php.validate.executablePath" in settings, but extension need to get it from it's own "symfony-vscode.phpExecutablePath".
Is there is any reason not to look for the first option before looking for own settings?

Verify services which are displayed

Todo : Decide when a service in visible in the TreeView, when it's visible in YAML autocomplete and when its visible in PHP autocomplete.

Goal : Provide user with pertinent infos to avoid misleadings.

The "--show-private" option does not exist.

Hello,

I have this message when i launch my project Symfony :

The "--show-private" option does not exist.  

debug:container [--show-arguments] [--show-hidden] [--tag TAG] [--tags] [--parameter PARAMETER] [--parameters] [--types] [--env-var ENV-VAR] [--env-vars] [--format FORMAT] [--raw] [--deprecations] [--] [<name>]

Versions

VS Code : 1.53.2
Symfony 5.2.x
Symfony for VSCode : 1.0.2

How to fix this message please ?

does not work on windows 7

hello,

i get this message on start up of vscode when the extension is active :

spawn /usr/bin/php ENOENT

Investigate on .phpstorm.meta

Related links :

This is a continuation of what has been discussed in #18.
The goal is to provide autocompletion of the Symfony container, juste like the Symfony PHPStorm plugin.
Discussions revolved around a "stub" which maps services Ids to container aware methods.
This is something that is (too ?) dependent of a PHP language extension. If a stub like this can be parsed by a PHP extension, then the Symfony extension have to implement a feature to generate such a stub.

php error on init

I've got this on init as an error

PHP Fatal error:  Cannot use Riak\Object as Object because 'Object' is a special class name in /home/avior/Git/stm/vendor/doctrine/cache/lib/Doctrine/Common/Cache/RiakCache.php on line 8
10:24:39 CRITICAL  [php] Fatal Compile Error: Cannot use Riak\Object as Object because 'Object' is a special class name ["exception" => Symfony\Component\Debug\Exception\FatalErrorException { …}]

In RiakCache.php line 8:
                                                                               
  Compile Error: Cannot use Riak\Object as Object because 'Object' is a speci  
  al class name                                                                
                                                                               

debug:container [--show-private] [--show-arguments] [--show-hidden] [--tag TAG] [--tags] [--parameter PARAMETER] [--parameters] [--types] [--format FORMAT] [--raw] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> [<name>]


more exactly i can repeat it by refreshing the service definition view

Add class path prefix

In the composer.json there is an autoload config that makes it look like all classes have their root in the root folder when it actually is in src/ folder. This disables the jumping to the classes from the view.
Either read such configs from the composer.json or add an option to add a prefix for class file resolution please.

Go to route action

Goal : I see a route on the Tree view -> I want to go to the corresponding controller action

Please publish the extension to OpenVSX

I'm a VS Codium user, a FLOSS version of VS Code. It's the same code but without Microsoft's telemetry, branding and licensing.

I would like to request, if possible, to add the Symfony for VSCode extension to the open-vsx.org market as it is unclear if it's legal to use the official Microsoft extension marketplace on VS Code forks, see here.

Additional information on how to publish an extension to Open VSX can be obtained here.

Go to Twig template

Goal : go from a configuration file or PHP file to a Twig template
Note : parse ide-twig.json for custom template namespaces

Can't go to all references for a function inside service

Hello,

When i access to option "Find All References" throught right click on a function inside a service, the indexer doesn't go to references except if the service is typed, example below :

/** @var DocAccordService $docAccordService */
$docAccordService = $this->get('app.doc_accord_service');

On PHPStorm it works even it's not typed.

Thank you

Can't work with "Remote - Containers extension"

Thanks for developing this extention!

But can't work with "Remote - Containers extension"

Error message

[2019-10-14 17:13:43.676] [exthost] [error] [TheNouillet.symfony-vscode] provider FAILED
[2019-10-14 17:13:43.676] [exthost] [error] TypeError: Cannot read property 'find' of undefined
	at ServiceDocumentationCodeActionProvider.provideCodeActions (/root/.vscode-server/extensions/thenouillet.symfony-vscode-1.0.2/out/mvc/editing/codeaction/ServiceDocumentationCodeActionProvider.js:20:70)
	at o.asPromise (/root/.vscode-server/bin/88f15d17dca836346e787762685a40bb5cce75a8/out/vs/server/remoteExtensionHostProcess.js:571:465)
	at Promise (/root/.vscode-server/bin/88f15d17dca836346e787762685a40bb5cce75a8/out/vs/server/remoteExtensionHostProcess.js:55:649)
	at new Promise (<anonymous>)
	at Object.t.asPromise (/root/.vscode-server/bin/88f15d17dca836346e787762685a40bb5cce75a8/out/vs/server/remoteExtensionHostProcess.js:55:621)
	at C.provideCodeActions (/root/.vscode-server/bin/88f15d17dca836346e787762685a40bb5cce75a8/out/vs/server/remoteExtensionHostProcess.js:571:436)
	at _withAdapter.e (/root/.vscode-server/bin/88f15d17dca836346e787762685a40bb5cce75a8/out/vs/server/remoteExtensionHostProcess.js:587:817)
	at H._withAdapter (/root/.vscode-server/bin/88f15d17dca836346e787762685a40bb5cce75a8/out/vs/server/remoteExtensionHostProcess.js:583:593)
	at H.$provideCodeActions (/root/.vscode-server/bin/88f15d17dca836346e787762685a40bb5cce75a8/out/vs/server/remoteExtensionHostProcess.js:587:795)
	at p._doInvokeHandler (/root/.vscode-server/bin/88f15d17dca836346e787762685a40bb5cce75a8/out/vs/server/remoteExtensionHostProcess.js:652:275)
	at p._invokeHandler (/root/.vscode-server/bin/88f15d17dca836346e787762685a40bb5cce75a8/out/vs/server/remoteExtensionHostProcess.js:651:971)
	at p._receiveRequest (/root/.vscode-server/bin/88f15d17dca836346e787762685a40bb5cce75a8/out/vs/server/remoteExtensionHostProcess.js:650:588)
	at p._receiveOneMessage (/root/.vscode-server/bin/88f15d17dca836346e787762685a40bb5cce75a8/out/vs/server/remoteExtensionHostProcess.js:649:468)
	at _protocol.onMessage.e (/root/.vscode-server/bin/88f15d17dca836346e787762685a40bb5cce75a8/out/vs/server/remoteExtensionHostProcess.js:647:691)
	at l.fire (/root/.vscode-server/bin/88f15d17dca836346e787762685a40bb5cce75a8/out/vs/server/remoteExtensionHostProcess.js:50:519)
	at _.fire (/root/.vscode-server/bin/88f15d17dca836346e787762685a40bb5cce75a8/out/vs/server/remoteExtensionHostProcess.js:181:274)
	at e.onMessage.e (/root/.vscode-server/bin/88f15d17dca836346e787762685a40bb5cce75a8/out/vs/server/remoteExtensionHostProcess.js:804:104)
	at l.fire (/root/.vscode-server/bin/88f15d17dca836346e787762685a40bb5cce75a8/out/vs/server/remoteExtensionHostProcess.js:50:519)
	at _.fire (/root/.vscode-server/bin/88f15d17dca836346e787762685a40bb5cce75a8/out/vs/server/remoteExtensionHostProcess.js:181:274)
	at t.PersistentProtocol._receiveMessage (/root/.vscode-server/bin/88f15d17dca836346e787762685a40bb5cce75a8/out/vs/server/remoteExtensionHostProcess.js:185:629)
	at _socketDisposables.push._socketReader.onMessage.e (/root/.vscode-server/bin/88f15d17dca836346e787762685a40bb5cce75a8/out/vs/server/remoteExtensionHostProcess.js:182:824)
	at l.fire (/root/.vscode-server/bin/88f15d17dca836346e787762685a40bb5cce75a8/out/vs/server/remoteExtensionHostProcess.js:50:519)
	at p.acceptChunk (/root/.vscode-server/bin/88f15d17dca836346e787762685a40bb5cce75a8/out/vs/server/remoteExtensionHostProcess.js:178:588)
	at _register._socket.onData.e (/root/.vscode-server/bin/88f15d17dca836346e787762685a40bb5cce75a8/out/vs/server/remoteExtensionHostProcess.js:177:958)
	at Socket.t (/root/.vscode-server/bin/88f15d17dca836346e787762685a40bb5cce75a8/out/vs/server/remoteExtensionHostProcess.js:187:68)
	at Socket.emit (events.js:182:13)
	at addChunk (_stream_readable.js:283:12)
	at readableAddChunk (_stream_readable.js:264:11)
	at Socket.Readable.push (_stream_readable.js:219:10)
	at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)

Do you have any solutions?

No composer.json file wih Symfony as dependency detected

No composer.json file wih Symfony as dependency detected

What is "Symfony" as a dependency? Is this looking for the framework lib, or what? We use the Symfony container service (DI) lib, which is primarily the purpose of this plugin, no? How can I tell this plugin where the config.yml is and let it work from there?

PHP 7.2 Uncaught ReflectionException: Class CacheInterface not found

Hello. I create skeleton project on local machine and get this error:

PHP Fatal error: During class fetch: Uncaught ReflectionException: Class Psr\SimpleCache\CacheInterface not found in /home/default/projects/symf_test/vendor/symfony/cache/Psr16Cache.php:27 Stack trace: #0 /home/default/projects/symf_test/vendor/symfony/debug/DebugClassLoader.php(160): require('/home/default/p...') #1 [internal function]: Symfony\Component\Debug\DebugClassLoader->loadClass('Symfony\\Compone...') #2 [internal function]: spl_autoload_call('Symfony\\Compone...') #3 /home/default/projects/symf_test/vendor/symfony/config/Resource/ClassExistenceResource.php(78): class_exists('Symfony\\Compone...') #4 /home/default/projects/symf_test/vendor/symfony/framework-bundle/Console/Descriptor/Descriptor.php(307): Symfony\Component\Config\Resource\ClassExistenceResource->isFresh(0) #5 /home/default/projects/symf_test/vendor/symfony/framework-bundle/Console/Descriptor/JsonDescriptor.php(239): Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor::getClassDescription('Symfony\\Compone...') #6 /home/default/projects/symf_t in /home/default/projects/symf_test/vendor/symfony/cache/Psr16Cache.php on line 27 2019-07-15T11:52:21+08:00 [critical] Fatal Error: During class fetch: Uncaught ReflectionException: Class Psr\SimpleCache\CacheInterface not found in /home/default/projects/symf_test/vendor/symfony/cache/Psr16Cache.php:27 Stack trace: #0 /home/default/projects/symf_test/vendor/symfony/debug/DebugClassLoader.php(160): require('/home/default/p...') #1 [internal function]: Symfony\Component\Debug\DebugClassLoader->loadClass('Symfony\\Compone...') #2 [internal function]: spl_autoload_call('Symfony\\Compone...') #3 /home/default/projects/symf_test/vendor/symfony/config/Resource/ClassExistenceResource.php(78): class_exists('Symfony\\Compone...') #4 /home/default/projects/symf_test/vendor/symfony/framework-bundle/Console/Descriptor/Descriptor.php(307): Symfony\Component\Config\Resource\ClassExistenceResource->isFresh(0) #5 /home/default/projects/symf_test/vendor/symfony/framework-bundle/Console/Descriptor/JsonDescriptor.php(239): Symfony\Bundle\FrameworkBundle\Console\Descriptor\Descriptor::getClassDescription('Symfony\\Compone...') #6 /home/default/projects/symf_t

what should I do here ?

Autocomplete is broken

After installing plugin I get Symfony Container View tab, and in that tab I can see list of services, but when I type service name in $this->get(' autocomplete is not working (could be macOS related)

How do I debug it?

Not Work In windows

Hello,
I use this tool in windows 10, but it looks like not work at all. I have set the path of php according to the document.

I try to refresh the view but get nothing.
image

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.