SilasMarvin / lsp-ai

LSP-AI is an open-source language server that serves as a backend for AI-powered functionality, designed to assist and empower software engineers, not replace them.
MIT License
1.82k stars 55 forks source link

Issues with special characters, such as `π` #33

Open RomeoV opened 1 week ago

RomeoV commented 1 week ago

Hi, thanks for this awesome project! I've been using it successfully with an ollama instance hosted on a remote machine, and an anthropic api key.

I have many equations in my code, and the LLMs frequently try to use symbols such as π, Γ, or others. However, in these cases the lsp-ai program crashes, with stacktraces such as

thread 'tokio-runtime-worker' panicked at /home/romeo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lsp-ai-0.3.0/src/transformer_worker.rs:92:60:
byte index 333 is not a char boundary; it is inside 'π' (bytes 332..334) of `Here's a Julia function to compute the integral over an ellipsoid:

```julia
# Computes the integral over an ellipsoid
function ellipsoid_integral(a::Float64, b::Float64, c::Float64)
    # a, b, c are the semi-axes of the ellipsoid

    # The volume of`[...]
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Hope we can fix that, it's making it rather difficult for me to work, as the same problem happens when existing symbols from my files are parsed by the program.

SilasMarvin commented 1 week ago

Glad you like it! Thanks for flagging this. I'll test this locally and get a fix for it in the next release!