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

Add missing variable in chpl-language-server #25221

Merged
merged 3 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ syntax highlighting in Emacs):

(with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs
'(chpl-mode . ("chpl-language-server", "--chplcheck"))))
'(chpl-mode . ("chpl-language-server" "--chplcheck"))))

This will enable using the language server with a particular ``.chpl`` file by
calling ``M-x eglot``.
Expand Down
6 changes: 5 additions & 1 deletion tools/chpl-language-server/src/chpl-language-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ def error(msg: str):
error("CHPL_HOME not set")
return None

chplcheck_path = os.path.join(chpl_home, "tools", "chplcheck", "src")
# Add chplcheck to the path, but load via importlib
sys.path.append(chplcheck_path)

def load_module(module_name: str) -> Optional[ModuleType]:
file_path = os.path.join(chplcheck_path, module_name + ".py")
spec = importlib.util.spec_from_file_location(
Expand All @@ -190,7 +194,7 @@ def load_module(module_name: str) -> Optional[ModuleType]:
return module

mods = []
for mod in ["main", "config", "lsp", "driver", "rules"]:
for mod in ["chplcheck", "config", "lsp", "driver", "rules"]:
m = load_module(mod)
if m is None:
return None
Expand Down
Loading