@tishlang/tish 2.2.3 → 2.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/tish CHANGED
Binary file
@@ -1,11 +1,17 @@
1
1
  [package]
2
2
  name = "tishlang"
3
- version = "2.2.3"
3
+ version = "2.2.5"
4
4
  edition = "2021"
5
5
  description = "Tish CLI - run, REPL, compile to native"
6
6
  license-file = { workspace = true }
7
7
  repository = { workspace = true }
8
8
 
9
+ # tishlang_runtime has no direct source use here — it's required by the http/fs/process/
10
+ # regex/ws/tty feature-forwards below (`tishlang_runtime/<feat>`). cargo-machete only scans
11
+ # source, so it false-flags it; ignore it.
12
+ [package.metadata.cargo-machete]
13
+ ignored = ["tishlang_runtime"]
14
+
9
15
  [[bin]]
10
16
  name = "tish"
11
17
  path = "src/main.rs"
@@ -38,7 +44,6 @@ tty = ["tishlang_eval/tty", "tishlang_runtime/tty", "tishlang_compil
38
44
  # GPU compute — Apple Silicon only
39
45
  [dependencies]
40
46
  rustyline = { version = "17", features = ["with-file-history"] }
41
- tishlang_lexer = { path = "../tish_lexer", version = ">=0.1" }
42
47
  tishlang_ast = { path = "../tish_ast", version = ">=0.1" }
43
48
  tishlang_parser = { path = "../tish_parser", version = ">=0.1" }
44
49
  tishlang_eval = { path = "../tish_eval", version = ">=0.1" }
@@ -49,7 +54,6 @@ tishlang_opt = { path = "../tish_opt", version = ">=0.1" }
49
54
  tishlang_vm = { path = "../tish_vm", version = ">=0.1" }
50
55
  tishlang_ffi = { path = "../tish_ffi", version = ">=0.1" }
51
56
  tishlang_native = { path = "../tish_native", version = ">=0.1" }
52
- tishlang_llvm = { path = "../tish_llvm", version = ">=0.1" }
53
57
  tishlang_wasm = { path = "../tish_wasm", version = ">=0.1" }
54
58
  tishlang_runtime = { path = "../tish_runtime", version = ">=0.1" }
55
59
  tishlang_core = { path = "../tish_core", version = ">=0.1" }
@@ -5,7 +5,3 @@ edition = "2021"
5
5
  description = "Shared build utilities for Tish (workspace discovery, path resolution)"
6
6
  license-file = { workspace = true }
7
7
  repository = { workspace = true }
8
-
9
- [dependencies]
10
- # Bundled `protoc` for nested `cargo build` (Lance / prost-build) when none is on PATH.
11
- protoc-bin-vendored = "3"
@@ -355,35 +355,6 @@ pub fn create_build_dir(prefix: &str, out_name: &str) -> Result<PathBuf, String>
355
355
  Ok(build_dir)
356
356
  }
357
357
 
358
- /// `PROTOC` for prost-build in transitive crates (e.g. lance-encoding) during nested `cargo build`.
359
- /// Respects an existing `PROTOC`, then `protoc` on `PATH`, then `protoc-bin-vendored`.
360
- fn protoc_for_nested_cargo() -> Option<PathBuf> {
361
- // Empty or non-file PROTOC must not short-circuit: prost-build treats "" like a missing binary.
362
- if let Some(v) = std::env::var_os("PROTOC") {
363
- if !v.is_empty() {
364
- let p = PathBuf::from(&v);
365
- if p.is_file() {
366
- return None;
367
- }
368
- }
369
- }
370
- // Prefer vendored protoc over PATH: a broken or non-executable `protoc` on PATH still passes `is_file()`.
371
- if let Ok(p) = protoc_bin_vendored::protoc_bin_path() {
372
- return Some(p);
373
- }
374
- let ext = if cfg!(windows) { ".exe" } else { "" };
375
- let name = format!("protoc{}", ext);
376
- if let Some(paths) = std::env::var_os("PATH") {
377
- for dir in std::env::split_paths(&paths) {
378
- let candidate = dir.join(&name);
379
- if candidate.is_file() {
380
- return Some(candidate);
381
- }
382
- }
383
- }
384
- None
385
- }
386
-
387
358
  /// Run cargo build in the given directory.
388
359
  /// If `cross_target` is Some, passes `--target` and skips `-C target-cpu=native`.
