@tishlang/tish-lsp 2.16.13 → 2.35.0

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.
Files changed (50) hide show
  1. package/bin/tish-lsp +0 -0
  2. package/crates/js_to_tish/src/transform/expr.rs +12 -2
  3. package/crates/tish/tests/fixtures/fs_parity_callbacks.tish +22 -0
  4. package/crates/tish/tests/fixtures/fs_parity_promises.tish +21 -0
  5. package/crates/tish/tests/fixtures/fs_parity_sync.tish +20 -0
  6. package/crates/tish/tests/fs_parity.rs +103 -0
  7. package/crates/tish/tests/shortcircuit.rs +3 -3
  8. package/crates/tish_ast/src/ast.rs +77 -3
  9. package/crates/tish_builtins/Cargo.toml +1 -0
  10. package/crates/tish_builtins/src/array.rs +195 -16
  11. package/crates/tish_builtins/src/collections.rs +37 -2
  12. package/crates/tish_builtins/src/globals.rs +215 -25
  13. package/crates/tish_builtins/src/math.rs +65 -7
  14. package/crates/tish_builtins/src/number.rs +173 -0
  15. package/crates/tish_builtins/src/string.rs +168 -15
  16. package/crates/tish_bytecode/src/compiler.rs +56 -4
  17. package/crates/tish_bytecode/src/opcode.rs +4 -2
  18. package/crates/tish_compile/src/codegen.rs +513 -44
  19. package/crates/tish_compile/src/infer.rs +26 -11
  20. package/crates/tish_compile/src/resolve.rs +87 -10
  21. package/crates/tish_compile_js/src/codegen.rs +82 -24
  22. package/crates/tish_compile_js/src/tests_jsx.rs +27 -0
  23. package/crates/tish_compiler_wasm/src/resolve_virtual.rs +17 -2
  24. package/crates/tish_core/src/json.rs +5 -1
  25. package/crates/tish_core/src/lib.rs +48 -2
  26. package/crates/tish_core/src/uri.rs +45 -0
  27. package/crates/tish_core/src/value.rs +6 -0
  28. package/crates/tish_eval/Cargo.toml +2 -1
  29. package/crates/tish_eval/src/eval.rs +655 -27
  30. package/crates/tish_eval/src/natives.rs +264 -18
  31. package/crates/tish_eval/src/regex.rs +47 -1
  32. package/crates/tish_fmt/src/lib.rs +23 -4
  33. package/crates/tish_lsp/Cargo.toml +1 -1
  34. package/crates/tish_opt/src/lib.rs +20 -1
  35. package/crates/tish_parser/src/lib.rs +41 -0
  36. package/crates/tish_parser/src/parser.rs +180 -11
  37. package/crates/tish_resolve/src/lib.rs +66 -5
  38. package/crates/tish_runtime/Cargo.toml +5 -1
  39. package/crates/tish_runtime/src/fs_ext.rs +359 -0
  40. package/crates/tish_runtime/src/http_hyper.rs +41 -18
  41. package/crates/tish_runtime/src/lib.rs +128 -9
  42. package/crates/tish_ui/src/jsx.rs +18 -3
  43. package/crates/tish_vm/src/jit.rs +1 -1
  44. package/crates/tish_vm/src/vm.rs +270 -60
  45. package/package.json +1 -1
  46. package/platform/darwin-arm64/tish-lsp +0 -0
  47. package/platform/darwin-x64/tish-lsp +0 -0
  48. package/platform/linux-arm64/tish-lsp +0 -0
  49. package/platform/linux-x64/tish-lsp +0 -0
  50. package/platform/win32-x64/tish-lsp.exe +0 -0
@@ -982,6 +982,12 @@ pub fn object_has(obj: &Value, key: &Value) -> bool {
982
982
  /// A missing/absent `done` is treated as truthy so a malformed object can't spin forever;
983
983
  /// the native iterators always set `done`, so well-formed iteration is exact.
984
984
  pub fn drain_iterator(obj: &Value) -> Option<Vec<Value>> {
985
+ // A string iterates as its characters, each a single-char string (`[...s]`, `for (c of s)`,
986
+ // call-spread `f(...s)`, `Array.from(s)`). Every caller of this helper is a spread/for-of
987
+ // context, so treating a string as iterable here is always correct. (#440)
988
+ if let Value::String(s) = obj {
989
+ return Some(s.chars().map(|c| Value::String(c.to_string().into())).collect());
990
+ }
985
991
  if !matches!(obj, Value::Object(_)) {
986
992
  return None;
987
993
  }
@@ -22,7 +22,8 @@ http = [
22
22
  "tishlang_core/send-values",
23
23
  "tishlang_builtins/send-values",
24
24
  ]
25
- fs = []
25
+ # fs bridges to tishlang_runtime::fs_ext for the Node-compatible surface (#122).
26
+ fs = ["dep:tishlang_runtime", "tishlang_runtime/fs"]
26
27
  process = []
27
28
  tty = ["dep:tishlang_runtime", "tishlang_runtime/tty"]
28
29
  regex = ["tishlang_core/regex"]