NAME

YATT::Lite::LanguageServer - Language Server for YATT::Lite

SYNOPSIS

# As started by editors (poly-yatt, lsp-yatt.el).
# Options must come BEFORE the subcommand.
% perl lib/YATT/Lite/LanguageServer.pm --quiet server

# With a protocol trace (also works together with --quiet):
% perl lib/YATT/Lite/LanguageServer.pm --quiet --logfile=/tmp/yatt-ls.log server
% YATT_LANGSERVER_LOG=/tmp/yatt-ls.log emacs ...

DESCRIPTION

YATT::Lite::LanguageServer is a Modulino to provide a Language Server for YATT::Lite. It speaks JSON-RPC (Content-Length framing) over stdin/stdout and delegates the actual work to YATT::Lite::Inspector.

Supported methods

initialize, initialized, shutdown, exit, $/cancelRequest
textDocument/didOpen, didChange (incremental), didSave, didClose
textDocument/publishDiagnostics (server -> client)
textDocument/definition, textDocument/implementation
textDocument/hover
textDocument/documentSymbol
textDocument/completion

Options

Options must precede the server subcommand.

--quiet

Suppress the trace on STDERR. Editors should pass this.

--logfile=FILE (or $YATT_LANGSERVER_LOG)

Append a timestamped protocol trace to FILE, regardless of --quiet.

--dump_request

Hexdump the input buffer on every read (needs Data::HexDump::XXD).

Debugging the Inspector

Create an empty file named DEBUG_YATT_LANGSERVER in the workspace root (the directory given as rootUri) to get YATT::Lite::Inspector debug messages on STDERR. If a directory var/debug_yatt_ls/ also exists there, the document state after every textDocument/didChange is written into it.

Paths and URIs

File URIs are percent-decoded to octet paths and used as they are: the server keys templates by the path form the client sends and never resolves symlinks itself. Keep the client's policy uniform for all buffers of a session (for Eglot: file-truename handling).

Position encoding

Positions are exchanged as perl character offsets, which are UTF-32 code units. When the client offers utf-32 in general.positionEncodings (Eglot does), the server answers with positionEncoding: "utf-32". Clients limited to UTF-16 get the same offsets, so for them columns after a non-BMP character (emoji, some rare kanji) on the same line are off.

Editor Integration

AUTHOR

"KOBAYASI, Hiroaki" <hkoba@cpan.org>