3 releases

0.0.3 Jan 3, 2023
0.0.2 Dec 6, 2022
0.0.1 Nov 26, 2022

#2214 in Development tools

MIT license

61KB
1K SLoC

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.

Dependencies

~11–23MB
~344K SLoC