mirror of
https://github.com/latex-lsp/texlab.git
synced 2025-07-07 21:25:32 +00:00
Page:
LSP Internals
No results
4
LSP Internals
Patrick Förster edited this page 2025-02-12 17:54:17 +01:00
Table of Contents
Custom Messages
We extend the Language Server Protocol with custom messages to provide better LaTeX integration. These messages are optional and it is up to the client to support them.
Build Request
The build request is sent from the client to the server to build a given LaTeX document.
A textDocumentBuild
experimental capability is used to indicate the presence of this custom request.
Request:
- method: 'textDocument/build'
- params:
BuildTextDocumentParams
defined as follows:
interface BuildTextDocumentParams {
/**
* The text document to build.
*/
textDocument: TextDocumentIdentifier;
/**
* The position of the cursor for use in forward search (optional).
*/
position?: Position;
}
Response:
- result:
BuildResult
defined as follows:
interface BuildResult {
/**
* The status of the build process.
*/
status: BuildStatus;
}
enum BuildStatus {
/**
* The build process terminated without any errors.
*/
Success = 0,
/**
* The build process terminated with errors.
*/
Error = 1,
/**
* The build process failed to start or crashed.
*/
Failure = 2,
/**
* The build process was cancelled.
*/
Cancelled = 3,
}
Forward Search Request
The forward search request is sent from the client to the server when the user requests a forward search via SyncTeX.
A textDocumentForwardSearch
experimental capability is used to indicate the presence of this custom request.
Request:
- method: 'textDocument/forwardSearch'
- params:
TextDocumentPositionParams
Response:
- result:
ForwardSearchResult
defined as follows:
interface ForwardSearchResult {
/**
* The status of the previewer process.
*/
status: ForwardSearchStatus;
}
enum ForwardSearchStatus {
/**
* The previewer process executed the command without any errors.
*/
Success = 0,
/**
* The previewer process executed the command with errors.
*/
Error = 1,
/**
* The previewer process failed to start or crashed.
*/
Failure = 2,
/**
* The previewer command is not configured.
*/
Unconfigured = 3,
}
Enum Mapping
The following table describes the mapping of LaTeX and BibTeX structures
to their CompletionItemKind
and SymbolKind
.
LaTeX / BibTeX structure | CompletionItemKind | SymbolKind |
---|---|---|
Command | Function (3) |
Function (12) |
Command Argument | Value (12) |
Number (16) |
Snippet | Snippet (15) |
|
Environment | Enum (13) |
Enum (10) |
Section | Module (9) |
Module (2) |
Float | Method (2) |
Method (6) |
Theorem | Variable (6) |
Variable (13) |
Equation | Constant (21) |
Constant (14) |
Enumeration Item | EnumMember (20) |
EnumMember (22) |
Label | Constructor (4) |
Constructor (9) |
Folder | Folder (19) |
Namespace (3) |
File | File (17) |
File (1) |
PGF Library | Property (10) |
Property (7) |
TikZ Library | Property (10) |
Property (7) |
Color | Color (16) |
|
Color Model | Color (16) |
|
Package | Class (7) |
Class (5) |
Class | Class (7) |
Class (5) |
BibTeX Entry (Misc) | Interface (8) |
Interface (11) |
BibTeX Entry (Article) | Event (23) |
Event (24) |
BibTeX Entry (Book) | Struct (22) |
Struct (23) |
BibTeX Entry (Collection) | TypeParameter (25) |
TypeParameter (26) |
BibTeX Entry (Part) | Operator (24) |
Operator (25) |
BibTeX Entry (Thesis) | Unit (11) |
Object (19) |
BibTeX String | Text (1) |
String (15) |
BibTeX Field | Field (5) |
Field (8) |