Skip to content

LSP (Language Server Protocol) support

Release notes

This issue introduces LSP (Language Server Protocol) support for the FatScript interpreter, allowing developers to integrate FatScript into IDEs like Visual Studio Code (VSC) for advanced code navigation, auto-completion, and error detection.

Problem to solve

Currently, FatScript lacks native LSP support, limiting the development experience in popular editors and IDEs. Users do not have access to real-time code navigation, auto-completion, or syntax diagnostics. Adding LSP support would enhance productivity and make FatScript more accessible to developers using modern code editors.

Proposal

Extend the FatScript interpreter to support an additional operation mode specifically for running as a Language Server. This new mode will leverage existing capabilities, including:

  • AST Introspection: Utilize the interpreter's ability to hold the AST in memory for providing context-aware code analysis.
  • Socket/Server Support: Use the already-existing server and socket handling functionality to implement the LSP communication protocol.
  • New Operation Mode: Introduce a --lsp flag (or similar) that allows the interpreter to run in LSP mode, supporting IDE features such as:
    • Code navigation (go to definition, find references).
    • Auto-completion.
    • Syntax checking and error diagnostics.
    • Formatting using the existing formatting capabilities.

This approach will minimize overhead by integrating LSP functionality directly into the interpreter without the need for external language servers.