Skip to content

bobmaertz/cuelang-lsp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CUE Language Server Protocol (LSP)

License: MIT Go Report Card Build Status

A Language Server Protocol implementation for the CUE language.

🚨 🏗️ This project is a work in progress and may not be completely functional yet 🏗️ 🚨

Table of Contents

Features

  • Full cuelang file formatting in your IDE

Installation

go get -u github.com/bobmaertz/cuelang-lsp

Usage

Describe how to use your CUE LSP, including any command-line options or integration with popular editors.

lsp [options]

Configuration

The lsp currently supports a single filepath argument for a debug log.

lsp ~/out.log

Development

Prerequisites

  • Go 1.22 or higher
  • CUE 0.10.0 or higher

Building

git clone https://github.com/bobmaertz/cuelang-lsp.git
cd cuelang-lsp
make build

Testing

make test

Running

There are two commands in the /cmd directory, one for the language server and the other for formatting. The LSP binay can be run using the binary located at /bin/lsp

To test the formatting functionality, use the following command.

go run fmtr <path/to/cuefile>.cue 

Register LSP with Nvim

I've setup my local environment to use this LSP for *.cue files.

local client = vim.lsp.start_client {
    name = "cuelang-lsp",
    cmd = { "/Users/bob/personal/cuelang-lsp/lsp" }
}

if not client then
    vim.notify "cuelang-lsp did not start"
    return
end

vim.api.nvim_create_autocmd("FileType", {
    pattern = "cue",
    callback = function()
        vim.lsp.buf_attach_client(0, client)
    end

})

Register Filetype for Cuelang

Only necessary if there the pattern used in the lsp configuration is not based on the standard treesitter filetype for cue.

:setfiletype cue 
:LspRestart

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.jjk

About

Cuelang Language Server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •