MCPcopy Create free account
hub / github.com/FSoft-AI4Code/HyperAgent / create

Method create

src/hyperagent/multilspy/language_server.py:62–98  ·  view source on GitHub ↗

Creates a language specific LanguageServer instance based on the given configuration, and appropriate settings for the programming language. If language is Java, then ensure that jdk-17.0.6 or higher is installed, `java` is in PATH, and JAVA_HOME is set to the installation director

(cls, config: MultilspyConfig, logger: MultilspyLogger, repository_root_path: str)

Source from the content-addressed store, hash-verified

60
61 @classmethod
62 def create(cls, config: MultilspyConfig, logger: MultilspyLogger, repository_root_path: str) -> "LanguageServer":
63 """
64 Creates a language specific LanguageServer instance based on the given configuration, and appropriate settings for the programming language.
65
66 If language is Java, then ensure that jdk-17.0.6 or higher is installed, `java` is in PATH, and JAVA_HOME is set to the installation directory.
67
68 :param repository_root_path: The root path of the repository.
69 :param config: The Multilspy configuration.
70 :param logger: The logger to use.
71
72 :return LanguageServer: A language specific LanguageServer instance.
73 """
74 if config.code_language == Language.PYTHON:
75 from hyperagent.multilspy.language_servers.jedi_language_server.jedi_server import (
76 JediServer,
77 )
78
79 return JediServer(config, logger, repository_root_path)
80 elif config.code_language == Language.JAVA:
81 from hyperagent.multilspy.language_servers.eclipse_jdtls.eclipse_jdtls import (
82 EclipseJDTLS,
83 )
84
85 return EclipseJDTLS(config, logger, repository_root_path)
86 elif config.code_language == Language.RUST:
87 from hyperagent.multilspy.language_servers.rust_analyzer.rust_analyzer import (
88 RustAnalyzer,
89 )
90
91 return RustAnalyzer(config, logger, repository_root_path)
92 elif config.code_language == Language.CSHARP:
93 from hyperagent.multilspy.language_servers.omnisharp.omnisharp import OmniSharp
94
95 return OmniSharp(config, logger, repository_root_path)
96 else:
97 logger.log(f"Language {config.code_language} is not supported", logging.ERROR)
98 raise MultilspyException(f"Language {config.code_language} is not supported")
99
100 def __init__(
101 self,

Callers 7

__init__Method · 0.45
__init__Method · 0.45
createMethod · 0.45
__call__Method · 0.45
__call__Method · 0.45
__call__Method · 0.45
__call__Method · 0.45

Calls 6

JediServerClass · 0.90
EclipseJDTLSClass · 0.90
RustAnalyzerClass · 0.90
OmniSharpClass · 0.90
MultilspyExceptionClass · 0.85
logMethod · 0.80

Tested by

no test coverage detected