Skip to content

LSP panics with slice index error when .s file contains .macro directive #102

@Seamoose04

Description

@Seamoose04

Description

The LSP crashes with exit code 101 when opening a file containing a .macro directive.

Steps to Reproduce

Create a file with the following minimal content:

.macro test_macro
    lda #$01
.endmacro

Open it in Neovim. The LSP immediately crashes.

Error

thread 'main' panicked at lsp/src/state.rs:66:24:
slice index starts at 286 but ends at 273

Environment

  • OS: Arch Linux
  • Neovim version: v0.12.1
  • ca65-lsp version: main (installed with rust)

Edits:

  • I just found (and tried) the "fix-define-macro" branch. No luck with it, same error occurred.
  • New info! Crashes specifically only occur when a macro is defined in a ".s" file. If the same macro is added to a ".inc" file (even if the file is included in a ".s") no crashes occur. Also, I still get autocomplete and everything in the ".inc", so that is a workable fix for now. IE, I will define all macros in ".inc" and leave them out of ".s" (just include instead). This goes for both the main branch, as well as the "fix-define-macro" branch, no noticable differences.

(Btw, I did use ai to figure out what to include in this issue post/figure out how to write it up. BUT I did find the issue myself, and it is actually causing me problems.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions