/c3-lsp

Language Server for C3 Language

Primary LanguageCGNU General Public License v3.0GPL-3.0

Language Server for the C3 language.

Go

WIP LSP for C3 language

Table of Contents

Features

Supported Language server features:

  • Completion
  • Go to definition
  • Go to declaration
  • Hover
  • Signature Help

Furthermore, the LSP is able to resolve stdlib symbols information (for supported C3c versions), allowing to use this in completion and hover functionalities.

Project Goals

Writing a Language Server Protocol (LSP) can be a complex and challenging task. To manage this complexity, our initial focus is on covering the basic yet essential needs of a typical LSP implementation.

Current target

The main current target, is to cover the most essential feature which is to scan precise information about symbols used within the source code of a project.
This information can then be used by an IDE to enable the following features:

  • Go to Definition: Navigate to the exact location where a symbol is defined.
  • Hover Information: Display detailed information about symbols when hovering over them.
  • Autocomplete: Suggest relevant symbols and code completions as you type.

These features will significantly improve the developer experience by providing accurate and efficient code navigation and assistance.

Future plans

Once these initial objectives are completed, we will explore additional functionalities that can be added to the project, further enhancing its capabilities and usefulness.

Installation

Project is written in Golang, so in theory it could be built to any OS supported by Golang.
Precompiled binaries for the following operating systems are available:

You can also build from source:

  • Download and install golang: https://go.dev/
  • Clone this repo
  • Run make build: This will create c3-lsp in server/bin folder.

Usage

Simply run c3-lsp to start the server.
It supports the following options:

  • help: Display accepted options.
  • send-reports: If enabled (disabled by default) will send crash reports to Sentry so bugs can be debugged easily.
  • lang-version: Use it to specify a specific c3 language version. By default c3-lsp will select the last version supported.

Clients

VS Code

There's a simple vscode extension available for download here: download VSIX
Be sure to configure it with the path of the lsp server binary.

Sublime Text

The LSP Package can be configured to work with c3-lsp. Add the syntax highlighting package and configure a LSP client in Settings -> Package Settings -> LSP -> Settings like the following:

"clients": {
    "c3-lsp": {
      "enabled": true,
      // The command line required to run the server.
      "command": [
        "c3-lsp",
      ],

      "selector": "source.c3",
      "schemes": [
        "file"
      ],
      "diagnostics_mode": "open_files",
    }
  }

The first element in the command array is the path to the c3-lsp executable.

Useful links: