This is LanguageServer.info, produced by Macaulay2, version 1.26.06

LanguageServer -- language server
*********************************

Description
===========

This package provides a language server for Macaulay2 implementing the Language
Server Protocol (LSP) (see
https://microsoft.github.io/language-server-protocol/ ). It is used via the
M2-language-server script, which is distributed with Macaulay2 and starts the
server with standard input and output as the communication channel.

The language server is supported out of the box by the following editors:

  * the Macaulay2 major mode for Emacs (see
    https://github.com/Macaulay2/M2-emacs ), using eglot or lsp-mode
  * the Macaulay2 extension for VS Code (see
    https://github.com/Macaulay2/vscode-macaulay2 )
  * the Macaulay2 plugin for Neovim (see
    https://github.com/Macaulean/macaulay2.nvim )

Author
======

  * Doug Torrance (see https://d-torrance.github.io ) <dtorrance9@gatech.edu>

Version
=======

This documentation describes version 0.1 of LanguageServer, released May 30,
2026.

Citation
========

If you have used this package in your research, please cite it as follows:

+----------------------------------------------------------------------------+
|@misc{LanguageServerSource,                                                 |
|  title = {{LanguageServer: A \emph{Macaulay2} package. Version~0.1}},      |
|  author = {Doug Torrance},                                                 |
|  howpublished = {A \emph{Macaulay2} package available at                   |
|    \url{https://github.com/Macaulay2/M2/tree/stable/M2/Macaulay2/packages}}|
|}                                                                           |
|                                                                            |
+----------------------------------------------------------------------------+

Exports
=======

  * Types
      * LSPServer -- LSP server class
  * Functions and commands
      * setLogger (missing documentation)
      * start -- start the language server
  * Methods
      * "new LSPServer" -- see LSPServer -- LSP server class
      * setLogger(LSPServer,Function)
        -- set up logging for an LSP
        server
      * "start(LSPServer)" -- see start -- start the language
        server

For the programmer
==================

The object LanguageServer is a package (Macaulay2Doc),
defined in LanguageServer.m2, with auxiliary files in
LanguageServer/.

-------------------------------------------------------------------------------

The source of this document is in LanguageServer/doc.m2:28:0.

LSPServer -- LSP server class
*****************************

  * Usage:
        new LSPServer

Description
===========

LSPServer is the main class of the package.  It wraps a JSON-RPC server and
handles the LSP lifecycle: initialize, text document synchronization, and
shutdown.

+---------------------------+
|i1 : server = new LSPServer|
|                           |
|o1 = server                |
|                           |
|o1 : LSPServer             |
+---------------------------+

Methods that use a LSP server:
==============================

  * "new LSPServer"
  * setLogger(LSPServer,Function)
    -- set up logging for an LSP server
  * "start(LSPServer)" -- see start -- start the language server

For the programmer
==================

The object LSPServer is a type (Macaulay2Doc),
with ancestor classes MutableHashTable (Macaulay2Doc) <
HashTable (Macaulay2Doc) < Thing (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in LanguageServer/doc.m2:48:0.

start -- start the language server
**********************************

  * Usage:
        start server
  * Inputs:
      * server, a LSP server,

Description
===========

Starts the language server, reading LSP messages from stdio (Macaulay2Doc)
and writing responses back to stdio (Macaulay2Doc).
This is called automatically by the M2-language-server
script and is not typically invoked directly by the user.

Ways to use start:
==================

  * "start(LSPServer)"

For the programmer
==================

The object start is a method function (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in LanguageServer/doc.m2:66:0.

setLogger(LSPServer,Function) -- set up logging for an LSP server
*****************************************************************

  * Function: setLogger (missing documentation)
  * Usage:
        setLogger(server, f)
  * Inputs:
      * server, a LSP server,
      * f, a function (Macaulay2Doc),

Description
===========

Sets a custom logging function for server.  The function f should accept a
single string.  For example, to log to standard error:

+--------------------------------+
|i1 : server = new LSPServer     |
|                                |
|o1 = server                     |
|                                |
|o1 : LSPServer                  |
+--------------------------------+
|i2 : setLogger(server, printerr)|
|                                |
|o2 = printerr                   |
|                                |
|o2 : FunctionClosure            |
+--------------------------------+

Ways to use this method:
========================

  * setLogger(LSPServer,Function)
    -- set up logging for an LSP server
-------------------------------------------------------------------------------

The source of this document is in LanguageServer/doc.m2:86:0.

setLogger
*********

Ways to use setLogger:
======================

  * setLogger(LSPServer,Function)
    -- set up logging for an LSP server

For the programmer
==================

The object setLogger (missing documentation) is a method function (Macaulay2Doc).

-------------------------------------------------------------------------------

The source of this document is in currentString:1:380.