Skip to content

Lsp server doesn't respond when special characters in filename or path. #64

@arjunkathuria

Description

@arjunkathuria

I have been debugging why nimlsp wont work for me on windows, while works perfectly fine on linux.
what i found was, it seems to be that special characters in path/filename don't play nice with nimlsp and it doesnt respond.

I did some tests, This can be reproduced in linux also:-

  • if there is a special character like # in your path / filename. it wont work.
  • remove the spl character in question and it works again.

Steps to reproduce issue.

  • i booted into linux
  • i made a dir called code/nim/cil/zol.nim
  • run lsp. runs fine, for the most part.
  • make a dir with a spl character in name like code/nim/c#il/xol.nim
  • run lsp. the server gets connected, lsp-log doesn't show any errors, but nothing works.

what causes this

while in the process, i found that the lsp-mode in emacs sends the request to server something like this:

lsp-request-while-no-input("textDocument/completion" (:textDocument (:uri "file:///d%3A/Code/nim/test_karax/kar.nim") :position (:line 3 :character 3) :context #<hash-table equal 1/65 0x35dfd95>))

if you see here, the uri it sends is already encoded:-
(:uri "file:///d%3A/Code/nim/test_karax/kar.nim")

^ this again gets normalized by nimlsp upon receiving, which further escapes it. d%253A.

proposed solution

stop normalizing the received urls ?
i taked to the lsp-mode guys on gitter too, if they'd send non encoded uri's ?
they said they need to stick to the spec and can't exactly just up and change it because they also work with other lsp-servers.

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