Skip to content

Commit 8b74db4

Browse files
authored
Merge branch 'main' into fix-dns-capability-check-15487683922587520007
2 parents d979c39 + 36517ed commit 8b74db4

23 files changed

Lines changed: 781 additions & 458 deletions

File tree

‎.github/workflows/docs.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
uses: actions/checkout@v4
2121

2222
- name: Set up Python
23-
uses: actions/setup-python@v4
23+
uses: actions/setup-python@v7
2424
with:
2525
python-version: '3.10'
2626

‎.github/workflows/graphify.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
uses: actions/checkout@v4
2121

2222
- name: Set up Python ${{ matrix.python-version }}
23-
uses: actions/setup-python@v5
23+
uses: actions/setup-python@v7
2424
with:
2525
python-version: ${{ matrix.python-version }}
2626
cache: 'pip'

‎.github/workflows/pypi-publish.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: actions/checkout@v4
1717

1818
- name: Set up Python
19-
uses: actions/setup-python@v5
19+
uses: actions/setup-python@v7
2020
with:
2121
python-version: "3.12"
2222

@@ -64,7 +64,7 @@ jobs:
6464
- uses: actions/checkout@v4
6565

6666
- name: Set up Python ${{ matrix.python-version }}
67-
uses: actions/setup-python@v5
67+
uses: actions/setup-python@v7
6868
with:
6969
python-version: ${{ matrix.python-version }}
7070

‎.jules/bolt.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@
88
## 2024-05-18 - Removed redundant clone of VM stack during trace logs
99
**Learning:** In `runtime/vm/src/executor.rs`, the debugging instruction trace `self.debugger.trace_instruction` was cloning the entire VM stack using `&self.stack.get_dump()` for every single instruction executed. This caused significant `O(N)` overhead inside the main fetch-decode-execute loop just to format debug output. A new `data_slice()` method was added to `ValueStack` to provide zero-copy slice access (`&[RuntimeValue]`) instead, completely eliminating the allocation overhead.
1010
**Action:** Always scrutinize deep clones in logging, tracing, or hot path loops. Use slice references (`&[T]`) instead of `Vec::clone` when the caller only needs read-only access to a collection.
11+
## 2024-06-25 - Suboptimal Line Search in LSP
12+
**Learning:** Using `chars().nth()` with a byte offset (such as one returned by `.find()`) inside a loop over a string creates an O(N) penalty and may result in an incorrect character lookup if multi-byte unicode characters are present.
13+
**Action:** Use string slicing with the byte index to create a subset string slice, and call `.chars().next_back()` or `.chars().next()` on it for an O(1) and UTF-8 safe boundary lookup.

‎cli/src/commands/migrate.rs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,9 @@ fn replace_call(source: &str, prefix: &str, keyword: &str) -> String {
263263
remaining = &remaining[pos + full.len()..];
264264
if let Some(close) = remaining.find(')') {
265265
let args = &remaining[..close];
266-
result.push_str(&format!("{keyword} {args}"));
266+
result.push_str(keyword);
267+
result.push(' ');
268+
result.push_str(args);
267269
remaining = &remaining[close + 1..];
268270
} else {
269271
result.push_str(remaining);

‎cli/src/watch.rs‎

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -71,29 +71,7 @@ impl FileWatcher {
7171
fn scan_files(&self, states: &mut HashMap<PathBuf, SystemTime>) -> anyhow::Result<()> {
7272
let mut dirs = vec![self.root.clone()];
7373
while let Some(dir) = dirs.pop() {
74-
if dir.is_dir() {
75-
if let Ok(entries) = std::fs::read_dir(dir) {
76-
for entry in entries.flatten() {
77-
let path = entry.path();
78-
if path.is_dir() {
79-
// Don't watch build or cache directories to prevent infinite loops
80-
let name = path.file_name().unwrap_or_default().to_string_lossy();
81-
if name != "build" && name != ".git" && name != "target" {
82-
dirs.push(path);
83-
}
84-
} else {
85-
let ext = path.extension().unwrap_or_default().to_string_lossy();
86-
if ext == "txs" || ext == "ts" {
87-
if let Ok(metadata) = entry.metadata() {
88-
if let Ok(modified) = metadata.modified() {
89-
states.insert(path, modified);
90-
}
91-
}
92-
}
93-
}
94-
}
95-
}
96-
} else {
74+
if !dir.is_dir() {
9775
// Root is a single file
9876
let ext = self.root.extension().unwrap_or_default().to_string_lossy();
9977
if ext == "txs" || ext == "ts" {
@@ -103,6 +81,32 @@ impl FileWatcher {
10381
}
10482
}
10583
}
84+
continue;
85+
}
86+
87+
if let Ok(entries) = std::fs::read_dir(dir) {
88+
for entry in entries.flatten() {
89+
let path = entry.path();
90+
if path.is_dir() {
91+
// Don't watch build or cache directories to prevent infinite loops
92+
let name = path.file_name().unwrap_or_default().to_string_lossy();
93+
if name != "build" && name != ".git" && name != "target" {
94+
dirs.push(path);
95+
}
96+
continue;
97+
}
98+
99+
let ext = path.extension().unwrap_or_default().to_string_lossy();
100+
if ext != "txs" && ext != "ts" {
101+
continue;
102+
}
103+
104+
if let Ok(metadata) = entry.metadata() {
105+
if let Ok(modified) = metadata.modified() {
106+
states.insert(path, modified);
107+
}
108+
}
109+
}
106110
}
107111
}
108112
Ok(())

‎compiler/lexer/src/lib.rs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use techscript_syntax::{lookup_keyword, Token, TokenKind};
1212
/// Private token enumeration used internally by Logos for scanning.
1313
#[derive(Logos, Debug, Clone, Copy, PartialEq, Eq)]
1414
#[logos(skip r"[ \t\r]+")] // Skip spaces, tabs, and carriage returns
15-
#[allow(dead_code)]
1615
enum LogosToken {
1716
#[token("\n")]
1817
#[token("\r\n")]

‎compiler/parser/src/parser.rs‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::collections::HashSet;
2-
use techscript_common::{NodeIdGenerator, Span};
2+
use techscript_common::NodeIdGenerator;
33
use techscript_errors::{Diagnostic, DiagnosticLevel, DiagnosticReporter, ErrorCode};
44
use techscript_syntax::{Token, TokenKind};
55

@@ -18,7 +18,6 @@ pub struct Parser<'a> {
1818
pub(crate) dsl_sub_blocks: HashSet<String>,
1919
}
2020

21-
#[allow(dead_code)]
2221
impl<'a> Parser<'a> {
2322
/// Create a new Parser instance with DSL keyword registry initialized.
2423
pub fn new(tokens: &'a [Token]) -> Self {
@@ -212,16 +211,6 @@ impl<'a> Parser<'a> {
212211
self.node_id_gen.next()
213212
}
214213

215-
/// Returns the span of the current token.
216-
pub(crate) fn current_span(&self) -> Span {
217-
self.peek().span
218-
}
219-
220-
/// Returns the span of the previous token.
221-
pub(crate) fn prev_span(&self) -> Span {
222-
self.previous().span
223-
}
224-
225214
/// Synchronizes the parser boundary to recover from syntax errors.
226215
pub(crate) fn synchronize(&mut self) {
227216
self.advance();

0 commit comments

Comments
 (0)