Skip to content

Sigmapitech/ecsls

Repository files navigation

[ECSLS] Epitech Coding Style Language Server

image

Dependencies

Nix

  • Via Home Manager

Using Home Manager, you can use the github url as an input and pass it to your nvim config.

Set ecsls.packages.${conf.system}.default within the neovim.extraPackages option and refer to the neovim configuration after the dependencie section.

  • Development packages are provided throught nix develop.

Non-Nix

  • Install banana-vera package if existing, or you compile it by yourself.

Epitech Ruleset

You need to clone the repo of the coding style of EPITECH. If you do not have access to this repo, we are sorry but you will not be able to use this LSP, as it is required for this to run, and is internal to Epitech.

git submodules update --init --recursive

or

git clone https://github.com/Epitech/banana-coding-style-checker.git <path>

Setup ECSLS python package

(optional) Create a virtual environement (avoid polluting your python).

python -m venv venv

Install the package locally.

venv/bin/pip install .

Note If you are using virtual environments, don't forget to add the correct path for the command in your LSP config

Neovim Setup

To activate the language server using lspconfig, use the following configuration:

local lspconfig = require('lspconfig')
local configs = require('lspconfig.configs')

-- ↓ Epitech C Style Checker
if not configs.ecsls then
  configs.ecsls = {
    default_config = {
      root_dir = lspconfig.util.root_pattern('.git', 'Makefile'),
      cmd = { 'ecsls_run' },
      autostart = true,
      name = 'ecsls',
      filetypes = { 'c', 'cpp', 'make' },
    },
  }
end
lspconfig.ecsls.setup({})

Note If you want to use it globally, or if you wish to change the vera rules directory, change path in by using init_options.

local lspconfig = require('lspconfig')
local configs = require('lspconfig.configs')

-- ↓ Epitech C Style Checker
if not configs.ecsls then
  configs.ecsls = {
    default_config = {
      root_dir = lspconfig.util.root_pattern('.git', 'Makefile'),
      cmd = { 'ecsls_run' },
      autostart = true,
      name = 'ecsls',
      filetypes = { 'c', 'cpp', 'make' },
      init_options = {
        path = "/your/custom/path";
      };
    },
  }
end
lspconfig.ecsls.setup({})

Warning The path must be valid and pointing to the epitech ruleset repository root.

path = ".../ls/banana"  # invalid
path = ".../ls/banana-coding-style-checker/vera"  # invalid too
path = ".../ls/banana-coding-style-checker"  # valid

Note If you are using nix with home manager, the ruleset with already be bundled as long as you have a SSH key linked to your github account.

To see a configuration in more details, consider reading my dotfiles.

Contributors 4

  •  
  •  
  •  
  •