Skip to content

Instantly share code, notes, and snippets.

@philsherry
Last active November 17, 2024 16:56
Show Gist options
  • Select an option

  • Save philsherry/74c6491fa425562dbb246a4688ba4133 to your computer and use it in GitHub Desktop.

Select an option

Save philsherry/74c6491fa425562dbb246a4688ba4133 to your computer and use it in GitHub Desktop.
VS Code Workspace file.

Workspace

There is a VS Code Workspace file which ties these repos together when they’re sat in the same directory like this:

 project
 ├── project-wp-docker/
 ├── project-wp-docs/
 ├── project-wp-theme/
 └── project-wp.code-workspace

Extensions

A list of recommended extentions to get the most of this workspace and commit good code.
Run these from in the Workspace Recommendations section of the Extensions sidebar.

Launch

A set of debug configurations to help debug your code with the help of various browsers and tools.
Run these from in the Debug sidebar.

Settings

  • Linting rules for JS and SCSS.
  • PHP CodeSniffer: phpcs && phpcbf.
  • WordPress Standards.

Tasks

These are mostly repetitive tasks with laborious key commands to remember.
Run these from the Command Palette. cmd+p task sbt will show you the available options.

  • docker destroy
  • docker ssh
  • docker start
  • docker status (opens on startup: terminal pane 1)
  • docker stop
  • docker up
  • git status (opens on startup: terminal pane 2)
  • markdownlint
  • phpcbf
  • phpcs
  • pre-commit autoupdate
  • pre-commit clean
  • pre-commit install (opens on startup: terminal pane 3)
  • pre-commit run
{
/**
* This bundles all of the Eye Fund repos together into a single VS Code
* Workspace.
*
* https://code.visualstudio.com/docs/editor/multi-root-workspaces
* https://code.visualstudio.com/docs/editor/variables-reference
**/
"extensions": {
/**
* Workspace recommended extensions
* Add these from the Extensions panel with the `@recommended` filter on.
*
* https://code.visualstudio.com/docs/editor/extension-marketplace#_workspace-recommended-extensions
**/
"recommendations": [
"bierner.github-markdown-preview",
"bierner.markdown-checkbox",
"bierner.markdown-emoji",
"bierner.markdown-preview-github-styles",
"bierner.markdown-prism",
"bierner.markdown-yaml-preamble",
"davidanson.vscode-markdownlint",
"dbaeumer.vscode-eslint",
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
"firefox-devtools.vscode-firefox-debug",
"hilleer.yaml-plus-json",
"jebbs.markdown-extended",
"jpagano.wordpress-vscode-extensionpack",
"ms-azuretools.vscode-docker",
"ms-edgedevtools.vscode-edge-devtools",
"msjsdiag.debugger-for-chrome",
"msjsdiag.debugger-for-edge",
"persoderlind.vscode-phpcbf",
"raashida.fixthecode-vs",
"rifi2k.format-html-in-php",
"rvest.vs-code-prettier-eslint",
"shardulm94.trailing-spaces",
"stylelint.vscode-stylelint",
"vscode-icons-team.vscode-icons"
]
},
"folders": [
{
"path": "./eyefund-wp-docker"
},
{
"path": "./eyefund-wp-docs"
},
{
"path": "./eyefund-wp-theme"
}
],
"launch": {
/**
* Debugging
* Lots of options here.
*
* https://code.visualstudio.com/docs/editor/debugging
**/
"configurations": [
{
"name": "Chrome: Attach",
"port": 9222,
"request": "attach",
"type": "pwa-chrome",
"webRoot": "${workspaceFolder:eyefund-wp-theme}"
},
{
"name": "Chrome: Launch",
"request": "launch",
"type": "pwa-chrome",
"url": "http://eyefund.localhost:8000",
"webRoot": "${workspaceFolder:eyefund-wp-theme}"
},
{
"name": "Microsoft Edge: Attach",
"port": 9222,
"request": "attach",
"type": "pwa-msedge",
"webRoot": "${workspaceFolder:eyefund-wp-theme}"
},
{
"name": "Microsoft Edge: Launch",
"request": "launch",
"type": "pwa-msedge",
"url": "http://eyefund.localhost:8000",
"webRoot": "${workspaceFolder:eyefund-wp-theme}"
},
{
"name": "Microsoft Edge: Attach and open the Edge DevTools",
"request": "attach",
"type": "vscode-edge-devtools.debug",
"url": "http://eyefund.localhost:8000",
"webRoot": "${workspaceFolder:eyefund-wp-theme}"
},
{
"name": "Microsoft Edge: Launch and open the Edge DevTools",
"request": "launch",
"type": "vscode-edge-devtools.debug",
"url": "http://eyefund.localhost:8000",
"webRoot": "${workspaceFolder:eyefund-wp-theme}"
},
{
"file": "${workspaceFolder:eyefund-wp-theme}/index.html",
"name": "Mozilla Firefox: Launch index.html",
"reAttach": true,
"request": "launch",
"type": "firefox"
},
{
"name": "Mozilla Firefox: Launch localhost",
"reAttach": true,
"request": "launch",
"type": "firefox",
"url": "http://eyefund.localhost:8000",
"webRoot": "${workspaceFolder:eyefund-wp-theme}"
},
{
"name": "Node.js: Attach",
"port": 9229,
"request": "attach",
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node"
},
{
"name": "Node.js: Launch Program",
"program": "${file}",
"request": "launch",
"serverReadyAction": {
"action": "openExternally",
"pattern": "listening on port ([0-9]+)",
"uriFormat": "http://localhost:%s"
},
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node"
},
{
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"name": "Node.js: nodemon",
"program": "${workspaceFolder:eyefund-wp-theme}/app.js",
"request": "launch",
"restart": true,
"runtimeExecutable": "nodemon",
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node"
}
],
"version": "0.2.0"
},
"settings": {
"[javascript]": {
"editor.detectIndentation": false,
"editor.insertSpaces": true,
"editor.useTabStops": false
},
"[php]": {
"editor.detectIndentation": true,
"editor.insertSpaces": false,
"editor.useTabStops": true
},
"css.validate": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.fixAll.markdownlint": true,
"source.fixAll.sortJSON": true
},
"editor.detectIndentation": false,
"editor.fontFamily": "'Fira Code', 'Operator Mono', Menlo, Monaco, 'Courier New', monospace",
"editor.fontLigatures": true,
"editor.fontSize": 18,
"editor.fontWeight": "400",
"editor.formatOnPaste": true,
"editor.lineHeight": 25,
"editor.linkedEditing": true,
"editor.multiCursorModifier": "alt",
"editor.renderWhitespace": "all",
"editor.rulers": [
70,
80
],
"editor.scrollBeyondLastLine": true,
"editor.showFoldingControls": "always",
"editor.snippetSuggestions": "top",
"editor.suggestSelection": "first",
"editor.tabSize": 2,
"editor.wordWrap": "bounded",
"files.autoSave": "onFocusChange",
"files.defaultLanguage": "markdown",
"javascript.validate.enable": false,
"markdownlint.config": {
"MD003": {
"style": "atx"
},
"MD013": false,
"MD024": {
"siblings_only": true
},
"MD029": false,
"MD031": false,
"MD032": false,
"MD033": {
"allowed_elements": [
"a",
"abbr",
"caption",
"cite",
"code",
"del",
"figcaption",
"figure",
"img",
"kbd",
"mark",
"table",
"tbody",
"td",
"tfoot",
"th",
"thead",
"tr"
]
},
"MD041": false,
"default": true
},
"phpcbf.documentFormattingProvider": true,
"phpcbf.enable": true,
"phpcbf.executablePath": "${workspaceFolder:eyefund-wp-theme}/vendor/squizlabs/php_codesniffer/bin/phpcbf",
"phpcbf.onsave": false,
"phpcbf.standard": "WordPress-Core",
"phpcs.autoConfigSearch": true,
"phpcs.composerJsonPath": "${workspaceFolder:eyefund-wp-theme}/composer.json",
"phpcs.enable": true,
"phpcs.executablePath": "${workspaceFolder:eyefund-wp-theme}/vendor/squizlabs/php_codesniffer/bin/phpcs",
"phpcs.standard": "WordPress-Core",
"phpformatter.arguments": [
"--custom-config=${workspaceFolder:eyefund-wp-theme}/phpcs.php_cs"
],
"scss.validate": false,
"stylelint.enable": true,
"trailing-spaces.highlightCurrentLine": false,
"trailing-spaces.logLevel": "none",
"trailing-spaces.trimOnSave": true,
"workbench.colorTheme": "Cobalt Next Minimal",
"workbench.editor.labelFormat": "medium",
"workbench.editor.tabSizing": "shrink",
"workbench.iconTheme": "material-icon-theme"
},
"tasks": {
/**
* Tasks: Run behavior
* Some of these tasks use `runOn:folderOpen` to setup the workspace.
* You might have to run the “Allow Automatic Tasks in Folder” command.
* These run from the command palette, with the `task [label]` command.
*
* https://code.visualstudio.com/docs/editor/tasks
* https://code.visualstudio.com/docs/editor/tasks#_run-behavior
**/
"tasks": [
{
"args": [
"install",
"--install-hooks",
"--overwrite"
],
"command": "pre-commit",
"label": "pre-commit install",
"options": {
"cwd": "${workspaceFolder:eyefund-wp-theme}"
},
"presentation": {
"group": "pre-commit"
},
"problemMatcher": []
},
{
"args": [
"run"
],
"command": "pre-commit",
"label": "pre-commit run",
"options": {
"cwd": "${workspaceFolder:eyefund-wp-theme}"
},
"presentation": {
"group": "pre-commit"
},
"problemMatcher": []
},
{
"args": [
"autoupdate",
"--freeze"
],
"command": "pre-commit",
"dependsOn": [
"pre-commit install",
"pre-commit run"
],
"dependsOrder": "sequence",
"label": "pre-commit autoupdate",
"options": {
"cwd": "${workspaceFolder:eyefund-wp-theme}"
},
"presentation": {
"group": "pre-commit"
},
"problemMatcher": [],
"runOptions": {
"runOn": "folderOpen"
}
},
{
"args": [
"up",
"-d",
"--build"
],
"command": "docker-compose",
"label": "Docker up",
"options": {
"cwd": "${workspaceFolder:eyefund-wp-docker}"
},
"presentation": {
"group": "development",
"panel": "dedicated"
},
"problemMatcher": [],
"runOptions": {
"runOn": "folderOpen"
}
},
{
"args": [
"status"
],
"command": "git",
"label": "git status",
"options": {
"cwd": "${workspaceFolder:eyefund-wp-theme}"
},
"presentation": {
"group": "development",
"panel": "dedicated"
},
"runOptions": {
"runOn": "folderOpen"
}
},
{
"args": [
"down",
"--volumes"
],
"command": "docker-compose",
"label": "Docker destroy",
"options": {
"cwd": "${workspaceFolder:eyefund-wp-docker}"
},
"problemMatcher": []
},
{
"args": [
"start",
"--volumes"
],
"command": "docker-compose",
"label": "Docker start",
"options": {
"cwd": "${workspaceFolder:eyefund-wp-docker}"
}
},
{
"args": [
"ps"
],
"command": "docker-compose",
"label": "Docker status",
"options": {
"cwd": "${workspaceFolder:eyefund-wp-docker}"
},
"problemMatcher": []
},
{
"args": [
"stop"
],
"command": "docker-compose",
"label": "Docker stop",
"options": {
"cwd": "${workspaceFolder:eyefund-wp-docker}"
}
},
{
"args": [
"--fix"
],
"command": "eslint",
"label": "ESLint",
"options": {
"cwd": "${workspaceFolder:eyefund-wp-theme}"
},
"problemMatcher": [
"$eslint-stylish"
]
},
{
"args": [
"exec",
"-it",
"eyefund_wp",
"bash"
],
"command": "docker",
"label": "Docker SSH",
"options": {
"cwd": "${workspaceFolder:eyefund-wp-docker}"
},
"presentation": {
"group": "development",
"panel": "dedicated"
}
},
{
"args": [
"clean"
],
"command": "pre-commit",
"label": "pre-commit clean",
"options": {
"cwd": "${workspaceFolder:eyefund-wp-theme}"
},
"problemMatcher": []
},
{
"command": "./vendor/bin/phpcbf",
"label": "phpcbf",
"options": {
"cwd": "${workspaceFolder:eyefund-wp-theme}"
},
"problemMatcher": [],
"type": "shell"
},
{
"args": [
"${file}"
],
"command": "./vendor/bin/phpcs",
"label": "phpcs file",
"options": {
"cwd": "${workspaceFolder:eyefund-wp-theme}"
},
"type": "shell"
},
{
"args": [
"--report=code"
],
"command": "./vendor/bin/phpcs",
"label": "phpcs report",
"options": {
"cwd": "${workspaceFolder:eyefund-wp-theme}"
},
"type": "shell"
},
{
"args": [
"--config",
".markdownlint.json",
"--ignore-path",
".markdownlintignore",
"--fix",
"."
],
"command": "markdownlint",
"label": "markdownlint docs",
"options": {
"cwd": "${workspaceFolder:eyefund-wp-docs}"
},
"type": "shell"
}
],
"version": "2.0.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment