uiua-lang / uiua

A stack-based array programming language
https://www.uiua.org
MIT License
1.53k stars 107 forks source link

Language server crash #444

Closed memark closed 6 months ago

memark commented 6 months ago

The language server crashes for me in VS Code.

[Info  - 10:41:05 AM] Uiua language server initialized
The application panicked (crashed).
Message:  String 0 not found
Location: /Users/memark/.cargo/registry/src/index.crates.io-6f17d22bba15001f/uiua-0.9.5/src/assembly.rs:242

Backtrace omitted.

Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
[Error - 10:41:05 AM] The Uiua Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
[Error - 10:41:05 AM] Server process exited with code 101.
[Error - 10:41:05 AM] Delivering pending changes failed
TypeError: this.task is not a function
    at /Users/memark/.vscode/extensions/uiua-lang.uiua-vscode-0.0.42/node_modules/vscode-languageclient/lib/common/utils/async.js:28:35

Not sure how to configure the plugin to emit the backtrace.

kaikalii commented 6 months ago

You can enable the backtrace by setting the RUST_BACKTRACE=1 environment variable.

Can I ask:

memark commented 6 months ago

You can enable the backtrace by setting the RUST_BACKTRACE=1 environment variable.

Yes, but how/where? I'm not launching the LS myself.

What version of Uiua are you on?

Location: .../.cargo/registry/src/index.crates.io-6f17d22bba15001f/uiua-0.9.5/...

What were you doing when the crash happened?

Editing/iterating over a uiua code file (running with "uiua watch" in a separate terminal). It crashes constantly. After 5 crashes VS Code tells me it won't keep restarting it.

The code is this (I have not yet tried to reduce it to an MRE) (and yes, it's AoC :)):

SplitBy ← |2 ⊜□≠,

PredictionForRowEnd ← (
  # make start row look like the rest
  ¤□
  # calc the rows going down
  ⍢(
    ⊂: □≡(-⊃(⊢|⊢⇌))◫2°□⊡¯1 .
  | # not ALL zeroes?
    ≠0◇/+≠0⊡¯1
  )
  # extrapolate new last value going up
  # TODO: borde kunna använda omvända windows här också!
  ⍢(
    ⊃(⊡¯1°□⊡¯1|⊡¯1°□⊡¯2|⊡¯2|↘¯2)°□
    ⊂:+
    ⊂:□
  | >1⧻
  )
  # take last value
  °□◇⊡¯1◇⊢
)

SolvePartOne ← /+ ≡PredictionForRowEnd ≡(⋕◇SplitBy@ ) SplitBy@\n
---
⍤:≍, 114 SolvePartOne &fras "example_1"
⍤:≍, 1581679977 SolvePartOne &fras "input"
---

&p $"Part 1: _" SolvePartOne &fras "input"
kaikalii commented 6 months ago

The environment variable can be set wherever in your environment, however your OS handles that.

I have fixed a number of crashes since the latest release. You might try updating with

uiua update --main

You can find the running changelog for the newer version here

memark commented 6 months ago

Updating to main solved the issue. Thanks!

Btw, having the version number as 0.10.0-dev.1 is really great, now I can tell it apart from just having the latest released version.