diff --git a/doc/rst/tools/chpl-language-server/chpl-language-server.rst b/doc/rst/tools/chpl-language-server/chpl-language-server.rst index 3917e84549e3..9e7107863606 100644 --- a/doc/rst/tools/chpl-language-server/chpl-language-server.rst +++ b/doc/rst/tools/chpl-language-server/chpl-language-server.rst @@ -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``. diff --git a/tools/chpl-language-server/src/chpl-language-server.py b/tools/chpl-language-server/src/chpl-language-server.py index 494548623ea9..0bc9863104fd 100755 --- a/tools/chpl-language-server/src/chpl-language-server.py +++ b/tools/chpl-language-server/src/chpl-language-server.py @@ -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( @@ -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