With that out of the way, let’s take a look at how we can make Visual Studio Code and WordPress play a bit nicer. This creates a *.code-workspace file that you can use to open your Workspace again in the future, and also serves as a config file that will come in handy later. Next, click File -> Save Workspace As to save that Workspace. This is handy for quick edits to the wp-config.php file, and keeping an eye on the debug.log file while I’m developing. That sets up a new Workspace where I can edit the plugin and the WordPress installation at the same time. In Visual Studio Code, I’ll first open the plugin itself, and then I’ll add the WordPress site by selecting File -> Add Folder to Workspace. I’ll then symlink the plugin I’m working on into a fresh WordPress website in the Sites folder. So I’ll have a Projects folder that has all of the plugins I work on, and a Sites folder that contains all of my sites. In my case, the vast majority of my time is spent on plugin development. For example, you may not want to use the WordPress Coding Standards on all of your projects, or maybe you work with a team of developers that can’t agree on tabs vs. I like Workspaces because you can create one of them for each project and change any setting or extension in VS Code at the Workspace level. You can think of a Workspace in VS Code as a container for your project – it not only includes your project, but it can include files that your project relies on (your WordPress installation), and any extensions or settings specific to that project. There is a better way though, with the help of VS Code “Workspaces”. One way to do this might be to open that plugin or theme in your IDE and start coding away. Most of the time when coding in WordPress, you’ll either be working on a plugin or a theme. In this article I’ll review some features of VS Code that I love, and show you how to make the most out of it for WordPress dev. VS Code is a free, open source code editor that is lightweight like Sublime Text, but offers many of the same features as bigger IDEs like PhpStorm or WebStorm. VSCode diffs are a great thing to add to your developer toolbox.If you keep up with the many text editors and developer tools available, you may have heard of Microsoft’s Visual Studio Code. It also helps to remind yourself of the changes you've made from the master version of a file on git once in a while. I hope this helped you! Diffing in VS Code is very useful for quickly seeing changes between two files. Note: you can also edit files from within the diff panels! VS Code is awesome. If you would like to compare your local file changes with the latest git version of a file, click the git icon in the activity bar, then select the file that you would like to compare. Paste this command into the command line with your file names.Įxecuting this command should bring up the diff panel, just like it did from the explorer window. This is convenient if you want to build up muscle memory of typing out the commands into the terminal. Note: you can also CTRL-select both files, right click on one, and select "Compare Selected" to achieve the same thing: You should see the diff panel appear once you've completed these steps: Right click on the second file and "Compare with Selected"ģ. Right click the first file and "Select for Compare"Ģ. This is the quickest, easiest way to bring up the diff panels. There's two primary types of diffs you can do with VS Code.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |