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:
- language queries defined by the Language Server Protocol.
Re-exports§
pub use analysis::CompletionFeat;
pub use analysis::LocalContext;
pub use analysis::LocalContextGuard;
pub use analysis::LspWorldExt;
Modules§
- Semantic static and dynamic analysis of the source code.
- Documentation utilities.
- Package management tools.
- Analyzing the syntax of a source file.
- Extracts test suites from the document.
- Types and type operations for Typst.
- Functions from typst-ide
Structs§
- Annotated content for a font.
- A request to check the document for errors and lints.
- A code action represents to a single or multiple editor behaviors that can be triggered in a text document.
- 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. - The
textDocument/codeLens
request is sent from the client to the server to compute code lenses for a given text document. - 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. - The
textDocument/completion
request is sent from the client to the server to compute completion items at a given cursor position. - 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. - Information about a font.
- The
textDocument/documentHighlight
request - The
textDocument/documentLink
request is sent from the client to the server to request the location of links in a document. - A request to compute DocumentMetrics for a document.
- The response to a DocumentMetricsRequest.
- The
textDocument/documentSymbol
request is sent from the client to the server to retrieve all symbols found in a given text document. - A special text edit with an additional change annotation.
- A textual edit applicable to a text document.
- 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. ATextDocumentEdit
describes all changes on a version Si and after they are applied move the document to version Si+1. So the creator of aTextDocumentEdit
doesn’t need to sort the array or do any kind of ordering. However the edits must be non overlapping. - A workspace edit represents changes to many resources managed in the workspace. The edit should either provide
changes
ordocumentChanges
. If the client can handle versioned document edits and ifdocumentChanges
are present, the latter are preferred overchanges
. - The
textDocument/foldingRange
request is sent from the client to the server to return all folding ranges found in a given text document. - The
textDocument/declaration
request asks the server for the declaration location of a symbol at a given text document position. - The
textDocument/definition
request asks the server for the definition location of a symbol at a given text document position. - The
textDocument/hover
request asks the server for hover information at a given text document position. - Configuration for inlay hints.
- 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. - A request to get the code context of a text document.
- The
experimental/onEnter
request is sent from client to server to handle the Enter key press. - A postfix completion snippet.
- 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. - 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. - 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. - 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. - 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. - The
textDocument/semanticTokens/full
request is sent from the client to the server to resolve the semantic tokens of a given file. - The
textDocument/signatureHelp
request is sent from the client to the server to request signature information at a given cursor position. - Span information for some content.
- The
workspace/symbol
request is sent from the client to the server to list project-wide symbols matching the given query string. - Handle
workspace/willRenameFiles
request is sent from the client to the server. - The
workspace/label
request resemblesworkspace/symbol
request but is extended for typst cases.
Enums§
- A color theme for rendering the content. The valid values can be checked in color-scheme.
- A resource operation represents changes to existing resources or creation of new resources. The operation can be a create, rename or delete operation.
- The
documentChanges
property of aWorkspaceEdit
can containTextDocumentEdit
s 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. - A query to get the mode at a specific position in a text document.
- A response to a
InteractCodeContextQuery
. - 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§
- A request handler with given (semantic) analysis context.
- A request handler with given (semantic) analysis context and a project snapshot.
- A request handler with given syntax information.
Functions§
- Converts a list of Typst diagnostics to LSP diagnostics, with potential refinements on the error messages.
- Finds a span range from a clicked physical position in a rendered paged document.
- Finds the output location in the document for a cursor position.
- Convert a path resolution to a URL.
- Convert a path to a URL.
- Convert a Typst position to an LSP position.
- Convert a Typst range to an LSP range.
- Convert an LSP position to a Typst position.
- Convert an LSP range to a Typst range.
- Convert a path to a URL.
- Convert a URL to a path.
- Run a function with a VM instance in the world
Type Aliases§
- Stores diagnostics for files.
- The physical position in a document.
- An LSP Position encoded by
PositionEncoding
. An LSP Position encoded byPositionEncoding
. - An LSP range encoded by
PositionEncoding
. An LSP range encoded byPositionEncoding
.