add context window monitor
Writes the current context window to logs/current_context_window (uses a symlink to a session ID). This PR was unfortunately generated by a different LLM and did a ton of superficial reformating, it's actually a fairly small and benign change, but I don't want to roll back everything. Hope that's ok.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
//! Inspect tree-sitter AST structure for Rust code
|
||||
|
||||
use tree_sitter::{Parser, Language};
|
||||
use tree_sitter::{Language, Parser};
|
||||
|
||||
fn print_tree(node: tree_sitter::Node, source: &str, indent: usize) {
|
||||
let indent_str = " ".repeat(indent);
|
||||
@@ -10,7 +10,7 @@ fn print_tree(node: tree_sitter::Node, source: &str, indent: usize) {
|
||||
} else {
|
||||
node_text.to_string()
|
||||
};
|
||||
|
||||
|
||||
println!(
|
||||
"{}{} [{}:{}] '{}'",
|
||||
indent_str,
|
||||
@@ -19,7 +19,7 @@ fn print_tree(node: tree_sitter::Node, source: &str, indent: usize) {
|
||||
node.start_position().column + 1,
|
||||
preview.replace('\n', "\\n")
|
||||
);
|
||||
|
||||
|
||||
let mut cursor = node.walk();
|
||||
for child in node.children(&mut cursor) {
|
||||
print_tree(child, source, indent + 1);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Inspect tree-sitter AST structure for Python code
|
||||
|
||||
use tree_sitter::{Parser, Language};
|
||||
use tree_sitter::{Language, Parser};
|
||||
|
||||
fn print_tree(node: tree_sitter::Node, source: &str, indent: usize) {
|
||||
let indent_str = " ".repeat(indent);
|
||||
@@ -10,7 +10,7 @@ fn print_tree(node: tree_sitter::Node, source: &str, indent: usize) {
|
||||
} else {
|
||||
node_text.to_string()
|
||||
};
|
||||
|
||||
|
||||
println!(
|
||||
"{}{} [{}:{}] '{}'",
|
||||
indent_str,
|
||||
@@ -19,7 +19,7 @@ fn print_tree(node: tree_sitter::Node, source: &str, indent: usize) {
|
||||
node.start_position().column + 1,
|
||||
preview.replace('\n', "\\n")
|
||||
);
|
||||
|
||||
|
||||
let mut cursor = node.walk();
|
||||
for child in node.children(&mut cursor) {
|
||||
print_tree(child, source, indent + 1);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Test Python async query
|
||||
|
||||
use tree_sitter::{Parser, Query, QueryCursor, Language};
|
||||
use streaming_iterator::StreamingIterator;
|
||||
use tree_sitter::{Language, Parser, Query, QueryCursor};
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
let source_code = r#"
|
||||
|
||||
Reference in New Issue
Block a user