389
360
  pub fn run_cargo_build(
@@ -433,9 +404,6 @@ pub fn run_cargo_build(
433
404
  } else {
434
405
  cmd.env_remove("CARGO_INCREMENTAL");
435
406
  }
436
- if let Some(protoc) = protoc_for_nested_cargo() {
437
- cmd.env("PROTOC", protoc);
438
- }
439
407
  let output = cmd
440
408
  .output()
441
409
  .map_err(|e| format!("Failed to run cargo: {}", e))?;
@@ -460,15 +428,6 @@ mod protoc_tests {
460
428
  assert_eq!(cargo_target_name("hello-ios"), "hello_ios");
461
429
  assert_eq!(cargo_target_name("tish_out"), "tish_out");
462
430
  }
463
-
464
- #[test]
465
- fn protoc_for_nested_cargo_without_env_uses_vendored_or_path() {
466
- let _lock = std::sync::Mutex::new(());
467
- let _guard = _lock.lock().unwrap();
468
- std::env::remove_var("PROTOC");
469
- let p = protoc_for_nested_cargo().expect("expected vendored or PATH protoc");
470
- assert!(p.exists(), "resolved protoc should exist: {}", p.display());
471
- }
472
431
  }
473
432
 
474
433
  /// Find the built static library in target/release (or target/$TRIPLE/release).
@@ -11,7 +11,6 @@ tishlang_ast = { path = "../tish_ast", version = ">=0.1" }
11
11
  tishlang_core = { path = "../tish_core", version = ">=0.1" }
12
12
 
13
13
  [dev-dependencies]
14
- tishlang_compile = { path = "../tish_compile", version = ">=0.1" }
15
14
  tishlang_parser = { path = "../tish_parser", version = ">=0.1" }
16
15
  tishlang_opt = { path = "../tish_opt", version = ">=0.1" }
17
16
  tishlang_vm = { path = "../tish_vm", version = ">=0.1" }
@@ -9,11 +9,7 @@ repository = { workspace = true }
9
9
  [dependencies]
10
10
  tishlang_build_utils = { path = "../tish_build_utils", version = ">=0.1" }
11
11
  cranelift = "0.130"
12
- cranelift-codegen = "0.130"
13
- cranelift-frontend = "0.130"
14
12
  cranelift-module = "0.130"
15
13
  cranelift-native = "0.130"
16
14
  cranelift-object = "0.130"
17
- target-lexicon = "0.13"
18
15
  tishlang_bytecode = { path = "../tish_bytecode", version = ">=0.1" }
19
- tishlang_core = { path = "../tish_core", version = ">=0.1" }
@@ -23,4 +23,3 @@ crate-type = ["staticlib", "rlib"]
23
23
  [dependencies]
24
24
  tishlang_bytecode = { path = "../tish_bytecode", version = ">=0.1" }
25
25
  tishlang_vm = { path = "../tish_vm", version = ">=0.1" }
