erlang-ls / erlang_ls

The Erlang Language Server
https://erlang-ls.github.io/
Apache License 2.0
628 stars 136 forks source link

Crossref doesn't support spaces in erlang_ls.config otp_path #1234

Open grahamj42 opened 2 years ago

grahamj42 commented 2 years ago

Describe the bug

On Windows, Erlang installs in C:\Program Files\erl-nnn, so it's natural to set _otppath to point to this directory.

In this case, crossref cannot find the specs of stdlib functions, but it can use _otppath to read the header files of other OTP applications.

To Reproduce

  1. On a Windows system, set _otppath to the default Erlang install directory.
  2. Open or create an Erlang module using a stdlib function such as io:format.

Expected behavior

Either spaces should be accepted in _otppath or a notification should be given at erlang_ls startup.

Actual behavior

  1. Cannot find definition for ... messages are generated for stdlib functions.
  2. An Unable to parse... message appears in the pop-up for other OTP applications below the specification successfully read from the header file (e.g. with the wx library).

Context

Note, a workround is possible using the 8.3 name C/:PROGRA~1/erl-nn.

grahamj42 commented 2 years ago

This is one of the problems referred to in #1185

grahamj42 commented 2 years ago

Log message:

[Error - 20:51:27] [2022-03-04T20:51:27.904000+01:00] [error] Error indexing file [filename=c:/Program%20Files/erl-24.1/lib/erts-12.1/src/erlang.erl, uri=file:///c:/Program%20Files/erl-24.1/lib/erts-12.1/src/erlang.erl] error:{badmatch,{error,enoent}}:[{els_indexing,try_index_file,2,[{file,"/Users/robert.aloi/git/github/erlang-ls/vscode/erlang_ls/apps/els_lsp/src/els_indexing.erl"},{line,153}]},{els_indexing,index_file,1,[{file,"/Users/robert.aloi/git/github/erlang-ls/vscode/erlang_ls/apps/els_lsp/src/els_indexing.erl"},{line,53}]},{els_utils,lookup_document,1,[{file,"/Users/robert.aloi/git/github/erlang-ls/vscode/erlang_ls/apps/els_core/src/els_utils.erl"},{line,151}]},{els_code_navigation,find,4,[{file,"/Users/robert.aloi/git/github/erlang-ls/vscode/erlang_ls/apps/els_lsp/src/els_code_navigation.erl"},{line,155}]},{els_unused_includes_diagnostics,update_unused,4,[{file,"/Users/robert.aloi/git/github/erlang-ls/vscode/erlang_ls/apps/els_lsp/src/els_unused_includes_diagnostics.erl"},{line,88}]},{lists,foldl,3,[{file,"lists.erl"},{line,1267}]},{els_unused_includes_diagnostics,find_unused_includes,1,[{file,"/Users/robert.aloi/git/github/erlang-ls/vscode/erlang_ls/apps/els_lsp/src/els_unused_includes_diagnostics.erl"},{line,82}]},{els_unused_includes_diagnostics,run,1,[{file,"/Users/robert.aloi/git/github/erlang-ls/vscode/erlang_ls/apps/els_lsp/src/els_unused_includes_diagnostics.erl"},{line,38}]}] [els_indexing:try_index_file/2 L156] <0.689.0>