Laravel lsp - Developer tools for easier Laravel development

Overview

Laravel lsp

The Laravel/Blade lsp provides:

Blade:

  • Diagnostics on missing components + action to create it.
  • Autocomplete for components and their arguments.
  • Hover shows the path to the view.
  • Goto definition on components to jump to the view or component class.
  • Blade directive autocomplete for non default directives. (For default directives there are many snippet extensions available)

Livewire:

  • Autocomplete for livewire components and their arguments.
  • Goto definition to the livewire class (not yet the view).
  • Hover shows the path to the view.
  • Diagnostics on missing components + action to create it.

Other (plans):

  • Suggestions for config()
  • view() suggestions, and goto definition for view() calls.

Demo

Demo

Status

This LSP is still to be considered unstable. If you find issues, you are welcome to provide a issue/pull request with a reproducable example.

Issues without clear steps to reproduce may be closed without answer.

As it is experimental, there is no guarantee whatsoever that this will work. Please always ensure your code is under version control.

Thing may be slow.

Installation

Requirements

PHP 8.0, older versions will NOT work. (not even trying). LARAVEL 8.0, older versions will NOT work.

This LSP is based on php in your runtime. I have not tested this with docker so for now assume it will not work from outside.

Your application needs to be bootable. This LSP will run commands in your codebase to get all the information it needs. (Much like running laravel-ide-helper).

Vscode

Install Name: laravel-blade syntax

Download the extension from the vscode extensions.

(Neo)vim

Download the compiled version from the releases then use it to setup the lsp:

This depends on your setup, below are instruction for using it with nvim-lspconfig

local lspconfig = require'lspconfig'
local configs = require 'lspconfig.configs'

-- Configure it
configs.blade = {
  default_config = {
    -- Path to the executable: laravel-dev-generators
    cmd = { "laravel-dev-generators", "lsp" },
    filetypes = {'blade'};
    root_dir = function(fname)
      return lspconfig.util.find_git_ancestor(fname)
    end;
    settings = {};
  };
}
-- Set it up
lspconfig.blade.setup{
  -- Capabilities is specific to my setup.
  capabilities = capabilities
}

Building from source

This LSP is based on the great work in phpactor/language-server

As it is php it actually does not need building, but we can still do this by makeing a phar so it is easier to distribute.

To build the phar you run:

./laravel-dev-tools app:build

Building the vscode extension

To build the vscode extension we have to build the phar and copy it to the extension's directory:

./laravel-dev-tools app:build --build-version=1 && cp builds/laravel-dev-tools extensions/vscode/laravel-dev-tools

Then in the extensions/vscode directory we do:

Install npm modules: npm install

Then make the package: npm run package

(for me: publish using vsce publish)

Licence notes

This project is based on Laravel Zero

It uses phpactor/language-server for the LSP layer.

Other packages used are:

Todo's

  • Auto copy the readme/Licence to the extension folder when building.
You might also like...
A collection of tools for rapidly building beautiful TALL stack interfaces, designed for humans.
A collection of tools for rapidly building beautiful TALL stack interfaces, designed for humans.

Filament is a collection of tools for rapidly building beautiful TALL stack interfaces, designed for humans. Packages Admin Panel • Documentation • De

Geo-related tools PHP 7.3+ library built atop Geocoder and React libraries

Geotools Geotools is a PHP geo-related library, built atop Geocoder and React libraries. Features Batch geocode & reverse geocoding request(s) in seri

Add a general-purpose tools page to your Filament project. 🛠
Add a general-purpose tools page to your Filament project. 🛠

Add a general-purpose tools page to your Filament project. Installation You can install the package via Composer: composer require ryangjchandler/fila

Llum illuminates your Laravel projects speeding up your Github/Laravel development workflow
Llum illuminates your Laravel projects speeding up your Github/Laravel development workflow

Llum illuminates your Laravel projects speeding up your Github/Laravel development workflow

PHP package to help the development of Laravel-based Telegram bots
PHP package to help the development of Laravel-based Telegram bots

Laravel-telegram-bot Project description goes here. This description is usually two to three lines long. It should give an overview of what the projec

A collection of extensions for Laravel development in Visual Studio Code

Laravel Extension Pack for Visual Studio Code Includes the basic extensions to get started with Laravel development in Visual Studio Code. Laravel Ext

A premade, easy to use local development setup to be used for authoring Laravel applications

Laravel Drydock This project is a premade, easy to use local development setup to be used for authoring Laravel applications. The deliverables of this

A collection of classes to be extended/used in laravel apps for quick development

laraquick A collection of classes to be extended/used in laravel applications for quick development. Introduction The library contains traits with wel

Laracademy Generators - is a tool set that helps speed up the development process of a Laravel application.

Laracademy Generators Laracademy Generators - is a tool set that helps speed up the development process of a Laravel application. Author(s): Laracadem

Comments
  • Livewire styles and scripts not found

    Livewire styles and scripts not found

    First, thanks for this amazing project

    Many components are not showing for me, like the livewire or other directives. I believe will be really useful to have an ability to ignore patterns image

    opened by PH7-Jack 1
Owner
Harings Rob
Harings Rob
Laravel-tagmanager - An easier way to add Google Tag Manager to your Laravel application.

Laravel TagManager An easier way to add Google Tag Manager to your Laravel application. Including recommended GTM events support. Requirements Laravel

Label84 16 Nov 23, 2022
👻 It's never been easier to build and customize admin panels. Yah! yaldash is a beautifully designed administration panel for Laravel.

?? It's never been easier to build and customize admin panels. Yah! yaldash is a beautifully designed administration panel for Laravel.

Yasser A.Idrissi 396 Dec 30, 2022
Makes working with DateTime fields in Laravel's Nova easier

This package adds a DateTime field with support for a global DateTime format, syntactic sugar for formatting individual DateTime fields and powerful d

wdelfuego 6 Aug 4, 2022
Relational Metrics - lararvel package help you to make your metrics easier

Relational Metrics This package will help you to make your metrics easier, You could get metrics about your Models, Models depending on their relation

Syrian Open Source 25 Oct 12, 2022
SEO Tools for Laravel

SEOTools - SEO Tools for Laravel and Lumen SEOTools is a package for Laravel 5.8+ and Lumen that provides helpers for some common SEO techniques. Curr

Artesãos 2.7k Dec 31, 2022
Laravel Inspector, debugging and profiling tools for Web Artisans

Laravel Inspector At a Glance Installation Configuration Usage Messages Timers Redirects Dump and die Exceptions VIEW/AJAX/API requests, how it works

null 240 Dec 8, 2022
Tools for creating Laravel packages

Tools for creating Laravel packages This package contains a PackageServiceProvider that you can use in your packages to easily register config files,

Spatie 526 Dec 29, 2022
A package for Myanmar Font, Phone and other Myanmar tools using Laravel Macro

Laravel Myanmar Tools A package for Myanmar Font, Phone and other Myanmar tools using Laravel Macro. Installation composer require pyaesoneaung/larave

Pyae Sone Aung 22 Dec 20, 2022
Laravel is accessible, powerful, and provides tools required for large, robust applications.

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be trul

Web & Mobile | eCommerce | Full-Stack Developer 4 Nov 24, 2022
SEO Helper is a package that provides tools and helpers for SEO (Search Engine Optimization).

SEO Helper By ARCANEDEV© SEO Helper is a package that provides tools and helpers for SEO (Search Engine Optimization). Feel free to check out the rele

ARCANEDEV 301 Nov 25, 2022