psacawa / systemd-language-server

Language Server for Systemd unit files
GNU General Public License v3.0
24 stars 2 forks source link

Missing `systemd.install.xml` documentation file #2

Closed ValdezFOmar closed 7 months ago

ValdezFOmar commented 8 months ago

When I hover over an attribute under an [Install] section I get an error because the server is trying to open a file called systemd.install.xml that doesn´t exist.

Stacktrace:

Failed to handle request 15 textDocument/hover HoverParams(text_document=TextDocumentIdentifier(uri='file:///home/omar/.config/systemd/user/tldr-cache.timer'), position=10:5, work_done_token=None)
Traceback (most recent call last):
  File "/home/omar/.local/pipx/venvs/systemd-language-server/lib/python3.11/site-packages/pygls/protocol/json_rpc.py", line 266, in _handle_request
    self._execute_request(msg_id, handler, params)
  File "/home/omar/.local/pipx/venvs/systemd-language-server/lib/python3.11/site-packages/pygls/protocol/json_rpc.py", line 188, in _execute_request
    self._send_response(msg_id, handler(params))
                                ^^^^^^^^^^^^^^^
  File "/home/omar/.local/pipx/venvs/systemd-language-server/lib/python3.11/site-packages/systemd_language_server/server.py", line 131, in textDocument_hover
    contents = get_documentation_content(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/omar/.local/pipx/venvs/systemd-language-server/lib/python3.11/site-packages/systemd_language_server/unit.py", line 135, in get_documentation_content
    stream = StringIO(open(filepath).read())
                      ^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/home/omar/.local/pipx/venvs/systemd-language-server/lib/python3.11/site-packages/systemd_language_server/assets/systemd.install.xml'

The file I was editing:

[Unit]
Description=Refresh Pacman mirrorlist weekly with Reflector.

[Timer]
OnCalendar=weekly
Persistent=true
AccuracySec=1us
RandomizedDelaySec=12h

[Install]
WantedBy=timers.target
psacawa commented 7 months ago

Thanks for catching this, it's solved in #3.