Skip to content
This repository was archived by the owner on Sep 8, 2026. It is now read-only.

Latest commit

 

History

History
136 lines (103 loc) · 3.64 KB

File metadata and controls

136 lines (103 loc) · 3.64 KB

NIKOS IDE Setup Guide

NLS-030: VS Code and Neovim configuration

Prerequisites

  • npk-ls built and in your PATH (or use full path)
  • npkc built and in your PATH (or set NPKC_PATH)
  • ikos-analyzer available (or set NIKOS_ANALYZER_PATH)

Quick check:

npk-ls --version   # or: ./build/npk-ls --version
npkc --version     # or: ./build/npkc --version
echo $NIKOS_ANALYZER_PATH

VS Code

No VS Code extension exists yet for Nitpick. Until one is published, use the generic vscode-glspc extension or configure a custom language client.

Option A: Using nvim-lspconfig-style manual client (experimental)

Add to .vscode/settings.json:

{
  "languageServerExample.serverOptions": {
    "command": "npk-ls",
    "transport": "stdio"
  }
}

Option B: Filter NIKOS diagnostics by source

When diagnostics are visible, NIKOS findings will have:

  • Source: nikos-abstract
  • Code: e.g. check_dbz, check_sio

You can filter the Problems panel by source name.

Environment

Set in your shell profile or VS Code terminal settings:

export NPKC_PATH=/path/to/build/npkc
export NIKOS_ANALYZER_PATH=/path/to/nikos/build/analyzer/ikos-analyzer

Neovim (via nvim-lspconfig) — NLS-024

Setup

Install nvim-lspconfig if not already installed.

Add to your Neovim config (init.lua or a plugin file):

-- NIKOS/Nitpick Language Server configuration
-- NLS-024: nvim-lspconfig snippet for npk-ls stdio mode

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

-- Register 'npk_ls' as a custom server (not in upstream lspconfig yet)
if not configs.npk_ls then
  configs.npk_ls = {
    default_config = {
      cmd = { 'npk-ls' },           -- or full path: '/home/user/build/npk-ls'
      filetypes = { 'nitpick' },    -- associate with .npk files
      root_dir = lspconfig.util.root_pattern('*.npk', '.git'),
      single_file_support = true,
      settings = {},
    },
    docs = {
      description = 'Nitpick Language Server with NIKOS abstract interpretation',
    },
  }
end

-- Launch the server
lspconfig.npk_ls.setup({
  on_attach = function(client, bufnr)
    -- Optional: show diagnostic float on cursor hold
    vim.api.nvim_create_autocmd('CursorHold', {
      buffer = bufnr,
      callback = function()
        vim.diagnostic.open_float(nil, { focus = false })
      end,
    })
  end,

  -- Pass NIKOS env vars to the server process
  cmd_env = {
    NPKC_PATH            = vim.fn.expand('~/Workspace/REPOS/nitpick/build/npkc'),
    NIKOS_ANALYZER_PATH  = vim.fn.expand('~/Workspace/REPOS/nikos/build/analyzer/ikos-analyzer'),
  },
})

-- Register .npk filetype
vim.filetype.add({ extension = { npk = 'nitpick' } })

Filtering NIKOS Diagnostics

NIKOS diagnostics have source = "nikos-abstract". To show only NIKOS findings:

-- Show only nikos-abstract diagnostics in a split window
vim.keymap.set('n', '<leader>ni', function()
  vim.diagnostic.setqflist({ source = 'nikos-abstract' })
  vim.cmd('copen')
end, { desc = 'NIKOS diagnostics' })

Verifying the Integration

  1. Open a .npk file in Neovim
  2. Save the file (:w)
  3. Wait 1–5 seconds for NIKOS analysis
  4. Check :LspLog for [nikos-lsp] lines
  5. Errors/warnings should appear as inline diagnostics

Helix / Emacs / Zed

Any LSP-compliant editor can use npk-ls. Point the editor at the npk-ls binary using stdio transport and associate it with *.npk files.

See docs/nikos-lsp-protocol.md for the exact wire format and trigger semantics.