kongondo

Visual Studio Code for ProcessWire Developers

Recommended Posts

Visual Studio Code for PW Devs

This thread is a place for ProcessWire developers who use Visual Studio Code (aka VSC or Code)  to share their experience, tips, frustrations , solutions, code snippets and generally discuss all things VSC.

From Wikipedia:

Quote

Visual Studio Code is a source code editor developed by Microsoft for Windows, Linux and macOS. It includes support for debugging, embedded Git control, syntax highlighting, intelligent code completion, snippets, and code refactoring.

 

  • Like 6

Share this post


Link to post
Share on other sites

Pulled in from another topic:

 

Edited by kongondo
pulled in posts related to VSC

Share this post


Link to post
Share on other sites

thanks for the topic kongondo :)

i'm still missing proper code completion / intellisense support so i would be happy to get some tips in this regard! thanks

  • Like 1

Share this post


Link to post
Share on other sites

@adrian,

Yes, the PHP IntelliSense is not the best. What extension are you using? This PHP IntelliSense one? That's the one I use. I have never had any luck with auto-completion for PW. Seems you are doing better than me. I suppose the reason is that I don't have the wire folder included as a source in my projects. Are you including wire? Maybe with the new-ish Multi-root workspace implementation I should be able to add wire in my projects in order to get to at least where you are. I'll have a play with this and post back.

Whenever I get the time, I will also post tips and tricks I've gathered so far.

 

Edited by kongondo
  • Like 1

Share this post


Link to post
Share on other sites

I use VS Code often, but PHP support is far from good compared to other editors like Sublime Text.

VS Code is great for Javascript though.

 

  • Like 1

Share this post


Link to post
Share on other sites
13 hours ago, kongondo said:

@adrian,

Yes, the PHP IntelliSense is not the best.

 

If it's any consolation, it's not that great in PHPStorm either. I think I will setup a similar forum topic for PHPStorm users to vent their frustrations and workarounds.

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, FrancisChung said:

If it's any consolation, it's not that great in PHPStorm either. I think I will setup a similar forum topic for PHPStorm users to vent their frustrations and workarounds.

You PHP Intellisense for PW isn't great or PHP Intellisense in General because I use it for Symfony and Yii2 and it's superb but a memory hogger. Netbeans still tops it all in terms of speed for me. 

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, Ivan Gretsky said:

This issue is what primarily stops me from using VS Code for php development (and that means "at all").

Ivan, what exactly? HTML IntelliSense? The extensions I use provide HTML auto-completion, tag matching (and changing) and CSS IntelliSense. I'll post my list of extensions later.

  • Like 1

Share this post


Link to post
Share on other sites
27 minutes ago, kongondo said:

Ivan, what exactly? HTML IntelliSense? The extensions I use provide HTML auto-completion, tag matching (and changing) and CSS IntelliSense. I'll post my list of extensions later.

It is html, css and js in php files. IntelliSense (at least out of the box) just does not recognize that it is html context embedded in php PW template, so no autocompletion and stuff. Felix Becker (the creator of php language server, used in VS Code as the base for php IntelliSense) writes about it in the mentioned issue.

I did not find a workaround.

Edit: Actually the main problem is the other way around. PHP includes in html templates/views.

  • Like 1

Share this post


Link to post
Share on other sites

This topic made me check the progress on Atom IDE project. The 1.21 version of atom is finally out of beta, so now one can install it without switching to beta channel. Atom IDE uses the same Felix Becker's language server, and has language contexts figured out, as far as I know. While at it upgraded my Windows Atom to x64 version (startup appeared to be a little faster, but maybe I'm just dreaming). Jump to class definition works. Auto-completion works, Outline view is present.

Somehow I consider Atom to be more open source and open in general than VS Code. So will try stick to it for now. VS Code starts up a bit faster, but they have near feature parity now. Good competition is good!

Share this post


Link to post
Share on other sites
2 hours ago, Ivan Gretsky said:

Felix Becker (the creator of php language server, used in VS Code as the base for php IntelliSense) writes about it in the mentioned issue.

Hmm. Felix is the author and maintainer of the PHP IntelliSense extension I referred to. I do not use the VSC code in-built one.

 

52 minutes ago, Ivan Gretsky said:

Jump to class definition works. Auto-completion works

Works for me too in VSC.

IntelliSense

I have noticed that if I do this:

$animals = new Animals();
$traits = $animals->getTraits();

PHP IntelliSense works fine. However, if I do this...

public $animals
$this->animals = new Animals();
$traits = $this->animals->getTraits();

It doesn't work...I have been meaning to file a 'bug' report.

I've tried the other IntelliSense but they don't work as well as Felix's. 

Edited by kongondo
  • Like 1

Share this post


Link to post
Share on other sites
25 minutes ago, fbg13 said:

You don't need an extension, just add vscode://file/%file:%line to tracy.

thx, didn't know that - a search led me to the plugin i mentioned above...

Share this post


Link to post
Share on other sites

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By FrancisChung
      PHPStorm for PW Devs
      This thread is a place for ProcessWire developers who use PHPStorm to share their experience, tips, frustrations, solutions, code snippets and generally discuss all things PHPStorm.
      From Wikipedia:
       
      Thanks @kongondo for the Visual Studio Code post earlier.
    • By szabesz
      CodeRunner 2 is on sale at MacUpdate: https://www.macupdate.com/app/mac/38362/coderunner
      Mostly I use it for writing shell scripts, mocking up algorithms in PHP, JavaScript/jQuery. But is also supports other programming languages as well.
      https://coderunnerapp.com/
      "An advanced, highly flexible, and easy-to-use programming editor for your Mac. CodeRunner supports a large number of languages, and delivers big IDE features while remaining lightweight and clutter-free."
    • By pwFoo
      I moved from netbeans to atom. Tested lighttable, brackets and visual studio code, but at the moment I take a look into web based IDEs. Most are based on ACE editor (alternative could be codemirror) like chrome apps caret or super neutron drive (both with chrome dependency at the moment). 
      Recently I looked into cloud9, codetasty, ... and codiad.
      Codiad is open source. php / js based and works fine. Autocomplete feature and suggestions should be improved, but it's ok. Because it's open source you can download it from github repo or test it as a docker container (wernight/codiad image for example). 
      Codytasty is a cloud hosted solution with a really awesome autocomplete / suggestions for php, js and html! But it isn't open source (there is a free to use hosted version with limited workspaces and features).
      At the moment I testing codiad@docker, but use still atom for coding and searching for the best IDE out there *g*
       
      What do you think about IDEs and the new trend to web based IDEs?
    • By benbyf
      HELLO! Anyone happen to be using Atom the open source IDE from github? I've been using it for about a year now and other than the occassional crash it's been great.
      I was wondering if anyone out there has proccesswire specific snippets, syntax hightlighting or autocomplete package they've created to add their PW work? If not would anyone be interested if I made one, and what would be most useful?