/lsp-zettelkasten

Barebone implementation of a Language Server Protocol for Zettelkasten

Primary LanguageTypeScript

lsp-zettelkasten

This repo is a basic implementation of a lsp for zettelkasten markdown files

movie-1

Features

  • ✔️ Support for link completion for type [[link here]].
  • 🚧 Clickable links inside [[..]].
  • ✔️ Support for file content preview in completion (with onCompletionResolve).
  • 🚧 Hover option on clickable links, in order to preview the file.
  • 🚧 Support tag completions with # character (needs a grammar).

Installation

git clone https://github.com/lsp-zettelkasten/lsp-zettelkasten.git
cd lsp-zettelkasten/server
npm install
npm run compile

After compiling, the compiled javascript will be in out directory.

Usage

The command to start the lsp is node out/server.js --stdio.

However, you'll need a working client for your text editor.

~/.config/nvim/init.lua
local lspconfig = require'lspconfig'
local configs = require'lspconfig/configs'

if not lspconfig.zettelkastenlsp then
  configs.zettelkastenlsp = {
    default_config = {
      cmd = {'node',  'path/to/lsp-zettelkasten/out/server.js', '--stdio'};
      filetypes = {'markdown'};
      root_dir = function(fname)
        return lspconfig.util.find_git_ancestor(fname) or vim.loop.os_homedir()
      end;
      settings = {};
    };
  }
end
lspconfig.zettelkastenlsp.setup{}