laravel_ls

package module
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2025 License: GPL-3.0 Imports: 0 Imported by: 0

README

Laravel-ls

Laravel Language Server written in go.
About | Features | Building

About

Laravel-ls is a tool that enhances your text editor or IDE with powerful features specifically designed for Laravel projects.

By implementing the Language Server Protocol (LSP), Laravel-ls seamlessly integrates with any LSP-compatible editor, bringing advanced capabilities such as intelligent auto-completion, navigation to definitions, real-time diagnostics, and more.

Although still in its early development stages, Laravel-ls aims to provide a streamlined and efficient development experience tailored to the Laravel framework.

Features

List of done and planned features of the language server.

Views

view('home')
Route::view('/user/profile', 'user.profile')
  • Hover information shows view template path.
  • Go to definition opens the template
  • Auto-complete existing template names
  • Auto-complete for existing arguments present in the template
  • Diagnostics for template files that do not exists
  • Code action to create view file that do not exists.

Environment

env('APP_NAME');
Env::get('APP_NAME');
  • Hover information shows actual value from .env file
  • Go to .env file and key location
  • Auto-complete for defined keys.
  • Diagnostics for non defined keys.
  • Code action to create missing key

Config

config('app.name')
Config::get('app.name')
  • Hover information shows actual value.
  • Auto-complete for defined config keys
  • Go to config file and value location from key
  • Diagnostics for non defined config keys.

Assets

asset('main.css');
  • Auto-completion
  • Go to asset file
  • Diagnostics for non existent assets

Blade components

<x-component.name />
<x-component name="dynamic-component" />
  • Hover information show path to the component
  • Auto-complete existing components
  • Auto-complete arguments defined in the component
  • Diagnostics for components that do not exists.
  • Code action to create missing components

Other features on the horizon

  • Livewire support
  • Inertia support
  • Eloquent support
  • Jump to test file from class.

Build

To build the project you need golang version 1.22 or later, make and a c compiler.

When the dependencies are met, running make will compile and produce the binary build/laravel-ls.

Configure

Neovim

The LSP server can be started like any other server via vim.lsp.start and an auto-command.

Just change the path to the correct directory on your filesystem

vim.api.nvim_create_autocmd("FileType", {
    pattern = { "php", "blade" },
    callback = function ()
        vim.lsp.start({
            name = "laravel-ls",
            cmd = { '/path/to/laravel-ls/build/laravel-ls' },
            -- if you want to recompile everytime
            -- the language server is started.
            -- Uncomment this line instead
            -- cmd = { '/path/to/laravel-ls/start.sh' },
            root_dir = vim.fn.getcwd(),
        })
    end
})

Author

Henrik Hautakoski henrik@shufflingpixels.com

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Name    = "laravel-ls"
	Version = "dev"
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL