Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error get-lexer: 'before-lang-line #12

Closed
JJPro opened this issue Apr 10, 2020 · 9 comments · Fixed by #38 · May be fixed by #11
Closed

Error get-lexer: 'before-lang-line #12

JJPro opened this issue Apr 10, 2020 · 9 comments · Fixed by #38 · May be fixed by #11

Comments

@JJPro
Copy link

JJPro commented Apr 10, 2020

Error:

Caught exn in request "textDocument/documentSymbol"
get-lexer: 'before-lang-line
  context...:
   .../racket-langserver/text-document.rkt:233:0: document-symbol

The above error will throw when #lang .. is absent or when there are comments ahead of #lang ..

@mrghofrani
Copy link

mrghofrani commented Aug 3, 2020

I'm facing almost the same issue:

Caught exn in request "textDocument/documentSymbol"
get-lexer: 'before-lang-line

[Error - 11:58:25 PM] Request textDocument/documentSymbol failed.
  Message: internal error in method "textDocument/documentSymbol"
  Code: -32603 

It shows this error every time I type or delete a character from code. Thanks for your help.

@Eugleo
Copy link

Eugleo commented Aug 10, 2020

This issue got reported multiple times on the Magic Racket repo as well; I’ll link the respective issues and their authors below:

If there’s any way I can help, let me know.

@mrghofrani
Copy link

Thank you @Eugleo for the response, seem the solution is to add #lang racket in the second line based on links provided.

@Eugleo
Copy link

Eugleo commented Aug 10, 2020

Yeah, but still the langserver probably should report that in some sensoble way, not just throw a random exception. That's the reason I'm reporting this, anyway.

@silesky
Copy link

silesky commented Nov 10, 2020

I'm getting this error when doing the first exercise in beautiful racket.

I'm getting this when placing #lang racket on the second line

image

@aymanosman
Copy link

The read-accept-reader parameter controls this.

@silesky
Copy link

silesky commented Nov 12, 2020

Thanks; I am still very new to Racket.

@aymanosman I am not sure this is the right issue for this — but I’m actually following up on this bug: Eugleo/magic-racket#24

It does not matter what line number the Lang declaration is on: “#lang br/quicklang” results in that error.

Should I open up a new issue?

@aymanosman
Copy link

I think you problem is different.

Forget what I said above.

What you have is an actual syntax error. You must be following the tutorial wrong.

Screen Shot 2020-11-13 at 14 05 39

@jeapostrophe
Copy link
Owner

Hi everyone,

I think that the before-lang-line is best fixed by adding a case to text-document.rkt's function get-lexer that tests if the lexer is 'before-lang-line and just returns the racket-lexer again, or potentially just always gives back the racket-lexer if the return result is not a procedure?.

For @aymanosman 's error, this message is not coming from the language server, it is coming from br/quicklang, which is reading the syntax of its body without read-accept-reader turned on. This behavior is good and expected for br/quicklang, because it doesn't make sense for a file to have multiple #lang lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants