Metadata-Version: 2.4
Name: chiz
Version: 0.7.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Rust
License-File: LICENSE
Summary: Chili Pepper Language Linter, Formatter, and Language Server, written in Rust.
Keywords: automation,flake8,pycodestyle,pyflakes,pylint,clippy
Author-email: Jo Shinonome <jo.shinonome@gmail.com>
Requires-Python: >=3.7
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# Chiz

<span style="color: red;">Chi</span>li & Pepper Language Analy<span style="color: red;">z</span>er, provides Linter, Formatter, and Language Server for [chili](https://purple-chili.github.io/), a spicy language and runtime for data analysis and engineering

## Language Server

- [x] hover
- [x] rename symbol
- [x] go to definition
- [x] go to reference
- [x] workspace symbol
- [x] document highlight
- [x] document symbol
- [x] completion
- [x] signature help
- [x] semantic highlights
- [ ] call hierarchy

## Installation

```bash
pip install chiz
```

## Neovim Configuration

Create a `~/.config/nvim/lua/chiz.lua` file and add the following code, then include `require("chiz")` in the `init.lua` file.

```lua
local cmp = require 'cmp'
cmp.setup({
  sources = cmp.config.sources({
    { name = 'nvim_lsp' },
    { name = 'vsnip' },
    { name = 'buffer' },
  }),
  window = {
    completion = cmp.config.window.bordered(),
  },
  mapping = cmp.mapping.preset.insert({
    ['<C-b>'] = cmp.mapping.scroll_docs(-4),
    ['<C-f>'] = cmp.mapping.scroll_docs(4),
    ['<C-Space>'] = cmp.mapping.complete(),
    ['<C-e>'] = cmp.mapping.abort(),
    ['<CR>'] = cmp.mapping.confirm({ select = true }),
  }),
  completion = {
    keyword_length = 2,
  }
})

vim.api.nvim_create_autocmd('FileType', {
  pattern = { "chi", "pep" },
  callback = function()
    vim.lsp.start({
      name = 'chili language server',
      cmd = { 'chiz', 'server' },
      filetypes = { 'chi', 'pep' },
      root_dir = vim.fs.dirname(vim.fs.find({ 'src' }, { upward = true })[1]),
    })
    local group = vim.api.nvim_create_augroup("LSPDocumentHighlight", {})
    vim.opt.updatetime = 1000
    vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
			buffer = bufnr,
			group = group,
			callback = function()
				vim.lsp.buf.document_highlight()
			end,
		})
    vim.api.nvim_create_autocmd({ "CursorMoved" }, {
			buffer = bufnr,
			group = group,
			callback = function()
				vim.lsp.buf.clear_references()
			end,
		})
  end,
})

vim.api.nvim_create_autocmd('LspAttach', {
  group = vim.api.nvim_create_augroup('UserLspConfig', {}),
  callback = function(ev)
    vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
    local opts = { buffer = ev.buf }
    vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
    vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
    vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
    vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
    vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
    vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
    vim.keymap.set('n', '<space>wl', function()
      print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
    end, opts)
    vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
    vim.keymap.set('n', '<space>f', function()
      vim.lsp.buf.format { async = true }
    end, opts)
  end,
})

-- Create an augroup to manage the autocmd
local lsp_augroup = vim.api.nvim_create_augroup("LspFormatting", { clear = true })

-- Apply formatting before saving the buffer
vim.api.nvim_create_autocmd("BufWritePre", {
  group = lsp_augroup,
  callback = function()
    vim.lsp.buf.format({ async = false })
  end,
})
```

## Helix Configuration

Pending...

