ddev / vscode-ddev-manager

DDEV Manager offers a centralized and user-friendly interface to control every aspect of your DDEV projects.
https://marketplace.visualstudio.com/items?itemName=biati.ddev-manager
Apache License 2.0
12 stars 3 forks source link

tasks.json not created when automaticallyConfigureDebugger = true #18

Closed inf0dr0id closed 2 months ago

inf0dr0id commented 4 months ago

I'm not sure if this is a bug or just a problem on my system?

When DDEV Manager creates the launch.json with "preLaunchTask": "DDEV: Enable Xdebug" and "postDebugTask": "DDEV: Disable Xdebug" it does not create the tasks.json and I'm getting the following error when launching "Listen for Xdebug":

Bildschirmfoto 2024-02-29 um 10 12 44

To Reproduce Steps to reproduce the behavior (at least on my system):

  1. Open project with no launch.json in .vscode or delete it
  2. DDEV Manager creates launch.json with preLaunchTask and postDebugTask but no tasks.json in .vscode
  3. Click on "Listen for Xdebug"

Expected behavior The tasks for preLaunchTask and postDebugTask should be created in tasks.json.

Cheers

System:

jameswilson commented 3 months ago

This is probably due to the changes introduced in https://github.com/ddev/ddev/pull/5771

Looks like the vscode ddev plugin needs to just generate the .vscode/tasks.json file from the one found on the Ddev docs site.

https://ddev.readthedocs.io/en/latest/users/snippets/tasks.json

biati-digital commented 3 months ago

The extension does create the tasks.json file with the required configuration. https://share.cleanshot.com/Yvx20vp7

For now this process happens when the workspace is opened, in a future version we implement more checks when the project is started, restarted, etc.

In this case, I'll need help from you to get more information as I'm not able to replicate it. In VS Code, open the command palette and type "Toggle Developer Tools", inside that window use (cmd+r on Mac or controls+r on windows?) to reload VS Code and check for any possible errors.

inf0dr0id commented 3 months ago

You're right, there are errors right away. I've disabled all other extension created a new folder with a fresh ddev config and freshly installed the DDEV Manager extension v2.2.0 after completely deleting it from the local extensions folder. I'm using VSCodium 1.87.2.

Bildschirmfoto 2024-03-30 um 12 24 47

Please let me know if this helps or if you need further information.

biati-digital commented 3 months ago

Hi @inf0dr0id thank's for the information, probably something changed in the VS Code API in a recent update, I'm running 1.86.1

As soon as I've some free time I'll take a look at this.

biati-digital commented 3 months ago

@inf0dr0id Well, I just upgraded to VS Code 1.87.2 and everything is working, not sure if related to VSCodium or something related to your workspace. The extension uses the VS Code API to read and update the tasks.json and launch.json files.

I'll try VSCodium when I've some free time, in the meantime can you let me know if your workspace has multiple root folders? https://code.visualstudio.com/docs/editor/multi-root-workspaces

inf0dr0id commented 3 months ago

@biati-digital No multiple roots. Quick test with official VSCode 1.87.2 shows same issue.

Bildschirmfoto 2024-04-02 um 15 35 27
biati-digital commented 3 months ago

@inf0dr0id thank's for checking, can you please try this version?

ddev-manager-2.3.0.vsix.zip

inf0dr0id commented 3 months ago

@biati-digital

Bildschirmfoto 2024-04-02 um 18 03 09
biati-digital commented 3 months ago

@inf0dr0id Ok, I'm not able to replicate this error so it will take more time. I'm currently busy but hopefully in a few days i'll be able to take a look at this.

jameswilson commented 2 months ago

I don't know if this context helps, but this issue happened to me when I opened a project where I had created the launch.json file manually some time ago following the old Ddev docs, before I started using the vscode ddev extension, and also before I contributed the changes that introduced the xdebug tasks into the launch.json file.

The behavior I saw after opening the vscode project was that the launch.json was updated automatically by the extension but that the tasks.json file that wasn't there before didn't get created.

inf0dr0id commented 2 months ago

I have this issue with our without a launch.json already there. The launch.json is created/updated correctly.

A test on two other machines, one was freshly installed, showed the same errors in the console. Maybe some missing dependencies which a VSCode extension developer has installed?

biati-digital commented 2 months ago

@jameswilson probably not be related, in fact the code to create/update the launch.json file is the same as the code to create/update tasks.json file except for 1 line.

@inf0dr0id There are no external dependencies; all the required code is bundled with the extension when published. The only "external dependency" is DDEV. The tasks and launch files are created/updated using only the VS Code API. From your screenshots I can see that the API is not returning the tasks, in all the tests I did even if the tasks file didn't exists it returned an object. Not sure if it has something to do with user level task or some other config. Anyway, I'll rewrite that part.

biati-digital commented 2 months ago

After some tests the problem was with user level tasks, I had an empty tasks file in ~/Library/Application Support/Code/User/tasks.json and because of that when using workspace.getConfiguration('tasks') I was receiving an empty object instead of undefined, when I removed that file I was able to replicate the issue.

@inf0dr0id please update the extension to 2.3.1 (from the extensions marketplace) and let me know if it's working.

inf0dr0id commented 2 months ago

@biati-digital Great, it's working now. Thank you.

biati-digital commented 2 months ago

Awesome, I'll close this issue now.