mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-14 14:17:49 +00:00
CCLS Support added (#975)
Also added a test suite for both clangd and ccls
This commit is contained in:
1 parent
01dc6f8734
commit
71a6f1ff82
15 files changed
+337
-5
No files matched your search
+27
-3
@@ -1,12 +1,20 @@
|
||||
import logging
|
||||
import os
|
||||
import shutil as _sh
|
||||
from collections.abc import Iterator
|
||||
from contextlib import contextmanager
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
import pytest
|
||||
from sensai.util.logging import configure
|
||||
|
||||
try:
|
||||
from sensai.util.logging import configure
|
||||
except Exception:
|
||||
# Fallback if 'sensai' is not installed: basic logging configuration
|
||||
def configure(level: int = logging.INFO) -> None:
|
||||
logging.basicConfig(level=level)
|
||||
|
||||
|
||||
from serena.config.serena_config import SerenaPaths
|
||||
from serena.constants import SERENA_MANAGED_DIR_NAME
|
||||
@@ -35,7 +43,9 @@ class LanguageParamRequest:
|
||||
|
||||
|
||||
def get_repo_path(language: Language) -> Path:
|
||||
return Path(__file__).parent / "resources" / "repos" / language / "test_repo"
|
||||
# Map both CPP variants to the shared cpp test repo
|
||||
repo_dir = "cpp" if language in (Language.CPP, Language.CPP_CCLS) else str(language)
|
||||
return Path(__file__).parent / "resources" / "repos" / repo_dir / "test_repo"
|
||||
|
||||
|
||||
def _create_ls(
|
||||
@@ -52,7 +62,11 @@ def _create_ls(
|
||||
gitignore_parser = GitignoreParser(str(repo_path))
|
||||
for spec in gitignore_parser.get_ignore_specs():
|
||||
ignored_paths.extend(spec.patterns)
|
||||
config = LanguageServerConfig(code_language=language, ignored_paths=ignored_paths, trace_lsp_communication=trace_lsp_communication)
|
||||
config = LanguageServerConfig(
|
||||
code_language=language,
|
||||
ignored_paths=ignored_paths,
|
||||
trace_lsp_communication=trace_lsp_communication,
|
||||
)
|
||||
effective_solidlsp_dir = solidlsp_dir if solidlsp_dir is not None else SerenaPaths().serena_user_home_dir
|
||||
return SolidLanguageServer.create(
|
||||
config,
|
||||
@@ -212,6 +226,16 @@ def _determine_disabled_languages() -> list[Language]:
|
||||
if not clojure_tests_enabled:
|
||||
result.append(Language.CLOJURE)
|
||||
|
||||
# Disable CPP_CCLS tests if ccls is not available
|
||||
ccls_tests_enabled = _sh.which("ccls") is not None
|
||||
if not ccls_tests_enabled:
|
||||
result.append(Language.CPP_CCLS)
|
||||
|
||||
# Disable CPP (clangd) tests if clangd is not available
|
||||
clangd_tests_enabled = _sh.which("clangd") is not None
|
||||
if not clangd_tests_enabled:
|
||||
result.append(Language.CPP)
|
||||
|
||||
al_tests_enabled = True
|
||||
if not al_tests_enabled:
|
||||
result.append(Language.AL)
|
||||
|
||||
Reference in new issue
Block a user