Skip to content

nkoporec/composer_lsp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

composer_lsp

The composer language server provides various features for composer to make development easier and faster.

2022-11-10_17-28

Debugging

For better debugging, you can use additional file logging with log4rs crate. A enviroment variable COMPOSER_LSP_LOG needs to be set, which points to the log4rs yaml config file. For more information check the log4rs documentation.

Features

  • Shows when a package needs an update.
  • Package name hover, to show details about it.
  • Package go to definition.
  • Package name completion.
  • Actions to update the selected package.

Install

Using cargo

cargo install composer_lsp

Editor Setup

Neovim

Plugins required:

After installing the package, add this to your lua config

local configs = require 'lspconfig.configs'
local lspconfig = require 'lspconfig'
if not configs.composer_lsp then
 configs.composer_lsp = {
   default_config = {
     cmd = {'composer_lsp'},
     filetypes = {'json'},
     root_dir = function(pattern)
      local cwd = vim.loop.cwd()
      local root = lspconfig.util.root_pattern('composer.json', '.git')(pattern)

      -- prefer cwd if root is a descendant
      return lspconfig.util.path.is_descendant(cwd, root) and cwd or root
     end,
     settings = {},
   },
 }
end
lspconfig.composer_lsp.setup{}

VS Code

TODO - Still need to build an extension for it.