Expand description
KQL Language Tools
This crate provides Rust bindings to Microsoft’s Kusto.Language library
via .NET AOT compilation. It enables KQL validation, completion, and
syntax highlighting in Rust applications.
§Features
- Syntax Validation: Check KQL queries for syntax errors
- Schema Validation: Validate queries against a database schema
- Completions: Get intellisense suggestions at cursor position
- Classification: Get syntax highlighting spans
§Usage
use kql_language_tools::{KqlValidator, ValidationResult};
fn main() -> Result<(), kql_language_tools::Error> {
let validator = KqlValidator::new()?;
let result = validator.validate_syntax("SecurityEvent | take 10")?;
if result.is_valid() {
println!("Query is valid!");
} else {
for diagnostic in result.diagnostics() {
println!("Error at {}:{}: {}", diagnostic.line, diagnostic.column, diagnostic.message);
}
}
Ok(())
}§Native Library
This crate requires a native library built from the .NET AOT project. The library can be:
- Built from source:
cd dotnet && dotnet publish -c Release -r <rid> - Downloaded from releases (if using
bundledfeature) - Specified via
kql_language_tools_PATHenvironment variable
Structs§
- Classification
Result - Result of syntax classification
- Classified
Span - A classified span for syntax highlighting
- Column
- Column definition
- Completion
Item - A completion item
- Completion
Result - Result of completion request
- Diagnostic
- A diagnostic message from validation
- Function
- User-defined function definition
- KqlValidator
- KQL query validator
- Schema
- Database schema for semantic validation
- Table
- Table definition
- Validation
Result - Result of validating a KQL query
Enums§
- Classification
Kind - Classification kind for syntax highlighting
- Completion
Kind - Kind of completion item
- Diagnostic
Severity - Severity level of a diagnostic
- Error
- Errors that can occur when using KQL Language Tools
Constants§
- VERSION
- Library version
Functions§
- is_
available - Check if the native library is available
- library_
path - Get the path to the native library, if found
Type Aliases§
- Result
- Result type alias for this crate