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§
- 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§
- Annotated
Content - Annotated content for a font.
- Check
Request - A request to check the document for errors and lints.
- Code
Action - A code action represents to a single or multiple editor behaviors that can be triggered in a text document.
- Code
Action Request - 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. - Code
Lens Request - The
textDocument/codeLens
request is sent from the client to the server to compute code lenses for a given text document. - Color
Presentation Request - 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. - Completion
Request - The
textDocument/completion
request is sent from the client to the server to compute completion items at a given cursor position. - Document
Color Request - 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. - Document
Font Info - Information about a font.
- Document
Highlight Request - The
textDocument/documentHighlight
request - Document
Link Request - The
textDocument/documentLink
request is sent from the client to the server to request the location of links in a document. - Document
Metrics Request - A request to compute DocumentMetrics for a document.
- Document
Metrics Response - The response to a DocumentMetricsRequest.
- Document
Symbol Request - The
textDocument/documentSymbol
request is sent from the client to the server to retrieve all symbols found in a given text document. - EcoAnnotated
Text Edit - A special text edit with an additional change annotation.
- EcoSnippet
Text Edit - A textual edit applicable to a text document.
- EcoText
Document Edit - 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. - EcoWorkspace
Edit - 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
. - Folding
Range Request - The
textDocument/foldingRange
request is sent from the client to the server to return all folding ranges found in a given text document. - Formatting
Request - A request to format the document.
- Goto
Declaration Request - The
textDocument/declaration
request asks the server for the declaration location of a symbol at a given text document position. - Goto
Definition Request - The
textDocument/definition
request asks the server for the definition location of a symbol at a given text document position. - Hover
Request - The
textDocument/hover
request asks the server for hover information at a given text document position. - Inlay
Hint Config - Configuration for inlay hints.
- Inlay
Hint Request - 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. - Interact
Code Context Request - A request to get the code context of a text document.
- OnEnter
Request - The
experimental/onEnter
request is sent from client to server to handle the Enter key press. - OnExport
Request - A request to run an export task.
- Postfix
Snippet - A postfix completion snippet.
- Prepare
Rename Request - 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. - References
Request - 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. - Rename
Request - 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. - Selection
Range Request - 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. - Semantic
Tokens Delta Request - 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. - Semantic
Tokens Full Request - The
textDocument/semanticTokens/full
request is sent from the client to the server to resolve the semantic tokens of a given file. - Server
Info Request - A request to get the server info.
- Server
Info Response - The response to the server info request.
- Signature
Help Request - The
textDocument/signatureHelp
request is sent from the client to the server to request signature information at a given cursor position. - Span
Info - Span information for some content.
- Symbol
Request - The
workspace/symbol
request is sent from the client to the server to list project-wide symbols matching the given query string. - Will
Rename Files Request - Handle
workspace/willRenameFiles
request is sent from the client to the server. - Workspace
Label Request - The
workspace/label
request resemblesworkspace/symbol
request but is extended for typst cases.
Enums§
- Color
Theme - A color theme for rendering the content. The valid values can be checked in color-scheme.
- Compiler
Query Request - The analysis request.
- Compiler
Query Response - The response to the compiler query request.
- EcoDocument
Change Operation - A resource operation represents changes to existing resources or creation of new resources. The operation can be a create, rename or delete operation.
- EcoDocument
Changes - 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. - Fold
Request Feature - The feature of the fold request.
- Interact
Code Context Query - A query to get the mode at a specific position in a text document.
- Interact
Code Context Response - A response to a
InteractCodeContextQuery
. - Position
Encoding - 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§
- Semantic
Request - A request handler with given (semantic) analysis context.
- Stateful
Request - A request handler with given (semantic) analysis context and a project snapshot.
- Syntax
Request - 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§
- Diagnostics
Map - Stores diagnostics for files.
- Frame
Position - The physical position in a document.
- LspPosition
- An LSP Position encoded by
PositionEncoding
. An LSP Position encoded byPositionEncoding
. - LspRange
- An LSP range encoded by
PositionEncoding
. An LSP range encoded byPositionEncoding
.