Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

kindermax/lets-lsp-cpp

Repository files navigation

Lsp server for lets task runner (C++ version for educational purposes)

Supported features

  • Goto definition
  • Completion
  • Diagnostics
  • Hover
  • Document highlight
  • Document symbol
  • Formatting
  • Signature help
  • Code action

Development

On linux install build dependencies:

apt-get install -y \
 build-essential \
 cmake \
 git

Optional dependencies:

apt-get intstall -y clang-tidy # need 18 version

On macos install build dependencies:

brew install cmake
brew install git

Optional dependencies:

clang-tidy and clang-format are not available directly via brew, but we can install them via llvm:

brew install llvm

Next we need to add clang-tidy and clang-format to the PATH:

# or change BIN_DIR to your own bin dir
BIN_DIR=/usr/local/bin
ln -s "$(brew --prefix llvm)/bin/clang-tidy" "${BIN_DIR}"
ln -s "$(brew --prefix llvm)/bin/clang-format" "${BIN_DIR}"

Build and run

cmake -S . -B build
cmake --build build
./build/lets_ls --file /path/to/log.txt

Testing

cmake -S . -B build
cmake --build build
ctest --test-dir build --output-on-failure 

Use in neovim

Add new filetype:

vim.filetype.add({
 filename = {
 ["lets.yaml"] = "yaml.lets",
 },
})

In your neovim/nvim-lspconfig servers configuration:

In order for nvim-lspconfig to recognize lets_lsp we must define config for lets_ls

require("lspconfig.configs").lets_ls = {
 default_config = {
 cmd = { 
 "/Users/max/code/projects/lets-ls-cpp/build/lets_ls",
 "--file",
 "/Users/max/code/projects/lets-ls-cpp/log.txt",
 },
 filetypes = { "yaml.lets" },
 root_dir = util.root_pattern("lets.yaml"),
 settings = {},
 },
}

And then enable lets_ls in then servers section:

return {
 "neovim/nvim-lspconfig",
 opts = {
 servers = {
 lets_ls = {},
 pyright = {}, -- just to show an example how we enable lsp servers
 },
 },
}

About

LSP server for lets written in c++

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

AltStyle によって変換されたページ (->オリジナル) /