autotools-language-server icon indicating copy to clipboard operation
autotools-language-server copied to clipboard

[Bug] Server parses slash as directory delimiter on WSL Linux

Open KagaJiankui opened this issue 1 year ago • 1 comments

Using the language server on VSCode 1.87.1 on Ubuntu Linux x64 6.5.0-21-generic with VSCode glspc extension emits following error message:

Failed to handle request 2 textDocument/hover HoverParams(text_document=TextDocumentIdentifier(uri='file:///home/lexington/OS/kernel_legacy/Makefile'), position=37:12, work_done_token=None)
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/pygls/protocol/json_rpc.py", line 266, in _handle_request
    self._execute_request(msg_id, handler, params)
  File "/usr/local/lib/python3.10/dist-packages/pygls/protocol/json_rpc.py", line 188, in _execute_request
    self._send_response(msg_id, handler(params))
  File "/usr/local/lib/python3.10/dist-packages/make_language_server/server.py", line 145, in hover
    for uni in DefinitionFinder(uni.node).find_all(
  File "/usr/local/lib/python3.10/dist-packages/lsp_tree_sitter/__init__.py", line 410, in find_all
    _uri = self.move_cursor(uri, cursor, True)
  File "/usr/local/lib/python3.10/dist-packages/lsp_tree_sitter/__init__.py", line 324, in move_cursor
    tree = self.uri2tree(uri)
  File "/usr/local/lib/python3.10/dist-packages/lsp_tree_sitter/__init__.py", line 284, in uri2tree
    with open(path, "rb") as f:
IsADirectoryError: [Errno 21] Is a directory: '/'
[Error - 11:43:33] Request textDocument/hover failed.
  Message: IsADirectoryError: [Errno 21] Is a directory: '/'
  Code: -32603 
[object Object]

the file causing this error is provided with this attachment: Makefile_errornous.txt. The SLASH variable in this makefile is suspicious to the emitted errors.

KagaJiankui avatar Mar 08 '24 03:03 KagaJiankui

I don't understand the title: / is a path separator in both Win32 and POSIX.

SamB avatar Sep 08 '24 20:09 SamB