This guide covers setting up Visual Studio Code for Nextcloud development.
Note
VS Code is one of several IDEs you can use for Nextcloud development. Other popular choices include PhpStorm and Vim.
The Nextcloud documentation and server repositories include VS Code DevContainer configurations for a consistent development environment.
- Install Docker Desktop
- Install the Dev Containers extension in VS Code
- Open the repository folder in VS Code
- When prompted, click "Reopen in Container" or use the command palette (
F1) and select Dev Containers: Reopen in Container
The DevContainer will automatically:
- Set up the required runtime environment
- Install necessary dependencies
- Configure recommended VS Code extensions
You can also use GitHub Codespaces for cloud-based development:
- Navigate to the repository on GitHub
- Click the green "Code" button
- Select the "Codespaces" tab
- Click "Create codespace on main"
For more details, see the VS Code DevContainers documentation.
For Nextcloud server and app development:
- PHP Intelephense - PHP code intelligence
- PHP Debug - Xdebug debugging support
- PHP DocBlocker - DocBlock generation
- PHPStan - Static analysis
For frontend development:
- ESLint - JavaScript linting
- Vue - Official - Vue.js language support
- Prettier - Code formatting
For working with Nextcloud documentation:
- reStructuredText - RST language support
- PDF Viewer - Preview PDF files
These extensions report errors and warnings directly in VS Code's Problems panel (Ctrl+Shift+M):
PHP:
- PHP Intelephense - Syntax errors, undefined variables, type mismatches
- PHPStan - Static analysis errors
- PHP CS Fixer - Code style violations
JavaScript/TypeScript:
- ESLint - Linting errors and warnings
- TypeScript - Type checking errors
- Error Lens - Shows errors inline in the editor
PowerShell (for Windows scripts):
- PowerShell - Includes PSScriptAnalyzer for linting
General:
- Error Lens - Highlights errors/warnings inline
- Problems Tab Highlighter - Enhanced problem highlighting
Create a .vscode/settings.json file in your project with recommended settings:
{
"php.validate.executablePath": "/usr/bin/php",
"intelephense.environment.phpVersion": "8.1",
"editor.formatOnSave": true,
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true
}To set up PHP debugging:
- Install the PHP Debug extension
- Configure Xdebug in your PHP installation
- Create a
.vscode/launch.jsonfile:
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/var/www/html": "${workspaceFolder}"
}
}
]
}- Set breakpoints in your code
- Start the debugger with
F5
For more information on Xdebug configuration, see the Xdebug documentation.
- :ref:`devenv` - Development environment setup without Docker
- VS Code DevContainers - Official documentation
- Nextcloud development tutorial - Docker-based setup tutorial