🍺 Integrates Laravel Pint into your VSCode projects for automatic code formatting

Overview

Laravel Pint for VS Code

main codecov Visual Studio Marketplace Last Updated Visual Studio Marketplace Version Visual Studio Marketplace Rating Visual Studio Marketplace Installs

This extension is NOT official from the Laravel team. Take a look into the official project.

Integrates Laravel Pint into your VSCode projects for automatic code formatting.

Getting started

  1. Just install and enable this extension.
  2. Run the following command in a terminal or console at your project's path:
composer require laravel/pint --dev
  1. Finally, save any file and it will format it for you. Or press Ctrl + Shift + P on Windows/Linux (Cmd + Shift + P on Mac OS) and type "Format document using Laravel Pint" this will format the current opened file.

Features

  • pint.json autocompletion and validation
  • Run Laravel Pint locally or in Docker (using Laravel Sail) when saving a PHP document
  • Provides a format document command to format opened PHP files
  • Provides a format workspace files command to format all workspace folder PHP files
  • Format with Laravel Pint task

License

Logo (icon) is property of Laravel Team or Laravel Pint project.

This project is open-sourced software licensed under the MIT license.

Comments
  • Binary permissions issue on Windows

    Binary permissions issue on Windows

    image

    This is the message output,

    in config a use extensions: vendor/bin/pint

    i tried with this path on windows: ./vendor/bin/pint vendor/bin/pint.bat

    not working in windows.

    In linux only i use vendor/bin/pint

    update:

    if i use tha absolute from C....\laravel-project\vendor\bin\pint.bat

    then its works

    Originally posted by @jesusferm in https://github.com/open-southeners/vscode-laravel-pint/issues/15#issuecomment-1192841549

    bug 
    opened by d8vjork 12
  • Formatting breaks blade markdown email files

    Formatting breaks blade markdown email files

    Issue

    I believe there might be some issues with formatting on markdown email blade files. Which according to the docs explain to not add excess indentation.

    To recreate this issue you can build an example Mail with the example from Laravel

    php artisan make:mail OrderShipped --markdown=emails.orders.shipped
    

    Which should give you a blade file like so:

    @component('mail::message')
    # Order Shipped
     
    Your order has been shipped!
     
    @component('mail::button', ['url' => $url])
    View Order
    @endcomponent
     
    Thanks,<br>
    {{ config('app.name') }}
    @endcomponent
    

    Now I have the following VSCode settings:

    {
        "editor.formatOnSave": true,
        "[vue]": {
            "editor.defaultFormatter": "esbenp.prettier-vscode"
        },
        "[javascript]": {
            "editor.defaultFormatter": "esbenp.prettier-vscode"
        },
        "[typescript]": {
            "editor.defaultFormatter": "esbenp.prettier-vscode"
        },
        "[php]": {
            "editor.defaultFormatter": "open-southeners.laravel-pint",
            "editor.formatOnSave": true
        }
    }
    

    So when I save that file is gets formatted as so

    @component('mail::message')
        # Introduction
    
        The body of your message.
    
        @component('mail::button', ['url' => ''])
            Button Text
        @endcomponent
    
        Thanks,<br>
        {{ config('app.name') }}
    @endcomponent
    

    Which causes the email to look a little like image

    Current Workaround

    Right now my workaround is to add back my previous formatter, or turn off complelty for those blade type files

        "[blade]": {
            "editor.defaultFormatter": "valeryanm.vscode-phpsab",
            "editor.formatOnSave": true
        },
    
    bug needs replication 
    opened by tcampbPPU 10
  • onboarding recommendation

    onboarding recommendation

    First off thank you for creating this, much better setup than i had before.

    That being said, my recommendation is to keep the out of the box experience with this plugin as a "run pint".

    It took me a few mins to realize that the plugin was actually working, it was just using the --preset psr12 flag

    Plus chances are, if a user does have opinions on what they want to use they will likely already be using pint.json

    enhancement 
    opened by JeffBeltran 9
  • Something went wrong! Executable does not exists or lacks permissions.

    Something went wrong! Executable does not exists or lacks permissions.

    I'm getting this message "Something went wrong! Executable does not exists or lacks permissions." I have the pint.json on the project root and when I run ./vendor/bin/pint its works.

    What might be the problem?

    bug needs replication 
    opened by nunofmmarques 8
  • Something went wrong! Executable does not exists or lacks permissions with v0.7.2

    Something went wrong! Executable does not exists or lacks permissions with v0.7.2

    After upgrading to v0.7.2 of this extension, I get the error "Something went wrong! Executable does not exists or lacks permissions." for manual or automatic formatting on save. Downgrading the plugin back to v0.7.1 solves this problem, without any additional modifications to the settings or the executable.

    The executable is on it's default location (./vendor/bin/pint) and the permissions are looking okay.

    Running with Pint v0.2.3.

    opened by joostdebruijn 7
  • Error is thrown on projects without Pint installed

    Error is thrown on projects without Pint installed

    The following error is thrown on every save of every file for projects that don't have Pint installed. This is a bit annoying and counterintuitive. I feel that no warning should be thrown here.

    Screenshot 2022-06-23 at 16 27 35 enhancement 
    opened by driesvints 5
  • Format on save problem when it's a workspace

    Format on save problem when it's a workspace

    Something went wrong! Executable does not exists or lacks permissions.

    It's returning this message when I'm working in a vscode workspace.

    I tried to reproduce the problem by opening in a regular window and it didn't happen, I noticed this only for the workspace.

    When I use VSCode Command it is working fine, this was only noticed for format on save

    My development environment is macOS and I use php by command line via asdf

    bug needs replication 
    opened by danielprrazevedo 4
  • Doesn't seem to work when application code is in a subdirectory

    Doesn't seem to work when application code is in a subdirectory

    Hi,

    I've tried using your extension and couldn't get it to work in my current project. I'm not sure if it's relevant but my Laravel application code is stored in a code directory at the root of the project like so:

    | azure
    | code
       | app
       | bootstrap
       | config
       | ...
    | docker
    

    When I tried it on a brand new Laravel project it worked.

    Also, I tried changing the configuration for the executable path to "./code/vendor/bin/pint" with no effect.

    bug 
    opened by FrancisMawn 4
  • Not possible to install in WSL2

    Not possible to install in WSL2

    I'm trying v0.2.1 and the install gets stuck when I try to install it in WSL2 (Ubuntu + W11). So basically can't use it cause it's disabled in workspace unless I manage to install it in remote WSL

    bug help wanted 
    opened by HassanZahirnia 4
  • Workspace settings being modified on every workspace opened

    Workspace settings being modified on every workspace opened

    I have a variety of project types I work with and this extension seems to automatically modify the workspace's .vscode/settings.json file. It's adding this line specifically:

    "laravel-pint.enable": true
    

    It would be nice to either:

    1. Remove this functionality
    2. Hide it behind a config option and set it in my user settings to not offer to modify my workspace settings every time I open a project.
    enhancement 
    opened by adrum 2
  • Config path not correctly loaded

    Config path not correctly loaded

    The config file setting is not being passed to the pint command correctly. It appears to be using just the filename, instead of either the relative or absolute path of the config file. My laravel project is inside an api/ folder in the workspace. Additionally, it seems like allowing any of the following paths should be acceptable:

    • /project/api/pint.json
    • api/pint.json -./api/pint.json

    It seems like the extensions should resolve the absolute command based on any of the above inputs and pass the absolute path of the file like the rest of the args.

    .vscode/settings.json

    {
      "editor.formatOnSave": true,
      "laravel-pint.enable": true,
      "laravel-pint.enableDebugLogs": true,
      "laravel-pint.configPath": "api/pint.json",
      "[php]": {
        "editor.defaultFormatter": "open-southeners.laravel-pint"
      }
    }
    

    api/pint.json

    {
        "preset": "laravel",
        "rules": {
            "braces": true,
            "not_operator_with_successor_space": false,
            "ordered_imports": {
                "sort_algorithm": "length"
            },
            "concat_space": {
                "spacing": "one"
            }
        }
    }
    

    Output:

    "/project/api/vendor/bin/pint --config pint.json /project/api/tests/Feature/File.php"
    ["INFO" - 6:21:57 PM] Formatting completed in 899ms.
    
    bug 
    opened by adrum 2
  • Pass workspace args into global pint command

    Pass workspace args into global pint command

    When falling back to the global pint command, I realized that the workspace config isn't being used.

    I haven't tested all the use cases thoroughly yet, so leaving this as a draft for the moment.

    opened by jasonvarga 2
  • Executable not readable or lacks permissions for Laravel Pint.

    Executable not readable or lacks permissions for Laravel Pint.

    Describe the bug Got this error in the console (wasn't there before): ["INFO" - 7:36:37 a.m.] Extension Name: open-southeners.laravel-pint. ["INFO" - 7:36:37 a.m.] Extension Version: 1.1.4. ["ERROR" - 7:36:52 a.m.] Executable not readable or lacks permissions for Laravel Pint.

    Environment:

    • Operating system: Linux
    • IDE / version: VSCode 1.73.1
    • Extension version 1.1.4
    • Extension's config:
    {
     "laravel-pint.executablePath": "./code/vendor/bin/pint",
     "laravel-pint.preset": "psr12",
     "laravel-pint.configPath": "./code/pint.json"
    }
    
    bug 
    opened by FrancisMawn 1
Releases(v1.1.4)
  • v1.1.4(Nov 24, 2022)

  • v1.1.3(Oct 16, 2022)

  • v1.1.2(Aug 30, 2022)

  • v1.1.1(Aug 16, 2022)

    Fixed

    • Custom config file path resolution (now yes, thanks to @adrum for the PR) [#23]
    • Workspace files format command

    Changed

    • laravel-pint.configPath now is also being used by the extension's exclude paths
    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Aug 12, 2022)

    Added

    • More logging debug information (only enabled by setting the option laravel-pint.enableDebugLogs)

    Changed

    • Format workspace was formatting all workspaces, now it formats only current active document's workspace (otherwise it complains about it on the Output logs tab of VS Code)

    Fixed

    • Custom config file path resolution [#22]
    • File formatting triggers under the whole workspace [#21]
    • Minor bug with extension version debug info getting logged
    Source code(tar.gz)
    Source code(zip)
  • v1.0.2(Aug 4, 2022)

  • v1.0.1(Aug 3, 2022)

    Fixed

    • Hide status bar with others document languages
    • Show disabled status bar with active files that are excluded by Laravel Pint
    • Fix command execution on Windows wasn't made properly

    Added

    • First extension enable pre-setting workspace language-scoped (PHP) config: editor.formatOnSave and laravel-pint.enable
    • Some output messages
    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Aug 2, 2022)

    Fixed

    • Support to run Laravel Pint or Laravel Sails with PHP on Windows [#18]

    Added

    • Support for multi-workspace environment
    • Spanish translation for extension settings
    • Extension category to Formatters (now it works like a proper VS Code formatter) [#17]
    • More debugging messages (can be enabled by the setting option laravel-pint.enableDebugLogs)
    • Status bar that shows extension debug output on click (still work in progress...)
    • Security support for untrusted workspaces (limited functionality to just global)
    • Add fallback to global Laravel Pint command whenever local binary isn't found in any workspace (supporting both Windows & Linux/Mac OS), configurable by the setting laravel-pint.fallbackToGlobalBin [#20]

    Changed

    • Major codebase refactor

    Removed

    • VS Code task provider for workspace formatting (in favour of the same format project command which now works with multiple workspaces)
    Source code(tar.gz)
    Source code(zip)
  • 0.7.3(Jul 10, 2022)

  • 0.7.2(Jul 7, 2022)

  • 0.7.1(Jul 5, 2022)

  • 0.7.0(Jun 30, 2022)

  • 0.6.1(Jun 28, 2022)

  • 0.6.0(Jun 28, 2022)

  • 0.5.0(Jun 27, 2022)

    Added

    • Laravel Sail compatibility, adding options runInLaravelSail (default: false) and sailExecutablePath (default: vendor/bin/sail).

    Fixed

    • Make default settings all compatible with Windows paths.
    • Format command visible even when extension has not been activated.
    Source code(tar.gz)
    Source code(zip)
  • 0.4.0(Jun 27, 2022)

    Added

    • Option auto for preset to leave it empty on the executable arguments.

    Changed

    • configPath default behaviour (out of the box) to auto align and improve user experience and extension maintenance alignment with the official Laravel Pint.
    Source code(tar.gz)
    Source code(zip)
  • 0.3.0(Jun 27, 2022)

  • 0.2.0(Jun 23, 2022)

  • 0.1.0(Jun 23, 2022)

Owner
Open Southeners
Opening the software jar from/to businesses
Open Southeners
Tiny JavaScript library (1kB) by CurrencyRate.today, providing simple way and advanced number, money and currency formatting and removes all formatting/cruft and returns the raw float value.

Zero dependency tiny JavaScript library (1kB bytes) by CurrencyRate.today, providing simple way and advanced number, money and currency formatting and removes all formatting/cruft and returns the raw float value.

Yurii De 11 Nov 8, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Easily publish notes to the web This plugin integrates with obsius.site to publish markdown notes on the web.

Obsius Publish Easily publish notes to the web This plugin integrates with obsius.site to publish markdown notes on the web. Limitations The type of c

Jon Grythe Stødle 66 Dec 20, 2022
The project integrates workflow engine, report engine and organization authority management background, which can be applied to the development of OA, HR, CRM, PM and other systems. With tlv8 IDE, business system development, testing and deployment can be realized quickly.

介绍 项目集成了工作流引擎、报表引擎和组织机构权限管理后台,可以应用于OA、HR、CRM、PM等系统开发。配合使用tlv8 ide可以快速实现业务系统开发、测试、部署。 后台采用Spring MVC架构简单方便,前端使用流行的layui界面美观大方。 采用组件开发技术,提高系统的灵活性和可扩展性;采

Qian Chen 38 Dec 27, 2022
An Open Source Remix template that integrates Stripe Subscriptions, Social Authentication, Testing and a few more features. PostgreSQL version. Deploys to Fly.io

Live Demo · Twitter An open source Remix Stack that integrates Stripe Subscriptions, Social Authentication, Testing and a few more features. PostgreSQ

xo 25 Dec 7, 2022
An Open Source Remix template that integrates Stripe Subscriptions, Social Authentication, Testing and a few more features. SQLite version. Deploys to Fly.io

Live Demo · Twitter An Open Source Remix template that integrates Stripe Subscriptions, Social Authentication, Testing and a few more features. SQLite

xo 135 Dec 31, 2022
This plugin integrates by default with Twitter bootstrap using badges to display the maximum lenght of the field where the user is inserting text. Uses the HTML5 attribute "maxlength" to work.

Bootstrap MaxLength This plugin integrates by default with Twitter bootstrap using badges to display the maximum length of the field where the user is

Maurizio 772 Dec 25, 2022
A testing focused Remix Stack, that integrates E2E & Unit testing with Playwright, Vitest, MSW and Testing Library. Driven by Prisma ORM. Deploys to Fly.io

Live Demo · Twitter A testing focused Remix Stack, that integrates E2E & Unit testing with Playwright, Vitest, MSW and Testing Library. Driven by Pris

Remix Stacks 18 Oct 31, 2022
a VS Code Extension for Easily Localize any blade/php text in any Laravel project.

Laravel Easy Localize a VS Code Extension for Easily Localize any blade/php text in any Laravel project. Features Custom array key for each translatio

Moataz Hajres 6 Oct 31, 2022
Visual Studio Code extension for formatting and linting Django/Jinja HTML templates using djLint

Visual Studio Code extension for formatting and linting Django/Jinja HTML templates using djLint

Almaz 25 Dec 15, 2022
Simple and intuitive API Client made into a VSCode extension 😊

REST API Client Simple and intuitive API Client made into a VSCode extension. Visual Studio Marketplace • Repository • Releases Visual Studio Code ext

REST API Client 19 Dec 23, 2022
Create beautiful code snippets from your VSCode environment.

Snippets Photo Shoot Create beautiful code snippets from your VSCode environment. How it works Select the code snippet you want to use, then right cli

Renato Pozzi 24 Aug 3, 2022
Autocompletion, in-code secret peeking 🔎, syncing, and more, for your .env files in VSCode. 👑 From the same people who pioneered dotenv.

Dotenv Official (with Vault) for VSCode Official Dotenv. Syntax highlighting, autocompletion, in-code secret peeking, and .env file syncing with Doten

Dotenv 38 Dec 19, 2022
🚀 Create dynamic and automatic changelogs for your project!

Versionator-js Create dynamic and automatic changelogs for your project!. Installation Use the package manager npm to install versionator-js. npm inst

Diego Sousa 6 Jan 6, 2023
🪄 Automatic backups for your Notion workspaces.

Notion Backups Set up automated backups for your Notion workspaces that run on a time-basis and notify you by Slack, Discord, or email, so you never w

NotionStuff 26 Aug 7, 2022
Instruction how to install laravel echo and pusher without vuejs or even npm

This 2 .js files are used to listen from server broadcasting with laravel-websockets, so that you don't need the use of Vue.js in your laravel app Fol

Muath Assawadi 7 Sep 28, 2022
esbuild plugin to generate mix-manifest.json file compatible with Laravel Mix.

esbuild-mix-manifest-plugin An esbuild plugin to generate a mix-manifest.json compatible with Laravel Mix. Installation You can install the plugin via

Stefan Zweifel 6 Dec 25, 2022