26
- tishlang_core = { path = "../tish_core", version = ">=0.1" }
@@ -13,8 +13,6 @@ timers = []
13
13
  http = [
14
14
  "timers",
15
15
  "tokio",
16
- "reqwest",
17
- "futures",
18
16
  "tiny_http",
19
17
  "tishlang_core/regex",
20
18
  "dep:tishlang_runtime",
@@ -27,7 +25,7 @@ http = [
27
25
  fs = []
28
26
  process = []
29
27
  tty = ["dep:tishlang_runtime", "tishlang_runtime/tty"]
30
- regex = ["dep:fancy-regex", "tishlang_core/regex"]
28
+ regex = ["tishlang_core/regex"]
31
29
  tokio = ["dep:tokio"]
32
30
  ws = ["dep:tishlang_runtime", "tishlang_runtime/ws"]
33
31
 
@@ -43,9 +41,6 @@ tishlang_ast = { path = "../tish_ast", version = ">=0.1" }
43
41
  tishlang_builtins = { path = "../tish_builtins", version = ">=0.1" }
44
42
  tishlang_parser = { path = "../tish_parser", version = ">=0.1" }
45
43
  tishlang_core = { path = "../tish_core", version = ">=0.1" }
46
- reqwest = { version = "0.13.2", default-features = false, features = ["rustls", "json", "stream"], optional = true }
47
- futures = { version = "0.3.32", optional = true }
48
44
  tiny_http = { version = "0.12.0", optional = true }
49
- fancy-regex = { version = "0.17.0", optional = true }
50
45
  tokio = { version = "1.50.0", features = ["rt-multi-thread", "time", "sync"], optional = true }
51
46
  tishlang_runtime = { path = "../tish_runtime", version = ">=0.1", optional = true }
@@ -119,6 +119,15 @@ fn document_symbol(
119
119
  selection_range: Range,
120
120
  children: Option<Vec<DocumentSymbol>>,
121
121
  ) -> DocumentSymbol {
122
+ // LSP spec: selectionRange must be contained in range, or VS Code rejects the whole document
123
+ // outline ("selectionRange must be contained in fullRange"). Some declaration spans are
124
+ // unset/degenerate (e.g. a top-level VarDecl's span defaults to an empty range) and so do not
125
+ // enclose the name span; fall back to the name range to keep the invariant.
126
+ let contains = (range.start.line, range.start.character)
127
+ <= (selection_range.start.line, selection_range.start.character)
128
+ && (selection_range.end.line, selection_range.end.character)
129
+ <= (range.end.line, range.end.character);
130
+ let range = if contains { range } else { selection_range };
122
131
  DocumentSymbol {
123
132
  name,
124
133
  detail,
@@ -1671,6 +1680,50 @@ mod hover_tests {
1671
1680
  assert_eq!(full_doc_end(""), (0, 0));
1672
1681
  assert_eq!(full_doc_end("café"), (0, 4)); // UTF-16 units (é = 1), not bytes (5)
1673
1682
  }
1683
+
1684
+ #[test]
1685
+ fn doc_symbols_satisfy_lsp_selection_containment() {
1686
+ // LSP requires every DocumentSymbol's selectionRange ⊆ range, or VS Code rejects the
1687
+ // whole outline ("selectionRange must be contained in fullRange"). Exercise the
1688
+ // declaration forms the outline emits.
1689
+ use tower_lsp::lsp_types::DocumentSymbol;
1690
+ fn check(syms: &[DocumentSymbol], src: &str) {
1691
+ for s in syms {
1692
+ let (r, sel) = (&s.range, &s.selection_range);
1693
+ let contained = (r.start.line, r.start.character)
1694
+ <= (sel.start.line, sel.start.character)
1695
+ && (sel.end.line, sel.end.character) <= (r.end.line, r.end.character);
1696
+ assert!(
1697
+ contained,
1698
+ "selectionRange {sel:?} not contained in range {r:?} for `{}` in:\n{src}",
1699
+ s.name
1700
+ );
1701
+ if let Some(children) = &s.children {
1702
+ check(children, src);
1703
+ }
1704
+ }
1705
+ }
1706
+ let sources = [
1707
+ "fn f(x) { return x }\n",
1708
+ "let a = 1\n",
1709
+ "let a = 1, b = 2\n",
1710
+ "export fn g() { return 1 }\n",
1711
+ "export let x = 1\n",
1712
+ "type T = number\n",
1713
+ "declare fn h(): void\n",
1714
+ "declare let y: number\n",
1715
+ "fn outer() {\n fn inner() { return 1 }\n return inner\n}\n",
1716
+ "export type Opts = { a: number }\n",
1717
+ ];
1718
+ for src in sources {
1719
+ let p = parse(src);
1720
+ let mut syms = Vec::new();
1721
+ for s in &p.statements {
1722
+ doc_symbol_stmt(s, src, &mut syms);
1723
+ }
1724
+ check(&syms, src);
1725
+ }
1726
+ }
1674
1727
  }
1675
1728
 
1676
1729
  #[cfg(test)]
@@ -47,8 +47,6 @@ http-hyper = [
47
47
  "dep:hyper",
48
48
  "dep:hyper-util",
49
49
  "dep:http-body-util",
50
- "dep:http",
51
- "dep:pin-project-lite",
52
50
  "dep:core_affinity",
53
51
  "tokio/net",
54
52
  "tokio/rt",
@@ -92,8 +90,6 @@ crossterm = { version = "0.28", optional = true }
92
90
  hyper = { version = "1", default-features = false, features = ["server", "http1", "http2"], optional = true }
93
91
  hyper-util = { version = "0.1", features = ["server", "tokio"], optional = true }
94
92
  http-body-util = { version = "0.1", optional = true }
95
- http = { version = "1", optional = true }
96
- pin-project-lite = { version = "0.2", optional = true }
97
93
  core_affinity = { version = "0.8", optional = true }
98
94
  tokio-tungstenite = { version = "0.29", optional = true }
99
95
  futures-util = { version = "0.3", optional = true }
@@ -6,6 +6,11 @@ description = "Generate Rust glue for Tish cargo: imports (bindgen-style, pre-co
6
6
  license-file = { workspace = true }
7
7
  repository = { workspace = true }
8
8
 
9
+ # proc-macro2 is enabled for its `span-locations` feature, not used by name (Span comes
10
+ # via syn). cargo-machete can't see feature-only deps, so it's ignored here.
11
+ [package.metadata.cargo-machete]
12
+ ignored = ["proc-macro2"]
13
+
9
14
  [[bin]]
10
15
  name = "tishlang-cargo-bindgen"
11
16
  path = "src/main.rs"
@@ -18,6 +23,8 @@ path = "src/lib.rs"
18
23
  cargo_metadata = "0.19"
19
24
  clap = { version = "4.6", features = ["derive", "color"] }
20
25
  pathdiff = "0.2"
26
+ # Not referenced by name (Span comes via syn's re-export), but the `span-locations`
27
+ # feature is load-bearing: it enables Span::start()/end() used in src/lib.rs.
21
28
  proc-macro2 = { version = "1.0", features = ["span-locations"] }
22
29
  serde_json = "1"
23
30
  syn = { version = "2.0", features = ["full", "extra-traits"] }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tishlang/tish",
3
- "version": "2.2.3",
3
+ "version": "2.2.5",
4
4
  "description": "Tish - minimal TS/JS-compatible language. Run, REPL, build to native or other targets.",
5
5
  "license": "PIF",
6
6
  "repository": {
Binary file
Binary file
Binary file
Binary file
Binary file