Skip to content

Vim Neovim

James Meng edited this page Jul 8, 2024 · 4 revisions

neoclide/coc.nvim Configuration

In coc-settings.json opened by :CocConfig , add:

{
  "languageserver": {
    "liquid": {
      "command": "shopify",
      "args": ["theme", "language-server"],
      "filetypes": [
        "liquid"
      ],
      "rootPatterns": [
        ".theme-check.yml"
      ]
    }
  }
}

dense-analysis/ale Configuration

" in vimrc (or config/nvim/init.vim) somewhere
let g:ale_linters = {}
let g:ale_linters.liquid = ['liquid-language-server']

function! ThemeCheckGetProjectRoot(buffer) abort
  let l:project_root = ale#path#FindNearestFile(a:buffer, '.theme-check.yml')
  return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
endfunction

call ale#linter#Define('liquid', {
\   'name': 'liquid-language-server',
\   'lsp': 'stdio',
\   'executable': system('which shopify | tr -d "\n" '),
\   'project_root': function('ThemeCheckGetProjectRoot'),
\   'command': '%e theme language-server',
\})

neovim/nvim-lspconfig Configuration

Content attributed to @slavamak

Set up shopify_theme_ls with Neovim's built-in LSP using the following configuration:

require("lspconfig").shopify_theme_ls.setup {}

This setup requires the Shopify CLI, which can be installed via npm:

npm install -g @shopify/cli

Alternatively, to manage the installation of the Shopify CLI using Mason:

require("mason").setup {}
require("mason-lspconfig").setup {
    automatic_installation = true
}

require("lspconfig").shopify_theme_ls.setup {}
Clone this wiki locally