kongondo Posted October 23, 2017 Share Posted October 23, 2017 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. Expand 8 Link to comment Share on other sites More sharing options...
kongondo Posted October 23, 2017 Author Share Posted October 23, 2017 (edited) Pulled in from another topic: Edited October 23, 2017 by kongondo pulled in posts related to VSC Link to comment Share on other sites More sharing options...
bernhard Posted October 23, 2017 Share Posted October 23, 2017 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 1 Link to comment Share on other sites More sharing options...
kongondo Posted October 23, 2017 Author Share Posted October 23, 2017 (edited) @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 October 23, 2017 by kongondo 1 Link to comment Share on other sites More sharing options...
clsource Posted October 23, 2017 Share Posted October 23, 2017 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. 1 Link to comment Share on other sites More sharing options...
FrancisChung Posted October 24, 2017 Share Posted October 24, 2017 On 10/23/2017 at 4:54 PM, kongondo said: @adrian, Yes, the PHP IntelliSense is not the best. Expand 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. 2 Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted October 24, 2017 Share Posted October 24, 2017 This issue is what primarily stops me from using VS Code for php development (and that means "at all"). 2 Link to comment Share on other sites More sharing options...
qtguru Posted October 24, 2017 Share Posted October 24, 2017 On 10/24/2017 at 6:07 AM, 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. Expand 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. 1 Link to comment Share on other sites More sharing options...
kongondo Posted October 24, 2017 Author Share Posted October 24, 2017 On 10/24/2017 at 7:59 AM, Ivan Gretsky said: This issue is what primarily stops me from using VS Code for php development (and that means "at all"). Expand 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. 1 Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted October 24, 2017 Share Posted October 24, 2017 On 10/24/2017 at 10:01 AM, 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. Expand 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. 1 Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted October 24, 2017 Share Posted October 24, 2017 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! Link to comment Share on other sites More sharing options...
kongondo Posted October 24, 2017 Author Share Posted October 24, 2017 (edited) On 10/24/2017 at 10:14 AM, 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. Expand 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. On 10/24/2017 at 11:51 AM, Ivan Gretsky said: Jump to class definition works. Auto-completion works Expand 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 October 24, 2017 by kongondo 1 Link to comment Share on other sites More sharing options...
bernhard Posted November 9, 2017 Share Posted November 9, 2017 if you want to register urls to open directly in vscode you can use this plugin and follow the instructions: https://github.com/shengyou/vscode-handler then fill in the 2 fields in tracy (url + local path) and you can directly click on links and they will open up in vscode 1 Link to comment Share on other sites More sharing options...
fbg13 Posted November 9, 2017 Share Posted November 9, 2017 You don't need an extension, just add vscode://file/%file:%line to tracy. https://code.visualstudio.com/docs/editor/command-line#_opening-vs-code-with-urls 3 Link to comment Share on other sites More sharing options...
bernhard Posted November 9, 2017 Share Posted November 9, 2017 On 11/9/2017 at 8:37 AM, fbg13 said: You don't need an extension, just add vscode://file/%file:%line to tracy. Expand thx, didn't know that - a search led me to the plugin i mentioned above... Link to comment Share on other sites More sharing options...
bernhard Posted December 13, 2017 Share Posted December 13, 2017 not related to processwire but may be of interest anyhow: 3 Link to comment Share on other sites More sharing options...
elabx Posted December 14, 2017 Share Posted December 14, 2017 Does anyone know if you can edit a remote location ftp/ssh, and navigate it as a file system?? In my emacs setup this is so straightforward but I never found a way to do this in VS Code. Link to comment Share on other sites More sharing options...
kongondo Posted December 14, 2017 Author Share Posted December 14, 2017 On 12/14/2017 at 3:21 PM, elabx said: Does anyone know if you can edit a remote location ftp/ssh, and navigate it as a file system?? In my emacs setup this is so straightforward but I never found a way to do this in VS Code. Expand https://codepen.io/ginfuru/post/remote-editing-files-with-ssh https://marketplace.visualstudio.com/items?itemName=rafaelmaiolla.remote-vscode Nothing here in the Marketplace? Link to comment Share on other sites More sharing options...
elabx Posted December 14, 2017 Share Posted December 14, 2017 That just feels a bit too impractical, because they involve ssh tunneling and open a single file, out of the vscode interface. I think I found what I'm looking for but it's not released yet: https://code.visualstudio.com/updates/v1_17#_preview-remote-file-system-api This let's you navigate the remote server as if it was local. 1 Link to comment Share on other sites More sharing options...
kongondo Posted December 14, 2017 Author Share Posted December 14, 2017 On 12/14/2017 at 5:13 PM, elabx said: https://code.visualstudio.com/updates/v1_17#_preview-remote-file-system-api This let's you navigate the remote server as if it was local. Expand Nice one! So, it should be here next year..I suppose. Link to comment Share on other sites More sharing options...
bernhard Posted December 14, 2017 Share Posted December 14, 2017 I'm using this one: https://marketplace.visualstudio.com/items?itemName=lukasz-wronski.ftp-sync I'm not 100% happy but it works most of the time. Searching through all files only works when you have all files on your computer. This ftp sync sucks for that part. I always zip everything and download it... much faster most of the time. Maybe the new duplicator module could help here... Another thing that I do is browsing the server over ssh via winscp and then just doubleclick the file. This opens the file on VSCode and on save uploads the new version. 1 Link to comment Share on other sites More sharing options...
SamC Posted December 15, 2017 Share Posted December 15, 2017 Just started using vscode yesterday, been using ST3 for a number of years. I tried atom but it was just so slow I couldn't cope with it. Lots of nice tips here thanks. Link to comment Share on other sites More sharing options...
bernhard Posted December 29, 2017 Share Posted December 29, 2017 really nice feature introduced in november: live share (great way of collaborating with others!) https://code.visualstudio.com/blogs/2017/11/15/live-share ps: i don't want to abuse this thread for interesting stuff about vscode that is not related to processwire if that is not wanted...? Link to comment Share on other sites More sharing options...
kongondo Posted December 29, 2017 Author Share Posted December 29, 2017 On 12/29/2017 at 2:16 PM, bernhard said: ps: i don't want to abuse this thread for interesting stuff about vscode that is not related to processwire if that is not wanted...? Expand This is dev talk, so why not....? You are good. Quote Dev Talk A place for general development and coding discussions. Expand Link to comment Share on other sites More sharing options...
Peter Knight Posted January 17, 2018 Share Posted January 17, 2018 @bernhard Thanks for the VSCode mention on the roadmap thread. It's certainly more visual than the terminal. I'd also like to highlight Tower for Git for designers looking to approach GIT via a more visual UI. 1 Link to comment Share on other sites More sharing options...
Recommended Posts