Eugleo / magic-racket

The best coding experience for Racket in VS Code
https://marketplace.visualstudio.com/items?itemName=evzen-wybitul.magic-racket
GNU General Public License v3.0
199 stars 29 forks source link

Pressing Tab after selecting a whole file causes `textDocument/documentSymbol` error #111

Open jryans opened 1 year ago

jryans commented 1 year ago

Steps to reproduce

  1. Save the following content into a file (must be saved, can't use an unsaved buffer)
  2. Select all, press Tab
#lang racket

(provide USER LOG)

(define USER (make-parameter "nobody"))

(define (LOG . as)
    (with-output-to-file "log.txt" #:exists 'append
        (lambda () (printf "~a: ~a\n" (USER) (apply format as)))))

Expected

All lines are indented, no error occurs.

Actual

All lines are indented, but for some reason the lang server also shows this error:

Caught exn in request "textDocument/documentSymbol"
rest: contract violation
  expected: (and/c list? (not/c empty?))
  given: #<void>
  context...:
   /Users/jryans/Projects/Racket/racket-langserver/text-document.rkt:232:0: get-symbols
   /Users/jryans/Projects/Racket/racket-langserver/text-document.rkt:463:0: document-symbol
   /Applications/Racket v8.8/collects/racket/contract/private/arrow-val-first.rkt:486:18
   /Users/jryans/Projects/Racket/racket-langserver/methods.rkt:26:0: process-message
   /Applications/Racket v8.8/collects/racket/contract/private/arrow-val-first.rkt:486:18
   /Users/jryans/Projects/Racket/racket-langserver/main.rkt:60:2: consume

If you do the same in a unsaved buffer, this does not happen.