Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest version is not working with sail enabled #34

Open
Alph44rchitect opened this issue Jan 8, 2023 · 11 comments · May be fixed by #35
Open

Latest version is not working with sail enabled #34

Alph44rchitect opened this issue Jan 8, 2023 · 11 comments · May be fixed by #35
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@Alph44rchitect
Copy link

Describe the bug
The latest extension version is not working with Laravel Sail setting enabled. It seems to be ignored.

To Reproduce
Steps to reproduce the behavior:

  1. Install Laravel sail
  2. Install latest version of the extension
  3. Set enableDebugLogs: true
  4. Set runInLaravelSail: true
  5. Run format command
  6. Watch the output log and see that is still using the non sail path

Expected behavior
Using the sail path to run pint.

Environment:

  • Operating system: Ubuntu 22.04 via Windows with WSL2
  • IDE / version: VSCode / latest
  • Extension version: 1.1.4
  • Extension's config: enableDebugLogs: true, runInLaravelSail: true

Additional context
The version 0.7.3 works as expected.

@Alph44rchitect Alph44rchitect added the bug Something isn't working label Jan 8, 2023
@d8vjork d8vjork self-assigned this Jan 14, 2023
@d8vjork
Copy link
Member

d8vjork commented Jan 14, 2023

Thanks for raising the issue!

Will take a look at this

@d8vjork d8vjork linked a pull request Jan 25, 2023 that will close this issue
@benjamindonze
Copy link

+1 on this issue

@d8vjork d8vjork added the help wanted Extra attention is needed label Feb 22, 2023
@d8vjork
Copy link
Member

d8vjork commented Feb 22, 2023

Sorry to say but this feature cannot be viable, as VSCode doesn't provide same Bash/Zsh/shell context with it so doesn't know where Docker is or any other binary, for global Pint this uses a predefined path setting, but Sail needs Docker therefore need to be on the PATH, the one we can't have access to from an child process from the VSCode one (unless some special things applied to this one).

Anyway will continue on the research of this and add help wanted

@GringoDotDev
Copy link

@d8vjork have you considered something like this?

docker-compose exec -T laravel.test ./vendor/bin/pint

This executes the command inside the default app container that comes with Sail and logs the output to terminal. Should be executable from the shell context of VSCode and its extensions (works fine for me locally anyway.)

@d8vjork
Copy link
Member

d8vjork commented Feb 24, 2023

@jseitel Problem with that still the same, need to find out where is that docker-compose (or in case of newer versions, docker compose), could be specified on an extension setting tho

@Alph44rchitect
Copy link
Author

Alph44rchitect commented Mar 9, 2023

@d8vjork I haven't looked into the details but it was working as expected with v0.7.3 and still is. What changed?

@d8vjork
Copy link
Member

d8vjork commented Mar 9, 2023

@d8vjork I haven't looked into the details but it was working as expected with v0.7.3 and still is? What changed?

You are actually right... after checking 0.7.x I discovered that I was actually wrapping the execution into a VSCode Task, will try if I could achieve the same on this new refactor I did on v1

Note to myself: Use ShellExecution from VSCode API to wrap the command

@ricardosoares09
Copy link

Laravel pint vscode, still isn't working with docker/sail, is there any development on this ? Is there any workaround?

@astral-data
Copy link

Laravel pint vscode, still isn't working with docker/sail, is there any development on this ? Is there any workaround?

use 0.7.3

@GabrielDSousa
Copy link

GabrielDSousa commented Sep 20, 2024

I encountered a similar issue with the latest version of the Laravel Pint VSCode extension not working correctly in a Laravel Sail setup. After some troubleshooting, I found a solution that worked for me, especially if you're working in a .devcontainer environment.

My Solution:

If you're using a .devcontainer environment, add the following snippet to your devcontainer.json settings and rebuild the container:

"settings": {
                "laravel-pint.enable": true,
                "laravel-pint.executablePath": "vendor/laravel/pint/builds/pint",
                "[php]": {
                    "editor.defaultFormatter": "open-southeners.laravel-pint",
                    "editor.formatOnSave": true
                }
            }

The Problem:

It seems that the default path for Laravel Pint (vendor/bin/pint) has been moved in the latest Laravel Sail installation, likely to vendor/laravel/pint/builds/pint.

Alternative Solution:

If you're not using a .devcontainer environment, you could try changing the executablePath in your workspace or extension config to match the new path.

I hope this helps anyone else encountering the same issue!

@csouza1995
Copy link

Just to report, I have same issue! Waiting for new version, but using version 0.7.3 as commented above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants