Crate tinymist_query

Source
Expand description

§tinymist-query

Note: this crate is under development. it currently doesn’t ensure stable APIs, and heavily depending on some unstable crates.

This crate provides a set of APIs to query the information about the source code. Currently it provides:

Re-exports§

pub use analysis::CompletionFeat;
pub use analysis::LocalContext;
pub use analysis::LocalContextGuard;
pub use analysis::LspWorldExt;

Modules§

analysis
Semantic static and dynamic analysis of the source code.
docs
Documentation utilities.
package
Package management tools.
syntax
Analyzing the syntax of a source file.
testing
Extracts test suites from the document.
ty
Types and type operations for Typst.
upstream
Functions from typst-ide

Structs§

AnnotatedContent
Annotated content for a font.
CheckRequest
A request to check the document for errors and lints.
CodeAction
A code action represents to a single or multiple editor behaviors that can be triggered in a text document.
CodeActionRequest
The textDocument/codeAction request is sent from the client to the server to compute commands for a given text document and range. These commands are typically code fixes to either fix problems or to beautify/refactor code.
CodeLensRequest
The textDocument/codeLens request is sent from the client to the server to compute code lenses for a given text document.
ColorPresentationRequest
The textDocument/colorPresentation request is sent from the client to the server to obtain a list of presentations for a color value at a given location.
CompletionRequest
The textDocument/completion request is sent from the client to the server to compute completion items at a given cursor position.
DocumentColorRequest
The textDocument/documentColor request is sent from the client to the server to list all color references found in a given text document. Along with the range, a color value in RGB is returned.
DocumentFontInfo
Information about a font.
DocumentHighlightRequest
The textDocument/documentHighlight request
DocumentLinkRequest
The textDocument/documentLink request is sent from the client to the server to request the location of links in a document.
DocumentMetricsRequest
A request to compute DocumentMetrics for a document.
DocumentMetricsResponse
The response to a DocumentMetricsRequest.
DocumentSymbolRequest
The textDocument/documentSymbol request is sent from the client to the server to retrieve all symbols found in a given text document.
EcoAnnotatedTextEdit
A special text edit with an additional change annotation.
EcoSnippetTextEdit
A textual edit applicable to a text document.
EcoTextDocumentEdit
Describes textual changes on a single text document. The text document is referred to as a OptionalVersionedTextDocumentIdentifier to allow clients to check the text document version before an edit is applied. A TextDocumentEdit describes all changes on a version Si and after they are applied move the document to version Si+1. So the creator of a TextDocumentEdit doesn’t need to sort the array or do any kind of ordering. However the edits must be non overlapping.
EcoWorkspaceEdit
A workspace edit represents changes to many resources managed in the workspace. The edit should either provide changes or documentChanges. If the client can handle versioned document edits and if documentChanges are present, the latter are preferred over changes.
FoldingRangeRequest
The textDocument/foldingRange request is sent from the client to the server to return all folding ranges found in a given text document.
FormattingRequest
A request to format the document.
GotoDeclarationRequest
The textDocument/declaration request asks the server for the declaration location of a symbol at a given text document position.
GotoDefinitionRequest
The textDocument/definition request asks the server for the definition location of a symbol at a given text document position.
HoverRequest
The textDocument/hover request asks the server for hover information at a given text document position.
InlayHintConfig
Configuration for inlay hints.
InlayHintRequest
The textDocument/inlayHint request is sent from the client to the server to compute inlay hints for a given (text document, range) tuple that may be rendered in the editor in place with other text.
InteractCodeContextRequest
A request to get the code context of a text document.
OnEnterRequest
The experimental/onEnter request is sent from client to server to handle the Enter key press.
OnExportRequest
A request to run an export task.
PostfixSnippet
A postfix completion snippet.
PrepareRenameRequest
The textDocument/prepareRename request is sent from the client to the server to setup and test the validity of a rename operation at a given location.
ReferencesRequest
The textDocument/references request is sent from the client to the server to resolve project-wide references for the symbol denoted by the given text document position.
RenameRequest
The textDocument/rename request is sent from the client to the server to ask the server to compute a workspace change so that the client can perform a workspace-wide rename of a symbol.
SelectionRangeRequest
The textDocument/selectionRange request is sent from the client to the server to return suggested selection ranges at an array of given positions. A selection range is a range around the cursor position which the user might be interested in selecting.
SemanticTokensDeltaRequest
The textDocument/semanticTokens/full/delta request is sent from the client to the server to resolve the semantic tokens of a given file, returning only the delta.
SemanticTokensFullRequest
The textDocument/semanticTokens/full request is sent from the client to the server to resolve the semantic tokens of a given file.
ServerInfoRequest
A request to get the server info.
ServerInfoResponse
The response to the server info request.
SignatureHelpRequest
The textDocument/signatureHelp request is sent from the client to the server to request signature information at a given cursor position.
SpanInfo
Span information for some content.
SymbolRequest
The workspace/symbol request is sent from the client to the server to list project-wide symbols matching the given query string.
WillRenameFilesRequest
Handle workspace/willRenameFiles request is sent from the client to the server.
WorkspaceLabelRequest
The workspace/label request resembles workspace/symbol request but is extended for typst cases.

Enums§

ColorTheme
A color theme for rendering the content. The valid values can be checked in color-scheme.
CompilerQueryRequest
The analysis request.
CompilerQueryResponse
The response to the compiler query request.
EcoDocumentChangeOperation
A resource operation represents changes to existing resources or creation of new resources. The operation can be a create, rename or delete operation.
EcoDocumentChanges
The documentChanges property of a WorkspaceEdit can contain TextDocumentEdits to express changes to n different text documents where each text document edit addresses a specific version of a text document. Or it can contain create, rename and delete file / folder operations.
FoldRequestFeature
The feature of the fold request.
InteractCodeContextQuery
A query to get the mode at a specific position in a text document.
InteractCodeContextResponse
A response to a InteractCodeContextQuery.
PositionEncoding
What counts as “1 character” for string indexing. We should always prefer UTF-8, but support UTF-16 as long as it is standard. For more background on encodings and LSP, try “The bottom emoji breaks rust-analyzer”, a well-written article on the topic.

Traits§

SemanticRequest
A request handler with given (semantic) analysis context.
StatefulRequest
A request handler with given (semantic) analysis context and a project snapshot.
SyntaxRequest
A request handler with given syntax information.

Functions§

convert_diagnostics
Converts a list of Typst diagnostics to LSP diagnostics, with potential refinements on the error messages.
jump_from_click
Finds a span range from a clicked physical position in a rendered paged document.
jump_from_cursor
Finds the output location in the document for a cursor position.
path_res_to_url
Convert a path resolution to a URL.
path_to_url
Convert a path to a URL.
to_lsp_position
Convert a Typst position to an LSP position.
to_lsp_range
Convert a Typst range to an LSP range.
to_typst_position
Convert an LSP position to a Typst position.
to_typst_range
Convert an LSP range to a Typst range.
untitled_url
Convert a path to a URL.
url_to_path
Convert a URL to a path.
with_vm
Run a function with a VM instance in the world

Type Aliases§

DiagnosticsMap
Stores diagnostics for files.
FramePosition
The physical position in a document.
LspPosition
An LSP Position encoded by PositionEncoding. An LSP Position encoded by PositionEncoding.
LspRange
An LSP range encoded by PositionEncoding. An LSP range encoded by PositionEncoding.