harvard-web-publishing / mac-dev-playbook

Mac setup and configuration via Ansible.
Other
0 stars 0 forks source link

1: Install and configure VSCode #5

Closed benjifisher closed 10 months ago

benjifisher commented 10 months ago

Resolves #1.

benjifisher commented 10 months ago

I think the third commit is not useful. I misunderstood the instructions in https://ddev.readthedocs.io/en/stable/users/debugging-profiling/step-debugging/#ide-setup:

Update the project’s .vscode/launch.json to add the “Listen for Xdebug” configuration from this config snippet. For more on customizing launch.json, see the VS Code docs.

Or maybe I misunderstood the VS Code docs.

What works:

What does not work: adding ~/.vscode/launch.json.

To do: figure out the right place to put the file for global config, update the installation script to update settings.json, or add a file to the Drupal repo.

benjifisher commented 10 months ago

At some point, I used Homebrew to install PHP on the host. I forget: maybe I did not see how to install the Xdebug plugin, or activate it, without doing that. Or maybe I was having trouble starting an Xdebug session. I should test removing PHP from my Mac so that we can just use the version on the Docker containers.

In order to start an Xdebug session, a key step is to open the repository. For example, "Open Folder..." from the VS Code application's File menu. Editing a file in the repo is not enough.

benjifisher commented 10 months ago

Carole's list of plugins (not all of which she uses):

╰─$ ls -1 ~/.vscode/extensions
andrewdavidblum.drupal-smart-snippets-2.1.0
bmewburn.vscode-intelephense-client-1.10.2
clemenspeters.format-json-1.0.3
dmitrydorofeev.empty-indent-0.2.0
extensions.json
ikappas.composer-0.8.0
juniormucciolo.drupal-7-snippets-0.0.7
marcostazi.vs-code-drupal-0.0.12
mblode.twig-language-2-0.9.4
ms-azuretools.vscode-docker-1.28.0
ms-python.isort-2023.10.1
ms-python.python-2023.22.1
ms-python.vscode-pylance-2023.12.1
ms-toolsai.jupyter-2023.11.1100101639-darwin-arm64
ms-toolsai.jupyter-keymap-1.1.2
ms-toolsai.jupyter-renderers-1.0.17
ms-toolsai.vscode-jupyter-cell-tags-0.1.8
ms-toolsai.vscode-jupyter-slideshow-0.1.5
ms-vscode-remote.remote-containers-0.327.0
neilbrayfield.php-docblocker-2.7.0
pauloamgomes.drupal7-hooks-snippets-0.0.2
ritwickdey.liveserver-5.7.9
tsega.drupal-8-javascript-snippets-0.0.2
tsega.drupal-8-twig-snippets-1.0.2
valeryanm.vscode-phpsab-0.0.16
xdebug.php-debug-1.34.0  
benjifisher commented 10 months ago

Replying to my own comments:

  1. I rewrote history (git rebase -i main) and removed the not-useful commit.
  2. I have not yet made a PR, but the feature/trello-458-use-ddev branch of https://github.com/harvard-web-publishing/hwp-curie/pulls includes launch.json. I also mention that in the wiki.
  3. I removed PHP from my Mac and tested installing VS Code and Xdebug with this project. LGTM
  4. On the wiki, I documented the steps to start a debugging session.
  5. I added all the plugins from Carole's list, but commented them out for now. I tested installing them all (un-commenting them) and only one failed. I marked that one with a FIXME comment.
benjifisher commented 10 months ago

@cemah-h:

You got it to work: great!

I added a troubleshooting section to the wiki page. That particular problem should not come up once https://github.com/harvard-web-publishing/hwp-curie/pull/662 is merged, but eventually there will be other repositories that also need the "magic file".