Skip to content

Commit

Permalink
Add missing variable in chpl-language-server (chapel-lang#25221)
Browse files Browse the repository at this point in the history
Followup to chapel-lang#25214, fixes a
missing variable forgotten when applying reviewer feedback

Tested with `make test-cls`

[Reviewed by @DanilaFe and @lydia-duncan ]
  • Loading branch information
jabraham17 authored Jun 11, 2024
2 parents 09ad1a6 + 968c10c commit b11b890
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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

0 comments on commit b11b890

Please sign in to comment.